ID:179273
 
I've been wondering how to check, and change world vars? I was thinking something like this:
world
var
myvar = 3
mob
verb
Check_World_Var()
for(var/world/myvar/V in world)
usr << V
V += 1


Could anyone clear this up for me?

Thanks

-Rcet
No such thing as a world var, there's global vars:


var/myvar = 1 //no Datum provided making it a global var

mob/verb/Checkmyvar()
usr<<"Myvar is [myvar]"//displays the global var

mob/verb/Changemyvar()
myvar += rand(1,300)
usr<<"My var is now [myvar]"
In response to Nadrew
var/myvar = 1 //no Datum provided making it a global var

Really? I guess that makes sense because the alternative would be to have a seperate myvar for every turf, obj, mob, area, client, ect.

I had always done it like this:
var/global/myvar

Thanks for the shortcut ;)