Define a variable with a trigger

Post Reply
xephon99
Posts: 3
Joined: Thu Jul 09, 2020 4:58 am

Define a variable with a trigger

Post 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?

User avatar
Zaphob
Posts: 180
Joined: Wed May 09, 2012 8:07 am
Location: mg.mud.de

Re: Define a variable with a trigger

Post 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. :)

xephon99
Posts: 3
Joined: Thu Jul 09, 2020 4:58 am

Re: Define a variable with a trigger

Post by xephon99 »

Thank you that worked great.

Post Reply