In response to Kaioken
Oh, the global modifier can be used like that? Never knew that.
In response to Kaioken
Static isn't the same as global when used inside a proc, and has a different meaning than in languages like C#, but the same meaning as it does in VB.

Local static variables retain their value between calls to the procedure they're in.

So
client/verb/Test()
var/static/x=0
src<<++x

Outputs
1
2
3
4
5
...
In response to Nickr5
Wow. Do I really need to state 10 times that the DM static modifier does the same that the global modifier does? o_O Do I really need to repeat that for each possible use of this modifier? static, just like global, implements the var as a global one, only it restricts its usage to situations depending on where it was defined (however this can sometimes be worked around, as discussed). This particular example you gave is the same one as in the DM Reference entry for the global modifier - you should at least look it up before talking about it.
Obviously a global variable remains the same between proc calls - 'nuff said...?

Maybe this is difficult to understand. All 3 code boxes here are functionally equivalent, the difference is the syntax used used:
var/MyGlob
proc/OutputNumber()
world << ++MyGlob

proc/OutputNumber()
var/global/MyGlob
world << ++MyGlob

proc/OutputNumber()
var/static/MyGlob
world << ++MyGlob

In response to Kaioken
Kaioken wrote:
EDIT: Also, FYI this means if you don't need to access it dynamically, you don't actually need to look for it at runtime through the type. You can tell Dream Maker to grab that var at compile-time by defining the var as the object type (but no need to actually set it to a reference) and accessing the var.

Hmm. var/Obj/N then N.Varzez is a method I hadn't seen for modifying those. Much easier IMO. Ty. (Never actually had the need to use static vars though. I just use global vars holding one instance of the object. -.-')
Page: 1 2