Usage Of Advanced Rules

Language: JP EN DE FR
New Items
2023-11-19
users online
Forum » Windower » Spellcast Scripting » Other » usage of advanced rules
usage of advanced rules
Offline
Posts: 12
By Panjabi 2012-11-21 21:59:06
Link | Quote | Reply
 
I'am using the following code, to achieve an adjustment of equipment, if the defined circumstances are valid:

Code
<if mode="AND" spell="Cure*|Cura*" advanced='"%WeatherElement" == "%SpellElement" OR "%DayElement" == "%SpellElement"'>
   <action Type="Equip" When="MidCast">
      <waist>$LightObi</waist>
   </action>
</if>

This code works pretty well.

I just don't understand, why the following, what I tried first when writing the rule, does not work. I can't find any logical reason for it not working:

Code
<if advanced='("%Spell" == "Cure*|Cura*") AND ("%WeatherElement" == "%SpellElement" OR "%DayElement" == "%SpellElement")'>
   <action Type="Equip" When="MidCast">
      <waist>$LightObi</waist>
   </action>
</if>

There is no error message. It just doesn't work as intended.
I found examples where people just used simple "=", but i don't like to use that, since I'm used to use double "="'s, if there's a check, and not an assignment. Tried both, didn't help though. Syntax-wise I see nothing to be wrong with the second code fragment. The reason why I would rather prefer using the second one is, to be able to build more complex boolean expressions, and the first code kinda limits me in that way. (I am using the newest windower[3.4.3.1] and spellcast[2.4.5].)

Does anyone have a clue and may help me understanding that?

Thanks in advance.
Offline
Posts: 12
By Panjabi 2012-11-21 22:36:07
Link | Quote | Reply
 
I finally found my mind-barrier. (Shame on me.)

I think the first expression in the second code fragment doesn't allow wildcards, therefore no internally performed regular expressions are possible. I changed the statement to:

Code
<if advanced='((bool)regex("%Spell","(Cure|Cura).*")) AND ("%WeatherElement" == "%SpellElement" OR "%DayElement" == "%SpellElement")'>

This works like a charm now, since the regular expression within the advanced rule will be executed as intended. The (bool)-cast is necessary to make it work, otherwise spellcast will throw an exception.
Log in to post.