Hi,
Could someone please help me on how to calculate with variants and triggers, then display it without having to use any scripts?
For example:
I want MushClient to capture the trigger on 'You have been saved.', count it to a variable named 'test', so whenever that text pops up, 'test' would have the counter.
What I've got so far:
Trigger works, output it to a var named 'test', altho 'test' only contains '+1' regardless of how many times that text pops up.
This is what I've got:
<triggers>
<trigger
enabled="y"
match="^You have been saved."
send_to="9"
sequence="100"
variable="test"
>
<send>+1</send>
</trigger>
</triggers>
It's just a test on what I'll try to expand without programming/scripting knowledge (e.g: level up calculation, etc.)
Thanks Nick!
This is how I would do that. You need to enable scripting and make Lua your scripting language.
For more details about doing that, see:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6030
<triggers>
<trigger
custom_colour="3"
enabled="y"
match="^You have been saved\.$"
regexp="y"
send_to="12"
sequence="100"
variable="test"
>
<send>
SetVariable ("test", (GetVariable ("test") or 0) + 1)
Note ("Saved count is now " .. GetVariable ("test"))
</send>
</trigger>
</triggers>
The "or 0" part allows for the initial case of the variable not existing.
Your trigger looked like a regular expression (with the ^ at the start) but you had not checked the "regular expression" box.
Thanks Nick,
I read about your post on the Lua script and did the following:
I opened immediate window on MushClient and paste your solution, after I've chosen Lua as my script preference. Altho when i ran the script it says:
Error number: 0
Event: Compile error
Description: [string "Immediate"]:1: unexpected symbol near `<'
Called by: Immediate execution
Thanks
Read this post:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4777
Only part of that was the script, the rest was a trigger in the XML format used by MUSHclient.