coppro
Level: Smitemaster
Rank Points: 1309
Registered: 11-24-2005
IP: Logged
|
Variables and Text-based revisited (+1)
First off, variables are allowable. Normally, the DROD engine prevents infinite loops by never executing the same line of script again. With variables, this system doesn't work due to loops. After thinking long and hard and discussing with others. I beleive that the following will work:
No character may have more than 8 variables.
Each variable may range from 0-65535 (1 short integer).
A line of script may execute as many times as it wants, unless it is a line that could change the current point in the script, in which case it may execute a maximum of 64 times (the highest number you could really want is 38, the width of a room), or until all variables are the same during a future pass. Calculations show that the memory consumption is negligible compared to the amount of memory DROD normally uses (approzimately 1K max per looping function, does not stack accross characters).
CPU consumption shouldn't be an issue: if someone makes a script that takes forever, just don't play it. Just be content that lockups aren't Mike's fault.
Or, you could just have "repeat loops" that repeat a number of times then stop, with the repeat count readable but not writable.
Also, you should be able to block off code that jumps to the end or the beginning of the block when executing starts for the turn. That way, you don't need to close everything and use complex variables, you can just call a command and expect everything to end itself.
Now, for text-based (Note: I'm a stickler for this, even if I have to use the syntax currently available. I hate drag-drop programming): I have found an excellent scripting language called Lua. The syntax is C-like, but the structure is like BASIC. Essentially, the language is fairly simple yet powerful and strongly adaptable.
That's all, folks!
PS: I'm doing this instead of reviving because I can get my thoughts down in one place and they all go in one thread.
|