[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  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] Refresh page


Posted by Wx100   (1 post)  [Biography] 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>
[Go to top] top

Posted by Nick Gammon   Australia  (23,000 posts)  [Biography] 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
[Go to top] 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,749 views.

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

Go to topic:           Search the forum


[Go to top] 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.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]