Bridge Commander Central
BC Forums => BC Scripting => Topic started by: MLeo on April 11, 2009, 05:41:35 PM
-
I had a, in my oppinion anyway, cool idea, why not make BC tougher? Tougher to scripting errors and other forms of torture (purely from the perspective of BC, I mean, its only purpose is to run BC, and we are all making it so very difficult!).
How hard you ask?
As hard as a diamond.
One of the most common causes of crashes are missing projectile files. So, with that, here is the first module of a series of N modules (I haven't yet thought of all possible cases, so it could be 1, it could also be 10 or more).
Projectiles
Mind you, it is still in Beta for now. I (and hopefully you as well) will test it out more properly. And release it on BCFiles in the near future.
I've attached (along with the file) a picture that shows that it actually works.
What the script does, is it replaces projectile references (in the hardpoint) when those are loaded if it can't find (that is, import) said module, or if that module doesn't contain all 5 required functions (Create, GetName, GetPowerCost, GetLaunchSound and GetLaunchSpeed), with one that is guaranteed to exist, itself (yes the module that protects your BC from faulty projectile references is another torpedo). It looks just like a Photon, has the same speed and damage, and even the same sound and cost. The one thing in that it differs is its name, which is "ProjectileSubstitute".
So, if you see that name, go to the console, and ask the author of the mod to send you the projectiles mentioned! (See screenshot)
The file itself goes in scripts/Custom/Autoload/
It will also protect you from missing pulse weapon references.
Mind you, while it uses similar constructs for handling missing projectiles like my More Than 4 Torpedo types, it doesn't allow more than 4 torpedo types, and I'm still working on properly redoing that mod into a FoundationTech plugin.
-
This will come in VERY handy , so your trying to make BC noob-proof, Very good :D
-
Thanks. Yes, noob proof, but actually more "lazy modder" proof and the real, hidden, reason is to make the job of that poor Technical Support "person" (I doubt he is really a person, just between you and me ;)) a bit easier.
And yes, to make BC less crash prone.
Ok, I admit, that is the real reason.
Also, I've written a bit more extensively about this mod and the background for it on my weblog:
http://my.opera.com/MLeo/blog/2009/04/11/diamond-bridge-commander-projectiles
-
....the real, hidden, reason is to make the job of that poor Technical Support "person" a bit easier.
i.e. You, :lol:
-
I am wondering, could everyone just install it and run BC with it (fullscreen and windowed mode, and of course with and without -TestMode)?
I think I got it, but it can't hurt to be sure.
....the real, hidden, reason is to make the job of that poor Technical Support "person" a bit easier.
i.e. You, :lol:
I forgot about that for a second. Whoops. :P
-
Hey MLeo!
I think I'm experiencing a problem with your DiamondBC_Projectiles.py.
It works fine on one of my modded installs (only Foundation, UMM, Submenu, NanoFX installed) but I get either crashes to desktop or console errors on my KM install (clean KM 1.0 + consolelogger.py and DiamondBC_Projectiles.py) whenever I put the script into the autoload folder - when I remove it again everything works fine. I hope that helps - for more details just ask...
-
Hey MLeo!
I think I'm experiencing a problem with your DiamondBC_Projectiles.py.
It works fine on one of my modded installs (only Foundation, UMM, Submenu, NanoFX installed) but I get either crashes to desktop or console errors on my KM install (clean KM 1.0 + consolelogger.py and DiamondBC_Projectiles.py) whenever I put the script into the autoload folder - when I remove it again everything works fine. I hope that helps - for more details just ask...
I second that.
-
Oooh... I don't think I've managed a stackoverflow in quite some time!
Thanks for finding it, should get a new version soon.
Like, round about, now... ish. :P
Found another, similar error as well.
I knew I had to refactored it, the repetitions were (actually are, considering the error!) killing me.
-
tested it on three installs - seems to work fine for me. But there are no projectiles missing in these installs so I can't say for sure. But I need to say thx. I've just learned the difference between "var = my_function()" and "var = my_function" from reading your script. I didn't know that one can use the second version... This might be useful... so thx for that? :)
And of course: Nice work with your Diamond BC ? Projectiles.
-
So, did anyone else find anything?
tested it on three installs - seems to work fine for me. But there are no projectiles missing in these installs so I can't say for sure. But I need to say thx. I've just learned the difference between "var = my_function()" and "var = my_function" from reading your script. I didn't know that one can use the second version... This might be useful... so thx for that :)
One is assignment from a variable, the other is assignment from a function application.
Let me put it differently, both are assigning the result of an expression, sure, one of them is the evaluation of a "variable", and the other is evaluation of "a function application of a variable".
-
Tougher to scripting errors and other forms of torture
This made me laugh :lol:
Good idea for mod. I'll try it.
-
Great Idea MLeo! But I found an Interference with Scripts trying to launch a Projectile via MissionsLib's FireTorpedoFromPoint or what it was (like the ChainReaction Pulsar does).
I must look were I put the Console Logger, than i can give you a propper printout.
-
Since you mentioned MissionLib, I can take a look there.
But an trace log would be nice.
If you have my ConsoleLogger installed (in say Autoload) then it will appear in scripts/Custom, ending with _output.log (just rename it to _output.txt to upload) starting with the current date and time.
-
What I found on my HD is a logger from USS Frontier. I didn't know you made one. Anyway, Here is the log
-
Please try this one.
I'm unfortunatly not at my usual comp, luckily it was (mostlikely) an easy fix.
-
Anything working now. Thanks, that was quick! :) Have a cookie
-
Use MLeo's ConsoleLogger, its newer and better lmao
Even I use it too :P Tho I also have mine installed, just because I never bothered deleting it xD
-
So, I now just need to pack it up with a nice readme. Maybe a release tonight?
Unless someone finds a problem that is.
-
And I've released it here:
http://bc-central.net/forums/index.php/topic,5599.0.html
I've also submitted it to BCFiles and I'll update the linked post when it gets posted.