|
olmec Beginner
Joined: 03 Mar 2009 Posts: 11
|
Posted: Thu Mar 05, 2009 12:13 pm
Parsing colors & counter |
Hi
Thanks for your help with colors - i think i understand the basics now :)
I've a problem with reparsing (multi-state triggers) and colors, maybe i'm doing it the wrong way
here is the problem :
a room with several mobs :
A raving madman rocks back and forth on his heels.
A raving madman rocks back and forth on his heels.
A raving madman rocks back and forth on his heels.
|A raving madman rocks back and forth on his heels.
(the last one has a blue bar before it)
so i've written the following class but it's not working.
Counter is really doing strange "counting" so i suppose i'm doing something wrong
(working "randomly" or so it seems)
Code: |
<class name="mobkilling">
<class name="killmad">
<trigger type="ReParse" priority="2120" ansi="true">
<pattern>A raving madman</pattern>
<value>nbmad = @nbmad + 1
#show @nbmad</value>
<trigger ansi="true">
<pattern>%e[1;36m %e[1;36mA raving madman rocks back and forth on his heels.%e[0m$</pattern>
<value>#show @nbmad</value>
</trigger>
<trigger ansi="true">
<pattern>%e[1;36m|%e[1;36mA raving madman rocks back and forth on his heels.%e[0m$</pattern>
<value>#show @nbmad</value>
</trigger>
</trigger>
</class>
<var name="@nbmad">0</var>
<trigger priority="1970">
<pattern>Exits</pattern>
<value>//Reset counter
nbmad = 0</value>
</trigger>
</class>
<var name="nbmad">2</var>
|
Can you help me debug?
Thanks, olmec |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Mar 05, 2009 3:57 pm |
What exactly do you expect this script to do? As near as I can make out, right now it will trigger on "A raving madman", increment the counter, show the counter, and go to state 1. In state 1 it will trigger on the next "A raving madman" with the appropriate ansi colors, show the counter, and go to state 2. In state 2 it will trigger on "A raving madman" with the appropiately colored "|" in front of it, show the counter, and go to state 0.
What are you actually trying to count in the counter? |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Mar 05, 2009 4:02 pm |
You also have a one variable named named "nbmad" and a variable named "@nbmad". The latter is probably a mistake.
|
|
|
|
olmec Beginner
Joined: 03 Mar 2009 Posts: 11
|
Posted: Thu Mar 05, 2009 4:52 pm |
i'm trying to attack only high-level mobs (with a blue |) (one at a time, but that's for later)
i'm using #show at the moment to tell me if the trigger is working
one task is to count mobs so a general trigger with madman to count madmans
and if the madman is a tiered one attack him so maybe the following code (without a multi-state trigger) is clearer
but i'm really not at east with that problem -
to sum up i would like the trigger to output "kill 4.madman" with the example below
A raving madman rocks back and forth on his heels.
A raving madman rocks back and forth on his heels.
A raving madman rocks back and forth on his heels.
|A raving madman rocks back and forth on his heels.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<class name="mobkilling">
<class name="killmad">
<trigger type="ReParse" priority="2120">
<pattern>A raving madman</pattern>
<value>nbmad = @nbmad + 1</value>
</trigger>
<trigger priority="2170" ansi="true">
<pattern>%e[1;36m|%e[1;36mA raving madman rocks back and forth on his heels.%e[0m$</pattern>
<value>#show %concat(@nbmad,".madman");
//so with code corrected : it will be kill @nbmad.madman</value>
</trigger>
</class>
<var name="@nbmad">0</var>
<trigger priority="1970">
<pattern>Exits</pattern>
<value>//Reset counter
nbmad = 0</value>
</trigger>
</class>
</cmud>
|
Thanks |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Mar 05, 2009 7:52 pm |
There is no reason to use a reparse state for this. I did use states to make the only attack one and to handle reset timing.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<class name="mobkilling" copy="yes">
<class name="killmad" copy="yes">
<trigger name="TargetMad" type="Loop Pattern" param="300" priority="2120" ansi="true" regex="true" copy="yes">
<pattern>(\e\[1;36m\|\e\[1;36m)?A raving madman</pattern>
<value>nbmad = @nbmad + 1
#IF (%1) {
#SHOW %concat(@nbmad,".madman")
#STATE TargetMad 2
}</value>
<trigger ansi="true" regex="true">
<pattern>(\e\[1;36m\|\e\[1;36m)?A raving madman</pattern>
<value>nbmad = @nbmad + 1
#IF (%1) {
#SHOW %concat(@nbmad,".madman")
#STATE TargetMad 2
} {
#STATE TargetMad 0
}</value>
</trigger>
<trigger type="Wait" param="1000" ansi="true" regex="true"/>
</trigger>
<var name="nbmad" usedef="true" copy="yes">
<value>0</value>
<default>0</default>
</var>
</class>
<trigger priority="1970" copy="yes">
<pattern>Exits</pattern>
<value>//Reset counter
#IF (%class(killmad)) {
nbmad = 0
#STATE TargetMad 0
}</value>
</trigger>
</class>
</cmud> |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
olmec Beginner
Joined: 03 Mar 2009 Posts: 11
|
Posted: Fri Mar 06, 2009 7:31 am |
Thanks Vijilante, working really well
|
|
|
|
|
|