Can't get a set_task to repeat/loop
I'm having some problems getting a specific function to be called repeatedly. I've tried using the repear values and flags of set_task but AMX just gives me errors.
Basically what I want to do is this. - set_task calls function A after 2 seconds. - function A executes code every 0.5 seconds until 10 seconds have passed. - function A then executes different code. I tried making function A just contan two set_tasks, one at 0.5 to function B, and another at 10.0 for function C. Function B executed once then stopped and then function C executed after 10 seconds. I think the fact it only executed once was because I used the same ID :? Anyway, in short thats what I want to do, have one set of code execute every 0.5 seconds and then after 10 seconds from the time it was called, run another branch of code. Anyone got any good suggestions? |
yeah let me see the code ur trying to repeat :?
|
Its a bit of a shambles at the moment so I'll do it as psuedo-code:
Code:
I need a friendly way to repeatedly execute this_second as stated above. |
Use a global variable that goes up by 1 every time this_second executes. When it hits 20, execute this_third.
|
Quote:
Code:
|
Now let's see, this should work.
Code:
Code:
This gave the following output: Quote:
|
Thanks for the input guys. I actually went along the lines of Da Bishop's post and as accurate timing isn't über important its good enough! :)
|
well maybe i should add alittle to mine just to be sure there isn't much mistake on it :D
Code:
new x |
Hey. The whole ID thing gets me though. I need to refine that a bit so I don't get collisions.
Just one thing though. If I set a task with one id and then start another with the same id, does the second cancel out the first? |
im not following u...
|
| All times are GMT -4. The time now is 17:18. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.