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 ➜ Credit Calculator

Credit Calculator

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


Posted by Webkid   USA  (22 posts)  Bio
Date Mon 31 May 2004 01:05 AM (UTC)
Message
Hi all, was hoping you could help me...again... ;P

I would like to have a counter so to speak for one of my triggers and I'm not sure how to do this exactly. The trigger text is this: You find * coins from the ground! * can be any three digit number. What I want to be able to do is have each of thoses numbers add to each other. So once I will scour and find 23 credits, then later I will find 44 credits, then later I will find 178 credits, etc So it would add 23, then 44 to that, making 67, then add 178 to it, making it 245, and so on. Then send that new number with a message to the output. Id also like a way to 'reset' the counter also. Thanks, and I really appreciate any and all help.

-Webkid
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 31 May 2004 03:06 AM (UTC)
Message
This trigger will count them:


<triggers>
  <trigger
   enabled="y"
   match="^You find (?P&lt;coins&gt;\d{1,3}) coins from the ground\!$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable "coins", CInt (GetVariable ("coins")) + %&lt;coins&gt;
ColourNote "white", "blue", "You now have " &amp; GetVariable ("coins") &amp; " coins."</send>
  </trigger>
</triggers>



This alias will reset them:


<aliases>
  <alias
   match="resetcoins"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable "coins", "0"
ColourNote "white", "blue", "Number of coins reset to zero."</send>
  </alias>
</aliases>



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Webkid   USA  (22 posts)  Bio
Date Reply #2 on Mon 31 May 2004 03:14 AM (UTC)
Message
Woo, Thanks a bunch Nick :)

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


13,912 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.