Trigger off an echo?

Post Reply
baerden
Posts: 21
Joined: Thu Jul 18, 2013 7:49 am

Trigger off an echo?

Post by baerden »

So, I have a trigger that sets my round time, and when it reaches 0 it echoes "You have regained your balance.".

I'm using this text to let other triggers know when they can fire.

My triggers arent working with any combination of things, and I'm curios if you can trigger off of echoes at all.

Here is the echo text:

if cgroundtime == "0" then
echo ("\nYou have regained your balance.\n")
HelloWorld2roundtime:echo("<font size=4 color=white>Roundtime: </font><font size=4 color=blue>0</font>")
else
HelloWorld2roundtime:echo("<font size=4 color=white>Roundtime: "..cgroundtime.."</font>")
end


The trigger i'm trying to trigger is:

^You have regained your balance.$

and set to perlregex

Thanks for any help or insights

User avatar
Belgarath
Posts: 232
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#7149

Re: Trigger off an echo?

Post by Belgarath »

If you want Mudlet to trigger off the text, you'd want to use this function.

baerden
Posts: 21
Joined: Thu Jul 18, 2013 7:49 am

Re: Trigger off an echo?

Post by baerden »

Thank you this is exactly what I was looking for!

However, its not functioning corectly. Our mud front end sends out a plugin text every second thats gagged and uses the information in it to set our client elements, thats where i'm grabbing the roundtime variable.

Here is a screen shot of the offending triggers.

Image

Image

And here is a shot of the trigger working without anything triggering off of "You regain your balance."

Image

And this is a screen shot of a test trigger that sends "Hello" to the mud when it sees "You regain your balance." You can see that it keeps firing, where as in the previous screenshot it only fired "You regain your balance" once.

Image

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Trigger off an echo?

Post by phasma »

The correct pattern would be ^You regain your balance\.$

That said, you would be better off not using a regular expression trigger for this, but rather set the trigger type as an 'exact match' - That should make things a lot easier.

baerden
Posts: 21
Joined: Thu Jul 18, 2013 7:49 am

Re: Trigger off an echo?

Post by baerden »

I think I figured out whats going on. Usually the gagged plugin output only updates a few seconds, but it immediately updates on any input, like a prompt. When it does this I think its repeatedly doing the feedtrigger. I'll have to some up with some other way of doing this.

The reason I started down this path is that I was under the impression that lua didnt have a sleep fuction. Basically, something like this (ignore the syntax, i come from hobby Ruby programming):

while roundtime != 0
sleep 0.5
end

dosomething()

So that my script would loop the sleep while in roundtime and immediately when I was out of it, it would continue.

baerden
Posts: 21
Joined: Thu Jul 18, 2013 7:49 am

Re: Trigger off an echo?

Post by baerden »

In case you were wondering, this is the plugin information that the mud sends out to update the graphical elements in our front end.
%%%CG,1360,0,1,0,1,0,0,0,6,4,0,0,0,3,5,chest,3,0,0,2,1,0,0,3,0,0,2,3,1,2,3,0,0,0,1,0,15,the Udemi
branch of Tse Gaiyan,1608.25,4250,CG%%%
%%%SK,@Skills:@Marksmanship: 610.6946 (63859 sec) 0.9252@Archery: 563.0904 (63857 sec) 0.
9252@Archery: 563.0904 (63857 sec) 0.9252@Stealth: 770.186@Marksmanship: 610.6946 (63859 sec) 0.
9252@Dodge: 301.2003 (Practice: 1.915)@Climbing: 103.2494@Hafted Weapons: 12.9503@Effects:@You are
covered in blood.@Your armor is somewhat reducing your stealth.@You are having trouble maneuvering
on your right foot.SK%%%

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Trigger off an echo?

Post by Vadi »

Raise an event and trigger on it instead. Triggering off echoes is very bad.

Post Reply