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 ➜ Trying to do some Math

Trying to do some Math

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


Posted by Trinity   (6 posts)  Bio
Date Fri 03 Mar 2006 06:42 PM (UTC)
Message
I will straight from the beginning. I have no idea what I'm doing. I have part of a script written for an alias but I can't get the alias to work and I'm not sure how I'm suppose to add it to MUSH.

This is what I have so far.

sub nap (thename, theoutput, thewildcards)
world.SetVariable "napb", %2 - %1
world.SetVariable "napc", CInt (GetVariable ("napb")) / 6
world.SetVariable "naptime", CInt (GetVariable ("napc")) * 20
world.note "Wait" & world.getvariable ("naptime") & "seconds"
world.doafter world.getvariable("naptime")
world.note "Wake time"
end sub

Pretty much, I want an alias that I can hit just before I hit a command in the game that is used to speed up healing. So I can hit the alias "nap" plus two numbers. The first being how much hp I have now and the second being how much my max hp is. So I would type "nap * *" Where "*" is two different numbers. Any and all help would be most appreciated.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 04 Mar 2006 01:42 AM (UTC)
Message
Your script seems to be doing more than what you described. It also seems more complex than is required. You can do the whole thing in "send to script", like this:


<aliases>
  <alias
   match="nap * *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
Note "HP to go: " &amp; %2 - %1
</send>
  </alias>
</aliases>


See this posting for how to directly paste the above into MUSHclient:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4777


- Nick Gammon

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

Posted by Trinity   (6 posts)  Bio
Date Reply #2 on Sat 04 Mar 2006 03:49 AM (UTC)
Message
The reason it looks so complex is that in order to know how long I need to rest in the game, I have to find out the amount of hp I need to heal, divide that number but how much I heal in a tick (which is 6) and then times it by 20 seconds (20 seconds = 1 tick). I was trying to make a note pop up after the amount of seconds I need to wait so I can just hit enter after that to "wake up".
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 04 Mar 2006 09:31 PM (UTC)
Message
Sure, you just have to do the maths. Your original use of DoAfter isn't quite right, read the help file for examples. Say you want to note after 10 seconds then just do this:


DoAfterNote 10, "Wake time"


In your case you do a bit of arithmetic to replace the number 10 with your calculation.

- Nick Gammon

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

Posted by Trinity   (6 posts)  Bio
Date Reply #4 on Mon 06 Mar 2006 07:58 PM (UTC)
Message
Thanks for your help! I was able to get it to work exactly like I wanted to from there! Thanks a ton!
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.


18,534 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.