BCU main page Bridge Commander Universe
...welcome to the new world.
 
 FAQFAQ  RanksRanks  RulesRules   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups  Staff SiteStaff Site    RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Python Learning Resources and Assistance
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Bridge Commander Universe Forum Index -> BC Scripting
View previous topic :: View next topic  
Author Message

skipper

Cadet 2nd Class
Cadet 2nd Class




Joined: 23 Jul 2002
Posts: 66

Offline

 

 



Reply with quote

Post Posted: 08-03-2004 03:12 PM Post subject:

Code:
import App
import MissionLib
import Bridge.BridgeUtils
import Lib.Ambiguity
import QuickBattle.QuickBattle
import Custom.QuickBattleGame.QuickBattle


pBridge = App.g_kSetManager.GetSet('bridge')
g_pKiska = App.CharacterClass_GetObject(pBridge, 'Helm')
pKiskaMenu = Bridge.BridgeUtils.GetBridgeMenu('Helm')
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
SETIMPULSE = App.Mission_GetNextEventType()



def SetPlayerAction(pAction, pShip):
   return Custom.QuickBattleGame.QuickBattle.SetPlayerAction(pAction, pShip)


if (pKiskaMenu != None):
   event = Lib.Ambiguity.getEvent("ET_SET_IMPULSE")
   g_pKiska.AddPythonFuncHandlerForInstance(event, __name__ + ".SetImpulse")
        pButton = QuickBattle.QuickBattle.CreateBridgeMenuButton(App.TGString('SetImpulse'), event, 0, g_pKiska)
   pKiskaMenu.PrependChild(pButton)



thats what ive got so for where abouts do you put it to get them sub menues sorry for keeping buging you but thanks Smile

Editted to use the Code tag so that the indentation would show


_________________
Smoke Me A Kipper I'll Be Back For Breakfast

Back to top
View user's profile Send private message Send e-mail

MLeo

Fleet Admiral
Fleet Admiral


Age: 22
Zodiac: Aquarius
Joined: 26 Nov 2002
Posts: 11439
Location: Netherlands
Offline

 

 



Reply with quote

Post Posted: 08-03-2004 03:23 PM Post subject:

First, could a mod split this from the topic?


Second, there is one problem to your code. You created a button, not a menu.

A menu can be created this way:
Code:
pMenu = App.STMenu_Create(App.TGString("Menu Name"))


And then, for each button you could do something like this:
Code:
pEvent = App.TGFloatEvent()
pEvent.SetFloat(0.0)
pEvent.SetEventType(SETIMPULSE)
pEvent.SetDestination(g_pKiska)
pButton = App.STButton_CreateW(App.TGString("Name"), pEvent)
pEvent.SetSource(pButton)
#And to add it to the menu:
pMenu.AddChild(pButton)


_________________

How to beat the Black Screen Of Death and Script problems Also handles Console/Screen/Error report/dump.
BC Technical FAQ [Last updated 26/12/2005]
"Trust me, I'm a con artist" - Moist von Lipwig, "Going Postal, Discworld"

Back to top
View user's profile Send private message Send e-mail MSN Messenger

Sim Rex

Moderator
Moderator


Age: 26
Zodiac: Capricorn
Joined: 11 Apr 2002
Posts: 1714

Offline

 

 



Reply with quote

Post Posted: 08-03-2004 03:53 PM Post subject:

MLeoDaalder wrote:
First, could a mod split this from the topic?


Um... Questions like these are the kind of thing this thread actually exists for - small, specific requests for Python/BC API help on topics that are likely to be of interest to quite a lot of people...

So I don't intend to split it. I won't stop you from making your own new thread to continue discussing this in, but I'm not going to remove something on topic and potentially useful from a stickied thread.


_________________
"Could it be it's the end of our world? All the things that we cherish and love
Nothing left but to face this all on my own, cause I am the chosen one!"

-- The Fallen Angel - Iron Maiden(Smith/Harris)

