Gammon Forum
Entire forum
MUSHclient
Tips and tricks
having trouble using a trigger
having trouble using a trigger
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Wx100
(1 post) bio
|
Date
| Sat 22 Mar 2008 08:47 PM (UTC) |
Message
| This is a trigger I found in another post on this forum. After I imported it using the clipboard, mushclient gives me an error saying:
Compile error
World: aardwolf
Immediate execution
[string "Trigger: "]:4: unexpected symbol near ','
Am I doing something wrong? Any ideas??
<triggers>
<!--
zMUD trigger:
#TRIGGER {(%d)/%dhp}
{#IF (%1 < 1000) {cast 'heal';#T- autohealspell}}
{autohealspell}
-->
<trigger
enabled="y"
group="autohealspell"
match="(\d+)/(\d+)hp"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if %1 < 1000 then
Send "cast 'heal'"
EnableTriggerGroup "autohealspell", vbFalse
end if
</send>
</trigger>
<!--
zMUD trigger:
#TRIGGER {A warm feeling fills your body.} {#T+ autohealspell}
-->
<trigger
enabled="y"
keep_evaluating="y"
match="A warm feeling fills your body\."
regexp="y"
send_to="12"
sequence="100"
>
<send>
EnableTriggerGroup "autohealspell", vbTrue
</send>
</trigger>
</triggers> | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #1 on Sat 22 Mar 2008 09:40 PM (UTC) Amended on Sat 22 Mar 2008 09:44 PM (UTC) by Nick Gammon
|
Message
| Those triggers were designed for VBscript, as you can see from the reference to vbTrue (Visual Basic "true").
The default scripting language these days is Lua, which I encourage you to use.
Some minor changes will allow the script to run under Lua:
- Put function call arguments in brackets
- Change vbTrue to true and vbFalse to false
- An "if" statement is terminated by "end" not "end if"
For example, this (in VBscript):
if %1 < 1000 then
Send "cast 'heal'"
EnableTriggerGroup "autohealspell", vbFalse
end if
becomes this (in Lua):
if %1 < 1000 then
Send ("cast 'heal'")
EnableTriggerGroup ("autohealspell", false)
end
Below are the two amended triggers, they seemed to work OK for me:
<triggers>
<!--
zMUD trigger:
#TRIGGER {(%d)/%dhp}
{#IF (%1 < 1000) {cast 'heal';#T- autohealspell}}
{autohealspell}
-->
<trigger
enabled="y"
group="autohealspell"
match="(\d+)/(\d+)hp"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if %1 < 1000 then
Send ("cast 'heal'")
EnableTriggerGroup ("autohealspell", false)
end
</send>
</trigger>
<!--
zMUD trigger:
#TRIGGER {A warm feeling fills your body.} {#T+ autohealspell}
-->
<trigger
enabled="y"
keep_evaluating="y"
match="A warm feeling fills your body\."
regexp="y"
send_to="12"
sequence="100"
>
<send>
EnableTriggerGroup ("autohealspell", true)
</send>
</trigger>
</triggers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
8,686 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.