having trouble using a trigger

Posted by Wx100 on Sat 22 Mar 2008 08:47 PM — 2 posts, 11,972 views.

#0
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>
Australia Forum Administrator #1
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>