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 ➜ VBscript ➜ Convert Zmud to Mush

Convert Zmud to Mush

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


Posted by Penquin   (7 posts)  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}

Top

Posted by Flannel   USA  (1,230 posts)  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.
Top

Posted by Penquin   (7 posts)  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?
Top

Posted by Flannel   USA  (1,230 posts)  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.
Top

Posted by Penquin   (7 posts)  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
Top

Posted by Flannel   USA  (1,230 posts)  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.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  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
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.


22,021 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.