Is there a way to set EOS timer based on a variable/user input

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
cksfantasy
Explorer
Explorer
Posts: 8
Joined: Fri Oct 25, 2013 12:55 pm

Is there a way to set EOS timer based on a variable/user input

Post by cksfantasy »

Hi All,

One other question today, with the Timers, i noticed that there is an Eval switch there, can someone give me one or two examples on how it can be used?

If i for example wanted to ask the user how much time he/she would like to be teased for, I'd like the timer to take that value and start the countdown.

Is this doable at all?

Thanks!
Darigaaz
Explorer
Explorer
Posts: 88
Joined: Wed Oct 07, 2020 11:12 pm
Gender: Male
Sexual Orientation: Straight

Re: Is there a way to set EOS timer based on a variable/user input

Post by Darigaaz »

Prompt: variable = duration_in_s
Eval: duration_in_s = parseInt(duration_in_s)
Timer: eval = 1000 * duration_in_s

The best is to check that the user entered a number and not another string with a if isNan(duration_in_s) after the Eval
cksfantasy
Explorer
Explorer
Posts: 8
Joined: Fri Oct 25, 2013 12:55 pm

Re: Is there a way to set EOS timer based on a variable/user input

Post by cksfantasy »

Darigaaz wrote: Mon Oct 26, 2020 12:37 pm Prompt: variable = duration_in_s
Eval: duration_in_s = parseInt(duration_in_s)
Timer: eval = 1000 * duration_in_s

The best is to check that the user entered a number and not another string with a if isNan(duration_in_s) after the Eval
Legend!! Thank you for that, you've made my day and i can confirm that this works well!
Darigaaz
Explorer
Explorer
Posts: 88
Joined: Wed Oct 07, 2020 11:12 pm
Gender: Male
Sexual Orientation: Straight

Re: Is there a way to set EOS timer based on a variable/user input

Post by Darigaaz »

My pleasure !
Post Reply