Reply to Re: kill_this_task but from external
If you don't have an account, just leave the password field blank.
external() calls a method in another script file, but it won't affect any other script 'instances' that are running using the same script file.
This means, that in your example, script B will end up killing itself.
This is a little bit odd, but it makes sense when you think of other scenarios:
1) What if no instances of the 'A' script are running? Would 'B' fail to call external?
2) What if multiple instances of the 'A' script are running?
3) What if a global running script 'C' is running, that is running a loop in the 'A' script'?
The answer to every question is the same: external doesn't affect other scripts, so external works every time.
You can do what you want, but it is a little tricky. You need to identify the 'script number' of your global running script (probably using a global variable), then you can call methods on the script associated with the 'script number'.
For example:
If you really really need to conserve global variables (and you shouldn't need to; heck I made a roguelikelike in DinkC and only used like 60 variables at any given time), script B could simply loop through all script numbers and try to kill the global script, but you'd want to name the function something unique:
This means, that in your example, script B will end up killing itself.
This is a little bit odd, but it makes sense when you think of other scenarios:
1) What if no instances of the 'A' script are running? Would 'B' fail to call external?
2) What if multiple instances of the 'A' script are running?
3) What if a global running script 'C' is running, that is running a loop in the 'A' script'?
The answer to every question is the same: external doesn't affect other scripts, so external works every time.
You can do what you want, but it is a little tricky. You need to identify the 'script number' of your global running script (probably using a global variable), then you can call methods on the script associated with the 'script number'.
For example:
//Script that starts Script A
void main(void)
{
&globalscript = spawn("A");
}
//Script B
run_script_by_number(&globalscript, "use");Of course, if you're going through the trouble of using a global variable, you could just add a condition to your main loop to exit, and that would be easier than tracking the script number.If you really really need to conserve global variables (and you shouldn't need to; heck I made a roguelikelike in DinkC and only used like 60 variables at any given time), script B could simply loop through all script numbers and try to kill the global script, but you'd want to name the function something unique:
//Script A
void main(void)
{
top:
some stuff
goto top
}
void secret_global_use(void)
{
kill_this_task();
}
//Script B
int &temp = 1;
loop:
run_script_by_number(&temp, "secret_global_use");
&temp += 1;
if (&temp < 300 ) goto loop;






