|
helloworld Newbie
Joined: 21 Apr 2005 Posts: 5
|
Posted: Thu May 12, 2005 7:17 am
multiple variables need to be checked |
Ok, kinda hard to describe this in subject field :)
I have the following trigger->
#trigger {^You are dealing ¤t_percentage (*) damage.$}
#trigger {^You seem to have ¤t_percentage of (*) maximum.$} {#case %ismember(@current_percentage, "0|20|40|60|80|100"} {#va percentage 0} {#va percentage 20} {#va percentage 40} {#va percentage 60} {#va percentage 80} {#va percentage 100}
#if ("%2"="physical") {#va physical_damage @percentage}
#if ("%2"="magical") {#va magical_damage @percentage}
#if ("%2"="holy") {#va holy_damage @percentage}
#trigger {^You fail to determine your percentage of (*) damage.$} {#va percentage fail}
#alias seedamage {#echo Physicaldamage: @physical_damage Magicaldamage: @magical_damage Holydamage: @holy_damage
#va magical_damage no
#va physical_damage no
#va holy_damage no}
This works fine, eg. I get the following from alias->
Physicaldamage: 60 Magicaldamage: 20 Holydamage: 20
Or
Physicaldamage: 60 Magicaldamage: fail Holydamage: fail
But I get into trouble if I'm not dealing any/some of the specified damagetypes.
For example if I only deal physical and magical damage, the alias would report->
Physicaldamage: 80 Magicaldamage: 20 Holydamage: no
I would like to be able to check if variable has certain value ('no' in this case) and omit it from the alias echo.
This way the alias would echo the following->
Physicaldamage: 80 Magicaldamage: 20
Is it possible? |
|
|
|
DeathDealer Adept
Joined: 20 Jul 2004 Posts: 268
|
Posted: Thu May 12, 2005 2:24 pm |
multiple #if statments?
#if {@physical_damage = no} {#echo Magicaldamage: @magical_damage Holydamage: @holy_damage
#va magical_damage no
#va physical_damage no
#va holy_damage no}
#if {@magical_damage = no} etc...
just how i would do it. |
|
_________________
|
|
|
|
Maelstrom Apprentice
Joined: 10 Feb 2005 Posts: 158
|
Posted: Thu May 12, 2005 2:40 pm |
Hmm...
Well for one, I think the second trigger can be simplified. If @current_percentage is always a value of the case then the case is not needed. It might need some testing as I did not try this for bugs but this should be equivalent:
#trigger {^You seem to have ¤t_percentage of (%w) maximum.$} {#va %2_damage @current_percentage}
And if you are not using the variable current_percentage anywhere else then this is better as I dont see where its needed at all:
#trigger {^You seem to have (%d) of (%w) maximum.$} {#va %2_damage %1}
For the main question though, try this instead:
#echo %subregex(Physicaldamage: @physical_damage Magicaldamage: @magical_damage Holydamage: @holy_damage ,"\w+damage: no ","")
Note:
The space at the end of the end of the echo has to be there (right after @holy damage) or the regular expression wont parse the line correctly... |
|
|
|
|
|