For beginner scripters - The BCU Mission Scripting Lessons

Back to top
View user's profile Send private message Send e-mail

skipper

Cadet 2nd Class
Cadet 2nd Class




Joined: 23 Jul 2002
Posts: 66

Offline

 

 



Reply with quote

Post Posted: 08-03-2004 05:39 PM Post subject:

thanks MLeoDaalder i just got abit confused what to put in your other thred thanks once again


_________________
Smoke Me A Kipper I'll Be Back For Breakfast

Back to top
View user's profile Send private message Send e-mail

dramatdude

Ensign
Ensign


Age: 22
Zodiac: Aries
Joined: 14 Apr 2004
Posts: 109
Location: Alpha Quadrant
Offline

 

 



Reply with quote

Post Posted: 09-19-2004 07:24 PM Post subject:

Alright...I have a model that I've been hardpointing. I finished the hardpoint and saved it. Loaded up BC and got this error when I tried to use the ship.

(Click It)

I can't figure out what the problem is.


_________________
"Khan....I'm laughing at the superior intellect."
-Kirk, Star Trek II

Back to top
View user's profile Send private message Send e-mail AIM Address

MLeo

Fleet Admiral
Fleet Admiral


Age: 22
Zodiac: Aquarius
Joined: 26 Nov 2002
Posts: 11439
Location: Netherlands
Offline

 

 



Reply with quote

Post Posted: 09-19-2004 07:35 PM Post subject:

Can you post your ship file here (use the code tags please).

