Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 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 &lt; 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  (23,173 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 &lt; 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.


11,428 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.