Page 1 of 1

Timer

Posted: 09 Feb 2013, 14:24
by Gollbert
Hello,

I want to make a variable A to count seconds.
Is there a way to do that?

Thanks in advance

Re: Timer

Posted: 09 Feb 2013, 23:19
by Jmgr
Hi,

There are multiple ways to do that, the easyest would probably be to create the integer variable A with a Variable action, then use a Loop action and a Pause action to use the current value of A each second. A variable action could then be used to decrement (A = A - 1) the A variable.

It depends on what you are going to do with it.

Re: Timer

Posted: 10 Feb 2013, 16:38
by Gollbert
I wan to make this action:

1.VarTimeStart = Time(now)
2.VarA = 60sec
3.VarB = 120sec
4.VarTime = Time(now)
5.if VarTime = VarTimeStart + VarA run procedure A else go to next line
6.IF VarTime = VarTimeStart + VarB run procedure B else go to next line
7.do some action
8.do some action
9.VarTime - Time(now)
10.go to line 5

procedure A
do some action
VarA = VarA + 60sec (To have another 60sec)
end procedure A

procedure B
do some action
VarB = VarB + 120sec (To have another 120sec)


What i am trying to do is :

1.Do som action.
2.If 60sec passed do procedure A
3.If 120sec passed do procedure B
4.Continue from 1

Re: Timer

Posted: 11 Feb 2013, 10:33
by Jmgr
There is no Time Comparison action for now (it is planned), so you will have to use some lines of Javascript code for that.
You could use a Code action for that.

So your action 1. could be a Code action containing

Code: Select all

var start = new Date().getTime();
This gives the current timestamp in milliseconds.

To jump to the procedure you will have to use the label or line number of a procedure call, there is currently no way to call a procedure from code...

Code: Select all

Script.nextLine = 42

Code: Select all

Script.nextLine = "myLabel"