Mudlet, creating triggers, variables etc. with other triggers

by Unknown

Back to Mechanic's Corner.

Unknown2010-09-06 10:09:21
So one thing I used to do in zmud is there would be a line from the mud, like "vial123," and then my variable "vial" would be created and set itself to the value "123" after this line was received. Is there any way to do this with mudlet? smile.gif Making triggers, tables, variables via a script?
Vadi2010-09-06 14:28:13
Well yes, for example:

pattern type: perl regex:
pattern: vial(\\d+)
script:
vial = matches)
Unknown2010-09-06 20:55:34
QUOTE (Vadi @ Sep 6 2010, 02:28 PM) <{POST_SNAPBACK}>
Well yes, for example:

pattern type: perl regex:
pattern: vial(\\d+)
script:
vial = matches)

<3

Also, Vadi, get this... if I set up my iPad to work as a second monitor, I can use mudlet on it! biggrin.gif I may even be able to find a way to do it over the internet at a distance, since it updates through the net...
Unknown2010-09-06 21:09:54
However, this didn't actually answer my question sad.gif I know how to do that much actually... what I was hoping to get was, how can it create a variable on its own, where the name of the variable itself is taken from the mud output? Or alternatively, how can I make it set a value to a variable based on mud output, and it won't erase that value upon closing?
Vadi2010-09-07 00:41:21
For solution one - best practice is to store it in a table. Ie,

tbl = {}
tbl] = matches

Will create a new key in the tbl table whos name is the value of matches which stores the value of matches. Maybe http://lua-users.org/wiki/TablesTutorial will assist in understanding this as well.

As for saving/loading tables, you can use table.save and table.load functions - I believe some name highlighter scripts make use of that