Variable Declarations

Post » Sat May 28, 2011 9:08 am

Quick question: is it safe to assume all locally defined variables will initialize to zero?

And a tip for any noobs like myself trying to work with globals: you can set their initial states (and their constant status, which determines if they are included in a save game) in the "Gameplay -> Globals..." menu. I was trying to "right-click -> edit" them from the object menu, and getting an error, confusing the hell out of me.
User avatar
Umpyre Records
 
Posts: 3436
Joined: Tue Nov 13, 2007 4:19 pm

Post » Fri May 27, 2011 8:20 pm

Quick question: is it safe to assume all locally defined variables will initialize to zero?


yes.
User avatar
Bones47
 
Posts: 3399
Joined: Fri Nov 09, 2007 11:15 pm

Post » Sat May 28, 2011 8:13 am

Thanks. It came up as zero every time I checked, but a lifetime of C and the vagaries of uninitialized memory space has taught me never to trust that. ^_^
User avatar
Myles
 
Posts: 3341
Joined: Sun Oct 21, 2007 12:52 pm

Post » Fri May 27, 2011 10:28 pm

Thanks. It came up as zero every time I checked, but a lifetime of C and the vagaries of uninitialized memory space has taught me never to trust that. ^_^


geckscript is usually straightforward like perl. But I guess I'll mention that there are a few things it is evil about, and when it gets evil, your script stops running in-game (we been calling that a 'script halt'). Most of the script halts I've ever gotten are when you take a REF variable, if you know what that is yet, and you expect that to actually have the script load a value into - - - but, there happens to be no REF ID gathered within the variable, so it's null, and ... you try to perform a script operation on that REF. It [censored] hates that and it dies without telling you why. So.... enjoy!!! heh.
User avatar
teeny
 
Posts: 3423
Joined: Sun Feb 25, 2007 1:51 am


Return to Fallout: New Vegas