Page 1 of 1
script nesting and size limits
Posted: Tue May 24, 2011 1:00 am
by zaroba
two questions
i know that nesting and using #include can expand the script size.
but, even with using #include, is there an actual overall limit to script size?
also, since #include is used to include external script files (which is very nice and great for organization), can you nest #include commands? or do they all have to be in the main script file?
Posted: Tue May 24, 2011 1:49 am
by zaroba
early estimation for delivery zone script given the vehicles, cities, and cargos...
just for the route assignment: over 420 #included files, which is one file for each route and each will contain 262 events.
total size would be over 110000 events for 31500 different trade routes.
kinda insane. not too hard though with copy/pasting being used for most of it.
but could the game handle it?
Posted: Thu May 26, 2011 7:59 pm
by Mit
well thats a good question.. i have no idea
Theoretically, it shouldn't matter to the code how many events there are but each will mean the server prog takes slightly longer to process things and it will require more memory on your PC.
Bigger question here is why exactly you need to do that with includes. Can you explain more about what events you're expecting to have in all those files? Theres probably a much simpler way of doing this (perhaps with an extra script function or two).
Posted: Thu May 26, 2011 11:00 pm
by zaroba
actually decided against doing the above plan as it was too insane even for my standards :p
i like the thought of pushing the games limits, but that would have been nuts
but, the plan was that when a player pulled into a depot in a city (each building was unique), lets say they arrived at Town A depot and activated the script to get a mission, they'd first choose one of 20 destinations, lets say Town C. the osd would load up an #included script named 'Town A to Town C'. in this script there would be ifs for each vehicle available to give cargo to the player based on the vehicle they were in at the time, they'd then have another osd to choose the cargo they wanted, depending on the vehicle, anywhere from a few to almost 2 dozen.
-since there was 21 cities, there would be 420 different city->city routes
-with 21 vehicles, there'd be an 'if' statement for each one and an osd giving the player the option to choose the cargo they delivered and each of these osd options would have needed an event. 75 cargos and 21 vehicles yielded 262 different combos.
thus, 420 #included scripts each with at least 262 events
anyway, it was way to much, even though it'd be a lot of copy/pasting
decided to knock the cities down to 9, and cargo will be random.
otherwise players will always just choose the most profitable route they can.
plus, there was still plenty of other stuff that was going to be in the script. like an admin control panel for me to adjust different values and an options menu for players to customize some things. a player will be able to choose whether or not to view cutscenes, and hopefully in the future, they will also be able to choose a language as well.
Posted: Thu May 26, 2011 11:24 pm
by Mit
actually decided against doing the above plan as it was too insane even for my standards :p
I totally agree with that statement ;]
I'll ponder that some more still though, as a few more options in the script language should let you do that kinda thing without the insane includes
I like the sound of a scripted admin panel.. I've forgotten most of what the scripts are capable of atm, but that you're doing that suggests its doing pretty well
. I'd like to see what sorta stuff you're doing there.