Bridge Commander Central

BC Forums => BC Modding => Topic started by: CDR_Daxian on August 12, 2010, 10:02:11 PM

Title: py files?
Post by: CDR_Daxian on August 12, 2010, 10:02:11 PM
all of bridge commanders scripts and a few other things are .pyc files, but when downloading hardpoints, they're all .py files, what's with that?
Title: Re: py files?
Post by: Morgan on August 12, 2010, 10:05:02 PM
PY files are what allows us to edit BC scripts. PYC's are the compiled versions of those scripts created from the PY's. PYC's can't be edited.
Title: Re: py files?
Post by: Nebula on August 12, 2010, 10:05:43 PM
pyc are the compiled versions of py files... BC is built on a scripting language called python.

EDIT: I've been beat lol silly comp is acting slow today
Title: Re: py files?
Post by: CDR_Daxian on August 12, 2010, 10:06:19 PM
so how do i get them to work?? :help: :hithead:
Title: Re: py files?
Post by: Morgan on August 12, 2010, 10:06:55 PM
Edit a PY. The game will create new PYC's automatically from those PY's.
Title: Re: py files?
Post by: Nebula on August 12, 2010, 10:08:11 PM
all you do to change a ships hardpoints(to the one you just DLed) is just delete the ships old pyc and let BC create a new one using the py file you placed in the hardpoint folder.(by just loading the ship in BC)
Title: Re: py files?
Post by: CDR_Daxian on August 12, 2010, 10:08:48 PM
im a bit less advance in that area, how do you edit them
 :facepalm:
Title: Re: py files?
Post by: Nebula on August 12, 2010, 10:09:48 PM
For now just look at my last post... we'll get to editing them later once you get other basics down.

Nero once again you jumped the gun lol he wasn't asking how to edit HP files...
Title: Re: py files?
Post by: Morgan on August 12, 2010, 10:11:15 PM
You can edit PY's with notepad. To change hardpoint's you may want to use the Model Property Editor or BCUT though if you're new to this. It's very easy to make a mistake with notepad.
Title: Re: py files?
Post by: Nebula on August 12, 2010, 10:11:55 PM
Nero... he wasn't asking how to edit until you even mentioned it.... you lost him
Title: Re: py files?
Post by: Morgan on August 13, 2010, 12:16:59 AM
Nero... he wasn't asking how to edit until you even mentioned it.... you lost him
I only mentioned it as the key difference between PY and PYC, but yeah I wouldn't be surprised if that's what lost him. My bad  :facepalm:
Title: Re: py files?
Post by: CDR_Daxian on October 18, 2010, 07:12:24 PM
i put a py file in but it didn't even display the ship.

(BTW may this have anything to do with KM 1.0?) :hithead: :hithead: :hithead:

