Trying to set a timer time using a variable

Posted by Eikou on Fri 24 Jun 2016 01:23 AM — 6 posts, 20,767 views.

#0
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
Australia Forum Administrator #1
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?
USA Global Moderator #2
Nick Gammon said:

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

But what if Eikou's HP is 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999? lol
Amended on Fri 24 Jun 2016 02:44 AM by Fiendish
Australia Forum Administrator #3
He must be using a different server than the ones I am used to, in that case. :P
Australia Forum Administrator #4
What is his HP is:


18739277038847939886754019920358123424308469030992781557966909983211910963157763678726120154469030856807730587971859910379069087693119051085139566217370635083384943613868029545256897117998608156843699465093293765833141309526696357142600866935689483770877815014461194837692223879905132001



*Then* you use bc.
Amended on Fri 24 Jun 2016 03:34 AM by Nick Gammon
#5
Huzzah! It works! Thanks for the lesson. May you all have infinite HP.