Using a Variable in Trigger Match Line

Post Reply
MKOperson
Posts: 5
Joined: Mon Sep 23, 2013 8:02 pm

Using a Variable in Trigger Match Line

Post by MKOperson »

Hi, I am not sure if this is possible but it will make things simple for me to do if it is.

I want to have a trigger that uses a variable as it's match line.

The variable would be a simple string defined by myself.

The variable will be the only thing in the trigger match line, and mudlet would be looking for it as a simple string.

The string I am looking for could pop up anywhere so I wouldn't necessarily be able to look for something else and use a matches. I basically need the trigger to fire whenever mudlet encounters this variable.

So I would do hunting_target = cultist

then my trigger would be hunting_target
trying_to_attack = true

I suppose this might not be possible and it would not be a very slick operation , still can anyone help?

Silvine
Posts: 142
Joined: Sat Oct 23, 2010 2:36 pm

Re: Using a Variable in Trigger Match Line

Post by Silvine »

Try

regex pattern
(.*)

code
Code: [show] | [select all] lua
grabLine = matches[2]
if string.find(string.lower(grabLine),hunting_target) then
echo("hey got "..hunting_target)
end --if
its clunky but it works

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

Re: Using a Variable in Trigger Match Line

Post by Vadi »

Another alternative, and a more efficient design, would be to adapt the highlighting example here (which does a similar thing, creates a trigger for a variable thing): http://wiki.mudlet.org/w/Manual:Technic ... _target.3F

Post Reply