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 ➜ Lua ➜ Trying to set a timer time using a variable

Trying to set a timer time using a variable

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


Posted by Eikou   (2 posts)  Bio
Date Fri 24 Jun 2016 01:23 AM (UTC)
Message
I am trying to create a trigger that adds a timer with a duration that changes based on information in the trigger.
I am not a programmer and haven't been able to find a file anywhere that would explain how do to this.

Trigger: *HP:*/* SP:*/* EP:*/*

Send:
n = bc.sub (%7,%6)
m = bc.div (n,13)
l = bc.mul (m,15)
DoAfterNote (l, 'Endurance Full')

Send to: Script

I am trying to find a way to get 'DoAfterNote' or 'AddTimer' to use this variable 'l'.

Thank you for your time
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 24 Jun 2016 01:54 AM (UTC)
Message
You don't need to use "big numbers" for simple arithmetic.

How about:


n = %7 - %6
m = n / 13
time = m * 15
DoAfterNote (time, 'Endurance Full')


I don't like the variable name "l", it looks too much like 1.

So what was wrong with that? Did the note not appear, or what?

- Nick Gammon

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

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #2 on Fri 24 Jun 2016 02:43 AM (UTC)

Amended on Fri 24 Jun 2016 02:44 AM (UTC) by Fiendish

Message
Nick Gammon said:

You don't need to use "big numbers" for simple arithmetic.

But what if Eikou's HP is 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999? lol

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Fri 24 Jun 2016 03:29 AM (UTC)
Message
He must be using a different server than the ones I am used to, in that case. :P

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Fri 24 Jun 2016 03:33 AM (UTC)

Amended on Fri 24 Jun 2016 03:34 AM (UTC) by Nick Gammon

Message
What is his HP is:


18739277038847939886754019920358123424308469030992781557966909983211910963157763678726120154469030856807730587971859910379069087693119051085139566217370635083384943613868029545256897117998608156843699465093293765833141309526696357142600866935689483770877815014461194837692223879905132001



*Then* you use bc.

- Nick Gammon

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

Posted by Eikou   (2 posts)  Bio
Date Reply #5 on Fri 24 Jun 2016 04:12 AM (UTC)
Message
Huzzah! It works! Thanks for the lesson. May you all have infinite HP.
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.


19,689 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.