Multicolor Triggering Help

Posted by BlackGuard on Thu 01 Nov 2012 09:54 AM — 3 posts, 14,714 views.

USA #0
For my MUD, they have made line gathering for combat much easier. Rather than gathering 123543423423 different lines for a system, we now only really need just a handful of lines to code a decently functioning system.

You are afflicted with anorexia.
You have cured anorexia.

Now the problem I'm having is against illusion offenses where they use those lines to trick my system. Luckily illusions appear as one solid color: grey

Whereas the line from the mud is split into two different colors like so:

"You are afflicted with" is the grey color and "anorexia" would be colored in green.

So basically, I'm trying to tackle illusions for my system by triggering variables based on color. As such, after asking around and banging my head against a wall I've come up with this code Affliction Illusion Checker (AIC):


function AIC(name, line, wildcards, styles) -- Affliction View Illusion Checker
   if ((#styles == 3) and (styles[2].textcolour == GetNormalColour(3))) then
		aic = true
  else
		aic = false
  end
end


This basically checks if the affliction word is green in the line: ^You are afflicted with (.*?)\.$ If it matches the color then it sets variable aic to true. I've set that particular line to keep evaluating and lowered the sequence so it gets processed first before the following trigger gets executed:

^You are afflicted with anorexia\.$

if (aic == true) then
aff_anorexia = true
end


And then I have the prompt reset the aic variable back to false.

Quote:

You ask your angel to afflict yourself with anorexia and it glares at him, tormenting his soul.
You are afflicted with anorexia.
aic: false
aff_anorexia: false
aff_anorexia: false
aic: true
aic: true
[4600] [5024] E100 W99 S100 Dev100 Spark56 <<XP 43%>> [csdb eb] 23:9.963 -100 -
> - ALERT: Target is at 90 % mana. - <
[4600] [4974] E100 W99 S100 Dev100 Spark56 <<XP 43%>> [csdb eb] 23:9.994 -50 -
With a swift movement, you strike yourself with a buckler, the symbol of the Gods flaring as you attack.
You jerk your body to the side, lessening the blow.
You are afflicted with paralysis.
aic: false
aff_paralysis: false
aff_paralysis: false
aic: true
aic: true


This leads me to believe that the script is firing too fast and that's why it's not curing. Rather than toss a delay into the system, I imagine there is a much more reliable and simple method out there. Or maybe there's something else that I'm missing/overlooking? Please help me? I think it's lame these cheap system tricks are whats costing me some fights.
Australia Forum Administrator #1
Is one doing "send to script" and one calling a script? Perhaps if you paste both triggers.

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
USA #2
Sorry for the delay. Here's the info you asked for:

Quote:

<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="^You are afflicted with (.*?)\.$"
regexp="y"
script="AIC"
sequence="1"
>
</trigger>
<trigger
enabled="y"
keep_evaluating="y"
match="^You are afflicted with anorexia\.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>if (aic == true) then
aff_anorexia = true
end</send>
</trigger>
</triggers>