Welcome to the Builder Academy

Question Issue with variables

More
01 Aug 2012 02:30 #504 by Papaya Pete
Oh I see. Yeah that was the problem! So what does context do exactly? Does it check to see if the variable exists, something like that, when you use "context?" Trying to understand exactly what it does so that my brain can completely wrap around it. It's probably something I'll understand better the more I use it.

Thanks so much for all the help and patience! Just when I thought I was starting to get the hang of all this...

Please Log in or Create an account to join the conversation.

More
01 Aug 2012 02:44 #505 by Vatiken
Replied by Vatiken on topic Re: Issue with variables
The "context" of a global variable took me forever to understand so I feel your pain. It's incredible simple, it's the terminology that's complex.

Setting the "context" is just setting the location of the variable table array. If you were doing this in c code it would look something like this:
Code:
global_variable_table[context] == variable
By setting the context to the "actor.id", we make sure to place the variables in a section of the array that will only be accessible by someone with that idnum.

If Vatiken's idnum is 6, and I do this:
Code:
context %actor.id% set var 1 global var

then it will store the variable "var" in the global variable table in "6" or "global_variable_table[6]".

If I slap another trigger on the same mobile and do this:
Code:
context 6 if %var% say Found VAR! end context %actor.id% if %var% say Found VAR! end
Both "if"s will fire.

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

Time to create page: 0.159 seconds