remove_task
How would you use a remove_task? I find It confusing. Could someone help me out?
|
remove_task
I think that explains it pretty good. It will simply stop a set_task. Code:
Actually remove_task will remove ALL set_tasks unless you give your set_task a special id. |
Quote:
Both parameters default to 0, ie. writing Code:
Code:
This means that if you don't specify an id, remove_task will remove all tasks with id=0 in your plugin. Also note that if you don't pass an id parameter to set_task, the id of the created task will be 0, so remove_task(0); / remove_task(); will remove those (and those with id set to 0 explicitly). |
I consider it to be a good idea to always give a random number as a task id, if you plan on manually ending it at some time.
For instance, in my plugins I do something like this: Code:
#define TASKID_THISACTION 84278346Code:
Code:
Instead of trying to come up with your own pseduo-random number, I suggest using a site like this that will do it for you. |
Alternatively, you could use xs stock library's weird task system - if it still works on today's releases of the Small compiler. (I wrote it more than a year ago [don't expect it to be bug-free =P ] ).
Code:
You get the idea. The definitions of all these functions (and macros) are in xs.inc, if you are interested. Note that it might represent measurable overhead to use these functions, so better don't use it in really heavily used and performacne critical stuff. (I'm tired so sorry for any mistakes) |
Now...what about if task exists?
|
The name explains it.
It checks if a task exists. If its still going, or if its removed, or if it was ever made at all. Code:
|
| All times are GMT -4. The time now is 15:50. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.