How timer is used in Revolution studio
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How timer is used in Revolution studio
hi member
i am working on one logistic application developed in revolution studio.. i want to put some script in timer and want to finish script execution as time is expired
please let me know how i use timer.
like..
timer secript code
script...
end timer script..
when specified time is finish then it stop execution and display message in window "time is over".
i am waiting for kind and Quick reply..
Regard
Irfan
i am working on one logistic application developed in revolution studio.. i want to put some script in timer and want to finish script execution as time is expired
please let me know how i use timer.
like..
timer secript code
script...
end timer script..
when specified time is finish then it stop execution and display message in window "time is over".
i am waiting for kind and Quick reply..
Regard
Irfan
Re: How timer is used in Revolution studio
Hi.
Do you mean you want to wait for a certain amount of time after your script has executed? I ask because it also seems like you want your script to end at a certain time, or after a certain interval, regardless whether or not it has finished.
Are you trying to give the user a certain amount of time to do a task, or are you giving the script a certain amount of time to do a task?
If the latter, then try this in a button:
You could change the "3" or the "50" to some other numbers to see how this works.
Craig Newman
Do you mean you want to wait for a certain amount of time after your script has executed? I ask because it also seems like you want your script to end at a certain time, or after a certain interval, regardless whether or not it has finished.
Are you trying to give the user a certain amount of time to do a task, or are you giving the script a certain amount of time to do a task?
If the latter, then try this in a button:
Code: Select all
on mouseUp
put the ticks into startTime
repeat 100
wait 3
put random(99)
if the ticks - startTime > 50 then
put "time over"
exit repeat
end if
end repeat
end mouseUp
Craig Newman
Re: How timer is used in Revolution studio
hi boss..
i am trying to stop the process after specified time whether it is finished or not....
for example i want to finish the certion script processing after 30 second... how i will do this... when time finish then a window will appear with message the time is finish..
thank u very much for assistance and further cooperation
Regard
Irfan
i am trying to stop the process after specified time whether it is finished or not....
for example i want to finish the certion script processing after 30 second... how i will do this... when time finish then a window will appear with message the time is finish..
thank u very much for assistance and further cooperation
Regard
Irfan
Re: How timer is used in Revolution studio
Hi Irfan,
prison inmates call their jailors "Boss", so you will agree that this form
of address is not very polite in this forum or anywhere else but a prison!
We all have names or nicknames as you can see.
To your problem:
Could you please post (parts) of your script that you want to stop executing?
I'm afraid we can't help you otherwise, since guessing is too time consuming
and inefficient.
Best from germany
Klaus
prison inmates call their jailors "Boss", so you will agree that this form
of address is not very polite in this forum or anywhere else but a prison!

