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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Convert Zmud to Mush

Convert Zmud to Mush

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


Posted by Penquin   (7 posts)  [Biography] bio
Date Sat 07 Aug 2004 04:30 AM (UTC)
Message
Can anyone help convert this script to MUSH ? thanks!

#TRIGGER {If (%1) cows jumped into Runaway River and (%2) } {#math answer %1-%2;say @answer}
#TRIGGER {If (%1) beavers and (%2) beavers got together with (%3)} {#math answer %1+%2+%3;say @answer}
#TRIGGER {If (%1) eggs were lain each by (%2) } {#math answer %1*%2;say @answer}
#TRIGGER {If (%1) nuts were saved for winter storage and (%2)} {#math answer %1/%2;say @answer}

[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #1 on Sat 07 Aug 2004 05:55 AM (UTC)

Amended on Sat 07 Aug 2004 05:56 AM (UTC) by Flannel

Message
Game > Configure > Scripting Turn On Scripting, set it to VBScript.

Copy between <triggers> and </triggers> then go to the triggers menu (Game > configure > triggers) and click "paste".


<triggers>
  <trigger
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="^If (\d+) cows jumped into Runaway River and (\d+) "
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Send &quot;Say &quot; &amp; (CInt(%1)-CInt(%2))</send>
  </trigger>

  <trigger
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="^If (\d+) beavers and (\d+) beavers got together with (\d+) "
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Send &quot;Say &quot; &amp; (CInt(%1)+CInt(%2)+CInt(%3))</send>
  </trigger>

  <trigger
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="^If (\d+) eggs were lain each by (\d+) "
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Send &quot;Say &quot; &amp; (CInt(%1)*CInt(%2))</send>
  </trigger>

  <trigger
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="^If (\d+) nuts were saved for winter storage and (\d+) "
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Send &quot;Say &quot; &amp; (CInt(%1)/CInt(%2))</send>
  </trigger>

</triggers>

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Penquin   (7 posts)  [Biography] bio
Date Reply #2 on Sat 07 Aug 2004 06:40 AM (UTC)
Message
Thank you very much! i have one more thing to bug ya about, can i add the normal * wildcard to the fronts and ends of these, and if so, where would i put them so the triggers would still run?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #3 on Sat 07 Aug 2004 08:03 AM (UTC)
Message
In other triggers, yes, However these are "regular expressions", so the syntax is a bit different. Append .*$ (period, asterisk, Dollarsign) to the end (or (.*)$ (Same as before but with the parenthesis) if you want to be able to reference what was in them (with the %# type thing).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Penquin   (7 posts)  [Biography] bio
Date Reply #4 on Sat 07 Aug 2004 01:56 PM (UTC)
Message
Maybe i'm a bit slow, but i still cant get them to work. basiclly, i just want Mush to read the math parts, and add them up, or what ever funnction is neded, but it needs to ignore the rest of the sentence, because it will be diffrenet each time, if it were to be the world it would be somthing like this the star above a part of the sentence means i need that part to be wildcarded.
(* *)
Soandso says ,"If (#) beavers and (#) beavers got together
(* *)
with (#) blah blah ."
thanks for the help
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #5 on Sat 07 Aug 2004 07:12 PM (UTC)

Amended on Sat 07 Aug 2004 07:13 PM (UTC) by Flannel

Message
Why dont you post some examples, triggers are fickle things, if you drop one space, or punctuation mark, they wont match.

Also, you can try making the triggers change the color of the text, to see if they are matching at all. (theres a drop down menu on the edit trigger screen.)

Actually, YOUR problem is the Say part. You can solve it two ways. Does the same person say it every time? Or is there a list of people that will? Or Do you want to respond to everyone everytime a question is asked?

You can delete the caret (^) off of the front of each, and it will work fine (even without the wildcards at the end). Or you can add the XXXX says '[rest of the trigger]' to it.

Zmud triggers are fairly crude, They can be easily spoofed since you cant anchor them to anywhere, and for the most part they match on pieces of the lines. Mushclient ones are a smidge trickier to use, if youre not used to them, but theyre a lot more versatile, and a lot harder to fool.

These would the four match texts:
If (\d+) cows jumped into Runaway River and (\d+)
If (\d+) beavers and (\d+) beavers got together with (\d+)
If (\d+) eggs were lain each by (\d+)
If (\d+) nuts were saved for winter storage and (\d+)

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Mon 09 Aug 2004 12:44 AM (UTC)
Message
Here is an example:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="If (\d+) beavers and (\d+) beavers got together"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>total = %1 + %2
Note "total = " &amp; total</send>
  </trigger>
</triggers>


Test output:


If 5 beavers and 8 beavers got together
total = 13


You can just do simple arithmetic in a trigger using "send to script".

- 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.


14,760 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]