ID:271681
 
Hello i was just wondering how you would classify a variable so it effects everyone in game. Say you get high enough to become a leader, then you become leader and when you become leader it auto gives you your rank. Then it sends a variable back that shows that the position is taken. So if someone else reaches that level they can't become leader because you have become leader first.
a 'world' variable.
In response to Flame Sage
Yeah i know it's a world variable. I asked you how define the world variable like an example or can you point me to somewhere that shows an example.
In response to Blagh Nabbit
var/Global_Like_Var_Effect = "NO WAI"


As you know, you can define mob/var so all /mob has that variable, /atom/var so /atom and it's children have that var, etc. /var is essentially like at the top level.
In response to Blagh Nabbit
var/worldvar //null by default
mob/verb/setworldvar()
if(!worldvar) //If worldvar is null.
src.ckey=worldvar//sets the src's ckey to worldvar
else src<<"Someone is already a worldvar."
In response to GhostAnime
As you know, you can define mob/var so all /mob has that variable, /atom/var so /atom and it's children have that var, etc. /var is essentially like at the top level.

I know GhostAnime knows this, but just to elaborate for SSP...

"you can define mob/var so all /mob has that variable, /atom/var so /atom and it's children have" their own copy of that var.

Also, the term "world variable" is a bit misleading, because you cannot define new variables under the /world object. What you are using is more commonly known as a "global" variable.

Lastly, you can also have a mob var in exception to my first point, by specifically defining it as a global var. All mobs will have it, but when you change it it'll change for all mobs.

mob
var/global/blah


In your case, I think you're wanting like game settings and stuff, so it'd be better to just use it the way GhostAnime showed you, I was just showing you global mob variables so you knew how they worked. You can find more information here and here.