kool26 said:
Hello, how do you call a varset?
example
/varset sow FALSE
/if (!${sow} /call main iam not sure on how to do this never messed with it yet. not sure on what ! means what = false? or true?
ive been messing with for a few hours now + doing other things with mac iam creating. and cant figure it out i tried like above and it wouldnt continue took out the ! and it continues but it dont go to the /call
any help would be great
Thanks
First things first, you must declare your var that you want to play with along with what type of variable it will be used as. In your sample "sow".
/declare sow <type> <space>
Types commonly used: string, int, or timer.
String: When you use a string type your variable can include letter, numbers, and other characters.
Int: When you use an int type your variable can only include numbers. This type of variable is commonly used in if statements. It will return true for any non-zero number. It will return False for 0.
Timer: When you use a timer type your variable is set to a specific value and then proceeds to count down to 0. You can use short version for minutes (m), and seconds (s) to set your variable and it will be converted to a number at that time. 1m = 60s, 1s = 10. When a timer elapses it stays at 0. When used in an if statement it will return true for any timer that is not elapsed.
Space commonly used: inner, outer, or global.
Inner: The variable is contained in the subroutine the variable was defined in. If referenced outside of this subroutine or while a macro is not running it will return NULL. This variable type expires when a subroutine is ended.
Outer: The variable is available anytime a macro is running. If a macro is not running it will return NULL. This variable type expires when a macro is ended.
Global: The variable is available anytime until macroquest is unloaded or everquest is restarted. This variable will not expire until the client is closed.
If statements:
Runs command(s) if formula evaluates to something other than 0. Formulas are ONLY numeric operations. You must use MQ2Data string comparison to turn string comparisons into numeric operations.
/if (formula) {
command(s)
}
or....
/if (forumla) command(single)
Code:
/declare testvar int outer 1
/if (${testvar}) /echo True.
/if (${testvar}==1) /echo True.
/if (!${testvar}) /echo False.
/declare testvar string outer Test String!
/if (${testvar}) --- Errors due to being a string type. /if (Test String!) cannot be evaluated.
/if (${testvar.Length}) /echo True (${testvar.Length}==12)
/if (${testvar.Equal[Test String!]}) /echo True
/if (${testvar.NotEqual[Test String!]}) /echo False
/declare testvar timer outer 1m
/if (${testvar}) /echo True (${testvar}==600)
/delay 30s
/if (${testvar}) /echo True (${testvar}==300)
/delay 31s
/if (${testvar}) /echo False. (${testvar}==0)