But there is something wrong on the line above:
kShipStats = {

Could you have forgotten the : sign?


_________________

How to beat the Black Screen Of Death and Script problems Also handles Console/Screen/Error report/dump.
BC Technical FAQ [Last updated 26/12/2005]
"Trust me, I'm a con artist" - Moist von Lipwig, "Going Postal, Discworld"

Back to top
View user's profile Send private message Send e-mail MSN Messenger

dramatdude

Ensign
Ensign


Age: 22
Zodiac: Aries
Joined: 14 Apr 2004
Posts: 109
Location: Alpha Quadrant
Offline

 

 



Reply with quote

Post Posted: 09-19-2004 08:07 PM Post subject:

I don't think the : is missing....afterall, I copied a ship script I knew worked, and filled in the info for the ship I was hardpointing. Here's the script:


Code:
import App
import Multiplayer.SpeciesToShip

def GetShipStats():
   kShipStats = {
      "FilenameHigh": "data/Models/Ships/Thunderbolt/Thunderbolt.nif",
      "FilenameMed": "data/Models/Ships/Thunderbolt/ThunderboltMed.nif",
      "FilenameLow": "data/Models/Ships/Thunderbolt/ThunderboltLow.nif",
      "Name": "Thunderbolt",
      "HardpointFile": "Thunderbolt",
      "Species": Multiplayer.SpeciesToShip.SOVEREIGN
       }
   return kShipStats

def LoadModel(bPreLoad = 0):
   pStats = GetShipStats()

   # Create the LOD info
   if (not App.g_kLODModelManager.Contains(pStats["Name"])):
      # Params are: File Name, PickLeafSize, SwitchOut Distance,
      # Surface Damage Res, Internal Damage Res, Burn Value, Hole Value,
      # Search String for Glow, Search string for Specular, Suffix for specular
      pLODModel = App.g_kLODModelManager.Create(pStats["Name"])
      pLODModel.AddLOD(pStats["FilenameHigh"], 10, 200.0, 15.0, 15.0, 400, 900, "_glow", None, "_spec")
      pLODModel.AddLOD(pStats["FilenameMed"],  10, 400.0, 15.0, 15.0, 400, 900, "_glow", None, "_spec")
      pLODModel.AddLOD(pStats["FilenameLow"],  10, 800.0, 15.0, 30.0, 400, 900, "_glow", None, None)

#      kDebugObj = App.CPyDebug()
      if (bPreLoad == 0):
         pLODModel.Load()
#         kDebugObj.Print("Loading " + pStats["Name"] + "\n")
      else:
         pLODModel.LoadIncremental()
#         kDebugObj.Print("Queueing " + pStats["Name"] + " for pre-loading\n")

def PreLoadModel():
   LoadModel(1)



Oh...and another problem I've had....With only this script, when I try to open it in MPE...it opens the script, but nothing shows up in Scene Root. Weird.


_________________
"Khan....I'm laughing at the superior intellect."
-Kirk, Star Trek II

Back to top
View user's profile Send private message Send e-mail AIM Address

MLeo

Fleet Admiral
Fleet Admiral


Age: 22
Zodiac: Aquarius
Joined: 26 Nov 2002
Posts: 11439
Location: Netherlands
Offline

 

 



Reply with quote

Post Posted: 09-20-2004 08:40 AM Post subject:

Are you trying to load "this" particular script in MPE?
You do know that you need to open the hardpoint.

You are right, I can't find anything wrong with the script...


_________________

How to beat the Black Screen Of Death and Script problems Also handles Console/Screen/Error report/dump.
BC Technical FAQ [Last updated 26/12/2005]
"Trust me, I'm a con artist" - Moist von Lipwig, "Going Postal, Discworld"

Back to top
View user's profile Send private message Send e-mail MSN Messenger

dramatdude

Ensign
Ensign


Age: 22
Zodiac: Aries
Joined: 14 Apr 2004
Posts: 109
Location: Alpha Quadrant
Offline

 

 



Reply with quote

Post Posted: 09-20-2004 09:02 PM Post subject:

No...I'm not trying to load that script into MPE. I was loading the Hardpoint.


_________________
"Khan....I'm laughing at the superior intellect."
-Kirk, Star Trek II

Back to top
View user's profile Send private message Send e-mail AIM Address

Capt. Dunivar

Cadet 3rd Class
Cadet 3rd Class


Age: 30
Zodiac: Capricorn
Joined: 29 Aug 2004
Posts: 40

Offline

 

 



Reply with quote

Post Posted: 09-21-2004 02:47 AM Post subject: Wish i knew how to script..

i'm a noob at scripting i know NOTHING about it lol.. frankly i am disappointed nobody made a mod to be able to view a different camera bridge mod in the Sovereign only galaxy has been released and it's driving me nuts i cannot try get some eye candy to view whole all around my damn sov nemesis bridge! i wanna make a good screenie but i don't have files to make a camera move inside the bridge to many positions u get my drift.. Mad

Back to top
View user's profile Send private message

dramatdude

Ensign
Ensign


Age: 22
Zodiac: Aries
Joined: 14 Apr 2004
Posts: 109
Location: Alpha Quadrant
Offline

 

 



Reply with quote

Post Posted: 09-21-2004 03:06 AM Post subject:

@MLeoDaalder: Any other thoughts about the script? Would you like me to show or upload the hardpoint too? This is driving me up the bulkhead!!


_________________
"Khan....I'm laughing at the superior intellect."
-Kirk, Star Trek II

Back to top
View user's profile Send private message Send e-mail AIM Address

SlimyStrike

'Iw ra'wI' Sogh
'Iw ra'wI' Sogh


Age: 17
Zodiac: Libra
Joined: 01 Dec 2004
Posts: 635
Location: In my Ready room
Offline

 

 



Reply with quote

Post Posted: 01-05-2005 08:30 PM Post subject:

Does it matter what PHYTON version you use or is there a specified version?

Back to top
View user's profile Send private message Send e-mail MSN Messenger

Sim Rex

Moderator
Moderator


Age: 26
Zodiac: Capricorn
Joined: 11 Apr 2002
Posts: 1714

Offline

 

 



Reply with quote

Post Posted: 01-05-2005 09:04 PM Post subject:

SlimyStrike wrote:
Does it matter what PHYTON version you use or is there a specified version?


BC has version 1.5.2 integrated into it, but for the purposes of downloading a Python editor, the version doesn't really matter much, no. The core concepts of the language haven't changed that much.


_________________
"Could it be it's the end of our world? All the things that we cherish and love
Nothing left but to face this all on my own, cause I am the chosen one!"

-- The Fallen Angel - Iron Maiden(Smith/Harris)

For beginner scripters - The BCU Mission Scripting Lessons

Back to top
View user's profile Send private message Send e-mail

Stalker14

Cadet 4th Class
Cadet 4th Class




Joined: 05 Aug 2003
Posts: 10

Offline

 

 



Reply with quote

Post Posted: 01-14-2005 01:02 AM Post subject:

Learning about modding...should be interesting!





-Stalker14


_________________

Back to top
View user's profile Send private message

eclipse74569

Lieutenant
Lieutenant


Age: 26
Zodiac: Pisces
Joined: 07 Apr 2005
Posts: 361
Location: Originally from NC, but moved to DC
Offline

 

 



Reply with quote

Post Posted: 06-11-2005 12:33 AM Post subject: QuickBattle question...

I've been trying to figure this out for quite some time as I have created my very own ship using CG's Sovereign and well... it may sound kinda stupid, but, how do you create a description of a certain ship in the "Player and Region" menu when you select your ship...I've tried and it only gives the description in the "ships" menu, and ??? in the "P and R" menu...

Rog W.

Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger

MLeo

Fleet Admiral
Fleet Admiral


Age: 22
Zodiac: Aquarius
Joined: 26 Nov 2002
Posts: 11439
Location: Netherlands
Offline

 

 



Reply with quote

Post Posted: 06-12-2005 12:57 PM Post subject: Re: QuickBattle question...

eclipse74569 wrote:
I've been trying to figure this out for quite some time as I have created my very own ship using CG's Sovereign and well... it may sound kinda stupid, but, how do you create a description of a certain ship in the "Player and Region" menu when you select your ship...I've tried and it only gives the description in the "ships" menu, and ??? in the "P and R" menu...

Rog W.

Similar as how you add SubMenu's but then replace SubMenu for desc

Use \n for new line.

Though I believe Dasher fixed something for this in FTech... But I'm not sure ATM.


_________________

How to beat the Black Screen Of Death and Script problems Also handles Console/Screen/Error report/dump.
BC Technical FAQ [Last updated 26/12/2005]
"Trust me, I'm a con artist" - Moist von Lipwig, "Going Postal, Discworld"

Back to top
View user's profile Send private message Send e-mail MSN Messenger

eclipse74569

Lieutenant
Lieutenant


Age: 26
Zodiac: Pisces
Joined: 07 Apr 2005
Posts: 361
Location: Originally from NC, but moved to DC
Offline

 

 



Reply with quote

Post Posted: 06-12-2005 02:02 PM Post subject: Re: QuickBattle question...

MLeo wrote:

Similar as how you add SubMenu's but then replace SubMenu for desc

Use \n for new line.

Though I believe Dasher fixed something for this in FTech... But I'm not sure ATM.


Well, I'm editing this to let you know I've tried what you suggested...didn't work

But, I'm not giving up on it yet Razz LOL I'll figure it out Smile

Rog W.

Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger

eclipse74569

Lieutenant
Lieutenant


Age: 26
Zodiac: Pisces
Joined: 07 Apr 2005
Posts: 361
Location: Originally from NC, but moved to DC
Offline

 

 



Reply with quote

Post Posted: 06-28-2005 05:40 PM Post subject:

Ok, Figured it out, had nothing to do with Python scripting whatsoever LOL.

Thanks for your help.


_________________

Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic

All times are GMT

Page 2 of 2
Goto page Previous  1, 2
   Bridge Commander Universe Forum Index -> BC Scripting
 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
Bridge Commander Universe is a Nightsoft company. All rights reserved.