Page 1 of 1

Define a variable with a trigger

Posted: Fri Jan 08, 2021 9:49 am
by xephon99
I am very new to Mudllet and come from using Z/Cmud.

I want to make a trigger that defines a variable that a second trigger will then pull from.

trigger 1
string=
Your Judge hit (.*) for

then create or modify a variable called target to the text after Hit and before For

The second trigger is
string=
You maw now use Judge again.

code
send ("judge " ..target)

I do not know the proper code to define / update the variable in the first trigger as I am very confused by the wild cards used mudlet. Can someone help?

Re: Define a variable with a trigger

Posted: Fri Jan 08, 2021 2:29 pm
by Zaphob
Well then welcome! :mrgreen:

You can do it with text commands or by clicking the Mudlet widows. Both are explained more detailed in wiki.

Here is how I would solve your request with clicking:

Make a new trigger and put your given string as pattern #1 then select regex from drop down menu.
In the large bottom text area write this:

target = matches[2]

That's all for this one.

The second is the same, only you can even select exact match from drop down which is much faster still.
The code you gave is correct. Make sure to put it in the bottom and not the line called command.

Hope this gets you started. Let me know how it works. :)

Re: Define a variable with a trigger

Posted: Sat Jan 09, 2021 4:28 am
by xephon99
Thank you that worked great.