man i'm a complete nube at thisw :eek
Title: Re: py files?
Post by: X_TheUnknown_X on October 19, 2010, 12:28:43 PM
It depends upon which kind of .pyc file you are trying to edit. I assume, here, you are trying to edit a ship hardpoint (that is, the file which detemines its weapons, shields, etc.) which are in the scripts\ships\hardpoints folder. As mentioned above, .pyc files are close to uneditable; unless you have the Model Property Editor in the Bridge Commander SDK.
To start editing a ship with the MPE, you must first load a .nif ship model (found in data\models\ships\[ship name]\, then it will ask you to load your hardpoint, so you need to find your .pyc hardpoint and select it. To view the attached hardpoints, you must check the 'Named Objects' box on the right-hand side of the screen (when you can see the ship model in the viewer), and then click on the 'Scene Root' option in the menu above. From here, you can edit any of the hardpoints from the menu on the left-hand side of the screen.
However, MPE can be difficult to use (I still find it annoying at times), so if you just want to edit the settings without adding any new ones, I would just hit the save button as soon as you load the hardpoint in MPE - which will save it as an editable .py file. From here, I would use the far simpler 'Hardpoint Tweaker' feature in BCUT (available from BC Files) to change a ship's settings. Hope this helps  ;) .

Edit: Just noticed you mentioned you use KM1.0, there should be a folder named 'src' in the BC directory, which contains copies of all the .py files from the KM install. But if the one you need isn't there, just use the method above.
Title: Re: py files?
Post by: JimmyB76 on October 19, 2010, 02:17:18 PM
i put a py file in but it didn't even display the ship.
what exactly are you trying to accomplish?
let's start from there...
Title: Re: py files?
Post by: CDR_Daxian on October 19, 2010, 06:30:54 PM
pretty much adding ships, which involves adding the hardpoints.
Title: Re: py files?
Post by: Nebula on October 19, 2010, 06:35:54 PM
ships you made?

because 99% of ships come with their own hp files and should be a simple c/p
what you are missing may be the custom ship file to get them in game.
Title: Re: py files?
Post by: CDR_Daxian on October 19, 2010, 06:44:26 PM
custom ship file, like in scripts\custom\ships

if so, how do you load them into a pyc with Model Property Editor

sorry for this noviceness :facepalm:
Title: Re: py files?
Post by: Nebula on October 19, 2010, 07:09:52 PM
no need to load them in the MPE cause they can't be edited that way... you use the BCUT to create custom ship files.

actually here is an idea... why don't you post the ships you are trying to add to the game.
Title: Re: py files?
Post by: CDR_Daxian on October 19, 2010, 07:13:44 PM
just added the charleston class

(fan of Hidden Frontier here :yay: :dance)

so i wanted to ad it and i created the custom ship file, what may i ask is the next step?
Title: Re: py files?
Post by: Nebula on October 19, 2010, 07:15:35 PM
you added the whole ship + this custom ship file into the BC folders? right? ok good... next step should be just loading up BC turning on the mutators and loading quick battle.
Title: Re: py files?
Post by: CDR_Daxian on October 19, 2010, 07:40:00 PM
it works

thanx

another question:

how might you choose what type of weapons it has?
Title: Re: py files?
Post by: Morgan on October 19, 2010, 09:10:53 PM
how might you choose what type of weapons it has?
That would involve some hardpoint editing. Can you tell us what kinds of weapons you're looking to configure?
Title: Re: py files?
Post by: CDR_Daxian on October 19, 2010, 09:14:06 PM
as i might have mentioned before: i have km 1.0

and i wanted to configure the weapons to heavy phasers, plus i wanted to configure quamtum torpedoes used on the sovereign.
Title: Re: py files?
Post by: Bren on October 19, 2010, 09:15:49 PM
what exactly are you trying to accomplish?
let's start from there...

*Awards Jimmy the Cookie for 'Conspicuous Gallantry In A Thread Devoid Of Reasoned Enquiry'*
Title: Re: py files?
Post by: dEjavU on October 20, 2010, 12:45:38 AM
..I wanted to configure the weapons to heavy phasers, plus i wanted to configure quantum torpedoes used on the sovereign....

Just open the .py file up with notepad, if all your doing is just adjusting the yield for the phasers and adding quantum torpedoes used by the Sovereign class. It's a good way to get better aqainted with the context of a typicle .py file. To adjust the phaser yields look for this line within each phaser entries....

DorsalPhaser3.SetMaxDamage(2100.000000)

..change the value within the parentheses to what ever you like(do that for all the phasers)for the torpedoe armaments look for something that looks like this within the Sovereign class' .py file....

#################################################
Torpedoes = App.TorpedoSystemProperty_Create("Torpedoes")

Torpedoes.SetMaxCondition(5000.000000)
Torpedoes.SetCritical(0)
Torpedoes.SetTargetable(0)
Torpedoes.SetPrimary(1)
Torpedoes.SetPosition(0.000000, 0.100000, -0.300000)
Torpedoes.SetPosition2D(82.000000, 64.000000)
Torpedoes.SetRepairComplexity(2.000000)
Torpedoes.SetDisabledPercentage(0.500000)
Torpedoes.SetRadius(0.200000)
Torpedoes.SetNormalPowerPerSecond(100.000000)
Torpedoes.SetWeaponSystemType(Torpedoes.WST_TORPEDO)
Torpedoes.SetSingleFire(0)
Torpedoes.SetAimedWeapon(1)
kFiringChainString = App.TGString()
kFiringChainString.SetString("")
Torpedoes.SetFiringChainString(kFiringChainString)
Torpedoes.SetMaxTorpedoes(0, 300)
Torpedoes.SetTorpedoScript(0, "Tactical.Projectiles.PhotonTorpedo1")
Torpedoes.SetMaxTorpedoes(1, 200)
Torpedoes.SetTorpedoScript(1, "Tactical.Projectiles.QuantumTorpedo1")
Torpedoes.SetMaxTorpedoes(2, 0)
Torpedoes.SetTorpedoScript(2, "Tactical.Projectiles.Tricobalt1")
Torpedoes.SetNumAmmoTypes(3)
App.g_kModelPropertyManager.RegisterLocalTemplate(Torpedoes)
#################################################

....copy and paste only the name of the quantum torpedoe over to your ships' corresponding .py file torpedoe armament section. If you feel it's eazier to use programs to edit your .py files then read back a couple of posts and do what Nero and Nebula had been saying.    ;)
Title: Re: py files?
Post by: JimmyB76 on October 20, 2010, 08:01:12 AM
*Awards Jimmy the Cookie for 'Conspicuous Gallantry In A Thread Devoid Of Reasoned Enquiry'*
lol :D
Title: Re: py files?
Post by: Vladko1 on October 20, 2010, 08:16:04 AM
I think the .py and the .pyc (in python) are with close properties to the .jad and the .class files (in java). The .pyc and the .class files can't be edited simply because, they have some strange kind of compression. MPE edits .pyc because it's made from the builders of the game and they know how the python compression works. About the .class files, a Bulgarian made a program several years ago, with wich you can open the .class files.
Title: Re: py files?
Post by: CDR_Daxian on October 20, 2010, 06:11:17 PM
thanks for the help, might need more on this subject though

never know.

all help appreciated :) :)
Title: Re: py files?
Post by: Mario on October 20, 2010, 06:57:51 PM
Quote
I think the .py and the .pyc (in python) are with close properties to the .jad and the .class files (in java). The .pyc and the .class files can't be edited simply because, they have some strange kind of compression. MPE edits .pyc because it's made from the builders of the game and they know how the python compression works.
It is not compressed but compiled to bytecode. Bytecode is intermediary language between assembly language and high level language.

Quote
About the .class files, a Bulgarian made a program several years ago, with wich you can open the .class files.
And the thing you're talking about is a dissasembler or decompiler. There are few python dissasemblers floating around the internet also.
Title: Re: py files?
Post by: Bren on October 21, 2010, 12:21:38 AM
However, as I recall, the code they produce is practically unreadable, being very oddly formatted. Also, most scripters include the .py source files for their projects in their mods, usually letting BC Just-In-Time compile them for the user when they run them.

When .pyc files are distributed, it's usually because the scripter wants to keep the files private, for one reason or another, so decompiling those is seen as rude.

KM is a bit different, and as has been mentioned, th source files are provided along with it. All the original PYC files shipped with BC have equivalent PY files in the Bridge Commander Software Development Kit (or BC SDK), it also contains tools like the MPE and documentation on coding for BC. It was created by the original developers of the game, Totally Games, and can be dowloaded from BC-Files.com (http://www.BCfiles.com).