Credit Calculator

Posted by Webkid on Mon 31 May 2004 01:05 AM — 3 posts, 14,555 views.

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


USA #2
Woo, Thanks a bunch Nick :)