A while ago there was a discussion about functions libraries, but JS was new for nearly all of us. He - the situation has changed a little bit and OXPers are doing cool things in all kinds of flavours and we thought it's time... The Cabal_Common_Library is a collection of helpers and snippets and a documentation for OXP-Developers is available too.
A special thanks to Micha - your input and help was absolutely great and has improved it so much.
Awesome job guys. Well done and I am sure that this library will be of great help to OXPers. I just browsed quickly through the documentation and I am very impressed with the potential for opportunities that are now opened to scripters.
The documentation was (at least for me) the most difficult part and took a lot longer than writing the OXP, but in the end I'm pleased with it. And Michas pointers/questions and suggestions have led to a much higher quality in OXP and documentation.
As an example I always save my games as a number descending with every save. So I end up Commander 988889 in the mission screens rather than Commander Okti. If I can set my commander name rather than my save file name, this will be perfect. With 1.75 we have an event before saving a commander, I am not sure we have one after loading though?
As an example I always save my games as a number descending with every save. So I end up Commander 988889 in the mission screens rather than Commander Okti. If I can set my commander name rather than my save file name, this will be perfect. With 1.75 we have an event before saving a commander, I am not sure we have one after loading though?
Thanks Okti, but I can't follow you here.
Cabal_Common provides only some functions that are not that easy to code for JS-beginners, but does not change OXPs and native objects. Stripping a string in your own OXPs only needs a .substr(), .substring() or via Regexp
var test = player.name;
var restA = test.replace(/[^a-zA-Z]/g,"");
var restB = test.substr(0,5);
log(this.name,"test: "+test+" and restA: "+restA+" and restB: "+restB);
And after loading we have .startUp() and usually this is enough. A special case is BGS - it has to stop the looped sound before the player loads a new savedgame. Otherwise it would still play and the script couldn't do anything anymore.