[Ohrrpgce] arguments vs locals

Bob the Hamster Bob at HamsterRepublic.com
Mon Jun 6 10:38:40 PDT 2005


On Sun, Jun 05, 2005 at 02:04:47AM +1200, TeeEmCee wrote:
> Also, some script calls (as in, npc triggered, autoload map scripts,
> etc) allow you to pass arguments to the scripts. Looking at the
> source, I realise that I was mistaken the whole time that if you don't
> want them, you don't have to declare arguments on the script? It seems
> that if you do this, they will get placed in local variables. I wanted
> to have true or false passed to the newgame script depending on
> whether the player pressed a key at the title (above), this might
> interfer with newgame scripts with locals, would this be a problem?

Yeah. plotscripting does not really distinguish between arguments and 
locals. This may have been a bad design decision, but that is the way 
it works. If you want to add an auto-argument to the new game script, 
that is okay, since script authors should really be initializing their 
locals.... (mmmm... not that anybody knows that)

Although, as I wrote in another post, I prefer having a separate "demo" 
plotscript to be run instead of the new-game script, rather than adding 
an true/false auto-argument to the new game script.

You know, enforcing the separation of arguments and local variables 
would not really be hard. The script-triggering code in the "runscript" 
function in moresubs.bas needs some clean-up anyway. It could make sure 
that locals will always be pre-inited to zero's. This would break the 
scripts of anyone who is already depending on the current undocumented  
"undeclared arguments overflow into locals" behaviour, but hopefully 
nobody is doing that.

---
Bob the Hamster



More information about the Ohrrpgce mailing list