SEV Scripting language |
Well, I finally got the chance to actually do something with the scripting language today, and I must say it doesn't always seem to work like it should. I'm not blaming the SE V scripting language, but I feel that people need to know it's little quirks.
So far I discovered following things:
1) A function does NOT stop when it encounters a "return x". Programming languages like C/C++/Java stop their execution in that funcion and return to the place where they left when the funcion got called. So, do not make the same mistake as I, and assuming a return actually returns you to the calling place.
2) Every function seems to wants parameters. Although it'll compile a function that takes no parameters, it won't run good ingame in some cases (when I called "function(void)" in my setup script, I ended up with an empty sector, no planets, no sun, only the lines of the hexes). But, in kwoks scripts, I find functions that do not want parameters run good. I'm lost there ... Annyone knows why it won't take it in one case and will in the other?
Well, that's what I already found out. I assume there will be other things that don't work here as they would've worked in a mayor programming language. So, I suggest putting them here, so that others don't have to spend that time again to find what they did wrong. Perhaps we can make a "Do and Don't" list for on the SE V wiki, if the list get's big enough
.
Re: SEV Scripting language
I had no problem with my function() call. I have not run into any issues with the return as you mentioned. My frustration is that some calls you need to make cannot be executed with the compiler...it requires the full program to be operating otherwise the various lists it depends upon are not available.




Re: SEV Scripting language
Calling a function with no parameters is simply "Function()". To my knowledge it does return to the place where it was called - not sure what you're seeing.
Also check the docs directory for a proper listing of syntax etc in the Scripting reference.
-----
Space Empires Depot | SE:V Balance Mod