@Masamune:
Ok, working through details...
<var name="Temp1">q1</var>
<var name="Temp2">q2</var>
<var name="Digit">1</var>
<var name="Test"></var>
Test = "$Temp" (created the literal string with the $ sign in it, not the value)
<addtochat>Test=$Test</addtochat> returns:
Test=$Temp
<if advanced='"$Temp1" = "$Temp1"> TRUE ["q1" == "q1"]
<if advanced='"$Temp1" = "$Test1"> TRUE ["$Temp1" == "$Temp1"]
<if advanced='"$Temp1" = "$Test"> FALSE ["q1" != "$Temp"]
Test = "$Temp1" (created the literal string with the $ sign in it, not the value)
<if advanced='"$Temp1" = "$Test"> TRUE ["$Temp1" == "$Temp1"]
<if advanced='"$Temp1" = "$Test1"> FALSE ["q1" != "$Temp11"]
<if advanced='$Temp1=$Test'> FALSE
Also generates a console error:
Error in expression: Unknown variable q1
Spellcast:: q1=q1
I did this to test the results if I didn't force the variables to be strings. This indicates that $Test was evaluated not only to its contained value of $Temp1, but that that was in turn evaluated to its final value of q1 (whereupon it failed because q1 isn't an integer or variable).
Now:
Test = "$Temp3" (created the literal string with the $ sign in it, not the value)
<if advanced='$Test=$Temp3'> FALSE [with console error]
<if advanced='"$Test"="$Temp3"'> TRUE
The non-string version is false because $temp3 isn't a known variable or integer. The string version is true because $temp3 isn't a variable, so it ends up comparing the literal strings "$temp3" (from $Test) and "$temp3".
So doing this as strings, all variables will end up in their most reduced form before evaluation. If the variable exists, it will compare the value of a variable to itself. If the variable doesn't exist, it will compare the name of the variable to itself. In neither case is it possible to determine if the variable existed in the first place.
However.....
We can't compare the variable with itself, but it may be possible to analyze the value of the variable. Specifically, using a regex to check to see if the variable starts with a $. Unfortunately the regex parser isn't cooperating, so having to dig through its quirks a step at a time.
And here we have it.
<if advanced='Regex("$Test", "^[$]")'>
If Test holds the value "$Temp1" (variable with value q1), the regex returns false because "q1" doesn't start with $.
If Test holds the value "$Temp3" (non-existant variable, thus leaving it as the value "$Temp3"), the regex returns true.
And we can simplify it by removing the intermediary variable.
Code:
<var name="Temp1">q1</var>
<if advanced='Regex("$Temp1", "^[$]")'> FALSE
<if advanced='Regex("$Temp3", "^[$]")'> TRUE
So your original code can be accomplished thus:
Code:
<var cmd="inc CycleID" />
<if advanced='Regex("$%Skill$CycleID", "^[$]")'>
<var cmd="set CycleID 1" />
</if>
<var cmd="set NextSpell $%Skill$CycleID" />
<command When="aftercast">wait $Delay;input /ma "$NextSpell"</command>