We all have names or nicknames as you can see.
To your problem:
Could you please post (parts) of your script that you want to stop executing?
I'm afraid we can't help you otherwise, since guessing is too time consuming
and inefficient.
Best from germany
Klaus
Re: How timer is used in Revolution studio
hi,,
its my code and i want to execute script started from if condition like (if "truckContractor1need nine truck"= pResult -- evaluates to true) to the end.
the overall code is given below
on mouseup
local pResult, tSocket, tProcess
put "java JRSocket 54322 10000" into tProcess
open process tProcess for neither
read from socket tSocket until return
put it into pResult
put pResult into field "lblfld1" --this put the result in field table
click at the loc of btn "RunSimulation"
// if condition started from here
if "truckContractor1need nine truck"= pResult -- evaluates to true
then
lock moves
--move grc Obj8530 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
move grc Obj8531 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 5 sec
lock moves
move grc Obj8533 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8535 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8537 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8539 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8541 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8543 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8545 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
lock moves
move grc Obj8547 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
end if
if "truckContractor1need eight truck"= pResult -- evaluates to true
then
lock moves
--move grc Obj8530 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
move grc Obj8531 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 5 sec
lock moves
move grc Obj8533 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8535 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8537 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8539 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
lock moves
move grc Obj8541 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8543 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8545 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
end if
if tSocket is among the lines of the openSockets then close socket tSocket
end mouseup
its my code and i want to execute script started from if condition like (if "truckContractor1need nine truck"= pResult -- evaluates to true) to the end.
the overall code is given below
on mouseup
local pResult, tSocket, tProcess
put "java JRSocket 54322 10000" into tProcess
open process tProcess for neither
read from socket tSocket until return
put it into pResult
put pResult into field "lblfld1" --this put the result in field table
click at the loc of btn "RunSimulation"
// if condition started from here
if "truckContractor1need nine truck"= pResult -- evaluates to true
then
lock moves
--move grc Obj8530 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
move grc Obj8531 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 5 sec
lock moves
move grc Obj8533 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8535 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8537 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8539 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8541 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8543 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8545 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
lock moves
move grc Obj8547 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
end if
if "truckContractor1need eight truck"= pResult -- evaluates to true
then
lock moves
--move grc Obj8530 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
move grc Obj8531 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 5 sec
lock moves
move grc Obj8533 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8535 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8537 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8539 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
lock moves
move grc Obj8541 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8543 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8545 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
end if
if tSocket is among the lines of the openSockets then close socket tSocket
end mouseup
Re: How timer is used in Revolution studio
Hi irfan,
OK, I still don't get what exactly you want to stop executing after a certain amount of time
but here some hints that will make your life easier.
If you only want to move 1 object, you do not need to "lock/unlock moves".
Use parenthesis, not only to make reading the scripts easier but also to prevent the engine from unwanted/unexspected actions.
Put quotes around the names of objects.
If you move objects in 0 seconds then you can simply set their "new" loc.
And please use the "Code" button above to make your scripts more readable after you pasted it here from Rev.
Here is your slightly "cleaned up" script including MY GUESS of what you might want to do (presumed 10 seconds here):
Best
Klaus
OK, I still don't get what exactly you want to stop executing after a certain amount of time
but here some hints that will make your life easier.
If you only want to move 1 object, you do not need to "lock/unlock moves".
Use parenthesis, not only to make reading the scripts easier but also to prevent the engine from unwanted/unexspected actions.
Put quotes around the names of objects.
If you move objects in 0 seconds then you can simply set their "new" loc.
And please use the "Code" button above to make your scripts more readable after you pasted it here from Rev.
Here is your slightly "cleaned up" script including MY GUESS of what you might want to do (presumed 10 seconds here):
Code: Select all
on mouseup
local pResult, tSocket, tProcess
put "java JRSocket 54322 10000" into tProcess
open process tProcess for neither
read from socket tSocket until return
put it into pResult
put pResult into field "lblfld1" --this put the result in field table
click at the loc of btn "RunSimulation"
## My guess:
put the seconds into tStarttime
// if condition started from here
if "truckContractor1need nine truck"= pResult then
set the loc of grc "Obj8531" to the loc of grc (item 1 of line 1 of field "ObjectsLoc")
## Now check EVERY time after you set the loc of objects if the maximum time has passed
if the seconds - tStarttime > 10 then
answer "Time has passed"
exit mouseup
end if
## Is this what you want to happen?
wait 5 sec
set the loc of grc "Obj8533" to the loc of grc (item 1 of line 1 of field "ObjectsLoc")
if the seconds - tStarttime > 10 then
answer "Time has passed"
exit mouseup
end if
wait 10 sec
### etc...
end if
if "truckContractor1need eight truck"= pResult then
set the loc of grc "Obj8531" to the loc of grc (item 1 of line 1 of field "ObjectsLoc")
if the seconds - tStarttime > 10 then
answer "Time has passed"
exit mouseup
end if
wait 5 sec
### etc...
end if
if tSocket is among the lines of the openSockets then
close socket tSocket
end if
end mouseup
Klaus
Re: How timer is used in Revolution studio
hi klaus
i use the same strategy that you told me but ,, after specified time code is not stopping, no any wind is appear with message "time passed".
wainting for kind assistance
Regard
irfan
i use the same strategy that you told me but ,, after specified time code is not stopping, no any wind is appear with message "time passed".
wainting for kind assistance
Regard
irfan
Re: How timer is used in Revolution studio
Please post your script.
Re: How timer is used in Revolution studio
hi klaus..
i want to clearfy what i want is that .. i am using number of if statements and inside each statement we have number of object to move. my target is firstly that when i set the timer inside each if statement like this..
if statement
timer is initilized here ...
all moveing object script
....
.... and so on.
after moving objects scripts end.
timer conditon should be check the specified time is finished or not.if finshed it sops object moving.
i think now u understant my question..
thanks for kind assistance
Regard
irfan
i want to clearfy what i want is that .. i am using number of if statements and inside each statement we have number of object to move. my target is firstly that when i set the timer inside each if statement like this..
if statement
timer is initilized here ...
all moveing object script
....
.... and so on.
after moving objects scripts end.
timer conditon should be check the specified time is finished or not.if finshed it sops object moving.
i think now u understant my question..
thanks for kind assistance
Regard
irfan
Re: How timer is used in Revolution studio
I see a little error in your initial script!
This:
if "truckContractor1need nine truck"= pResult
Should of course be:
if pResult = "truckContractor1need nine truck"
!!
otherwise this condition is never true!
Best
Klaus
This:
if "truckContractor1need nine truck"= pResult
Should of course be:
if pResult = "truckContractor1need nine truck"
!!
otherwise this condition is never true!
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Re: How timer is used in Revolution studio
The variable 'tSocket' is never initialized, so the rest of the code won't happen, as it's waiting to read the 'return' from a non-existent socket.
Where do you open the socket? Who is initiating the conversation? Is the Java process the 'server' side in the communication, or the LiveCode process?
Jan Schenkel.
Where do you open the socket? Who is initiating the conversation? Is the Java process the 'server' side in the communication, or the LiveCode process?
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Re: How timer is used in Revolution studio
hi klaus
the error you told me is not because without timer it is working with my posted code.. when instruction is given from the java side it start working ... i need to set timer inside..
as your code is given below
if the seconds - tStarttime > 10 then
answer "Time has passed"
exit mouseup
end if
i place this code in different position but it is not working ..
may be this code is not complete or second require some initialization. as it should work when mouse-up event is trigger.
see this code and plz let me know
regard
irfan
the error you told me is not because without timer it is working with my posted code.. when instruction is given from the java side it start working ... i need to set timer inside..
as your code is given below
if the seconds - tStarttime > 10 then
answer "Time has passed"
exit mouseup
end if
i place this code in different position but it is not working ..
may be this code is not complete or second require some initialization. as it should work when mouse-up event is trigger.
see this code and plz let me know
regard
irfan
Re: How timer is used in Revolution studio
hi dunbarx
the code you sent to me keep stoping the execution of script for a while but i want that when the script start the timer also start and after the specified time the timer stop the execution of that particular script on which it is operated.
i hope you will assist me .. waiting for your kind reply
Regard
Irfan
the code you sent to me keep stoping the execution of script for a while but i want that when the script start the timer also start and after the specified time the timer stop the execution of that particular script on which it is operated.
i hope you will assist me .. waiting for your kind reply
Regard
Irfan
Re: How timer is used in Revolution studio
Irfan, please post your script, wen can only guess otherwise!
Re: How timer is used in Revolution studio
hi kluas
it my code.. i am first trying to only trigger the timer and then i will put the timer inside the if statemnt.
code...
read from socket tSocket until return
put it into pResult
put pResult into field "lblfld1" --this put the result in field table
click at the loc of btn "RunSimulation"
put the seconds into tStarttime
if the seconds - tStarttime > 10 then
answer "Time has passed"
exit mouseup
end if
if "truckContractor1need nine truck"= pResult -- evaluates to true
then
lock moves
--move grc Obj8530 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
move grc Obj8531 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 5 sec
lock moves
move grc Obj8533 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8535 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8537 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8539 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8541 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8543 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8545 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
lock moves
move grc Obj8547 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
end if
if "truckContractor1need eight truck"= pResult -- evaluates to true
then
lock moves
--move grc Obj8530 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
move grc Obj8531 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 5 sec
lock moves
move grc Obj8533 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8535 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8537 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8539 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
lock moves
move grc Obj8541 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8543 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8545 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
end if
end if
if tSocket is among the lines of the openSockets then close socket tSocket
end mouseup
it my code.. i am first trying to only trigger the timer and then i will put the timer inside the if statemnt.
code...
read from socket tSocket until return
put it into pResult
put pResult into field "lblfld1" --this put the result in field table
click at the loc of btn "RunSimulation"
put the seconds into tStarttime
if the seconds - tStarttime > 10 then
answer "Time has passed"
exit mouseup
end if
if "truckContractor1need nine truck"= pResult -- evaluates to true
then
lock moves
--move grc Obj8530 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
move grc Obj8531 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 5 sec
lock moves
move grc Obj8533 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8535 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8537 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8539 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8541 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8543 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8545 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
lock moves
move grc Obj8547 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
end if
if "truckContractor1need eight truck"= pResult -- evaluates to true
then
lock moves
--move grc Obj8530 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
move grc Obj8531 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 5 sec
lock moves
move grc Obj8533 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 10 sec
lock moves
move grc Obj8535 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8537 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8539 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
lock moves
move grc Obj8541 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 15 sec
lock moves
move grc Obj8543 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
wait 20 sec
lock moves
move grc Obj8545 to the loc of grc item 1 of line 1 of field "ObjectsLoc" in 0 sec without waiting
unlock moves
end if
end if
if tSocket is among the lines of the openSockets then close socket tSocket
end mouseup