Self restarting loop limited by time.
I need to have a loop that restarts itself by its name every 3 seconds.
The loop will be activated and deactivated by a word, so the loop needs to know that its activated i guess.
such as: "Start loop "loop" " in an edit box.
There will be several other loops with other names, so please take that into consideration when helping me solve my problem.
[color:#FF0000]( i have made this work by setting a value to be set to 1 when a loop is needed to be on, and 0 when the loop is needed off, and having the loop turn on every 3 seconds when that value is 1, however having multiple loops means multiple values setting to 1 and 0, which is unacceptable, plus having the program know which value to set to on, i cant even figure out)[/color]
[color:#CC0000]so basically, start a loop 1 time, and have that loop start itself by name every 3 seconds[/color]
edit: or heck, have the loop stay on at all times, (multiple loops = slower app?) and DO an action every 3 seconds.
Re: Self restarting loop limited by time.
If you need multiple named values for your multiple named loops, I recommend the Named Variables object.
Re: Self restarting loop limited by time.
Re: Self restarting loop limited by time.
naming the variables didnt really help much. it worked, but the program still had a LOT of excess fat.
I found an interesting way of doing what i needed to do, I created a listview object to help.
upon the need to activate a loop, say.. the edit box had the text "activate loop "loop"
I added the name of the loop "loop" to line 0, position 0 of the listview.
Then every 3 seconds, i had another loop running as many times as the number of lines in the listview:
[color:#FF0000]Every 3 seconds:
Set global value o to 0
start loop "Main" NLines( "List View" )[/color]
So with just "loop" added to the listview, it would run 1 time.
the loop goes like this:
[color:#FF0000]On loop "Main":
Start loop Text$( "List View", Global Value O, 0)
Add 1 to Global Value 0[/color]
Essentially running each loop named in the listview every 3 seconds, 1 time.
(i could do this with a simple list object, but i have other variables to add while running a specific loop, making the listview the only object cabable of doing what i want)
Confusing, but It finally worked out.