| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| Stops duplicate script subroutine https://mail.black-squirrel.com/viewtopic.php?f=15&t=18478 |
Page 1 of 1 |
| Author: | Parrothead [ Tue Jan 23, 2007 3:57 am ] |
| Post subject: | |
content edited. |
|
| Author: | RexxCrow [ Tue Jan 23, 2007 7:12 pm ] |
| Post subject: | |
Just as another option of doing this, here is code similar to what I used to overcome a problem I encountered in the making of the POAN Monitor project... Code: IF $openREPLACEW/SCRIPTNAME>0 HALT END setVar $openREPLACEW/SCRIPTNAME 1 ...BEGIN CODE... |
|
| Author: | Parrothead [ Tue Jan 23, 2007 8:02 pm ] |
| Post subject: | |
content edited |
|
| Author: | Singularity [ Tue Jan 23, 2007 10:34 pm ] |
| Post subject: | |
My only concern would be if you accidently terminate the script you're running from the list, laff. I usually prefer to go to included subroutines instead of full scripts. Then I write scripts from the routines. Like my newer holotorp stuff, holokilla stuff, density torping stuff, is all part of a set of includes instead of a seperate script. |
|
| Author: | Parrothead [ Tue Jan 23, 2007 11:45 pm ] |
| Post subject: | |
Agreed I do 2 background scripts only ..one is a simple fighit tracker that Caretaker wrote that we added FIGSEC too for constant updates and the other is a quickstats script that any other script can call.Has one or 2 other useful functions also.But more the most part includes is the way to go. The snippet only checks for duplicates and terminates them i.e. 2 ck_saveme.cts or whatever. |
|
| Author: | Parrothead [ Sat Feb 03, 2007 7:33 pm ] |
| Post subject: | |
Quote: My only concern would be if you accidently terminate the script you're running from the list, laff. If you look at the subrountine closely you will find that that wont happen. |
|
| Author: | Singularity [ Sat Feb 03, 2007 10:11 pm ] |
| Post subject: | |
I don't see how unless there's some designation for your current script in there that's not readily appearant. |
|
| Author: | Parrothead [ Sat Feb 03, 2007 10:23 pm ] |
| Post subject: | |
if (($a <> $b) and ($scripts[$a] = $scriptsx[$b])) its in the math this is meant to be run as a check apon loading a new scripts. the new script that you load will be the last one therefore $a <> $b prevents self termination. the first copy of any duplicate script will be terminated and the loop will continue checking until there are no duplicates. |
|
| Author: | Singularity [ Sat Feb 03, 2007 11:48 pm ] |
| Post subject: | |
That assumes that the last script you loaded is the one you're using. What if you're dealing with resident triggers and have loaded scripts after that? There's no special designation for the script you're currently using, so it is quite possible to self-terminate. |
|
| Author: | Parrothead [ Sun Feb 04, 2007 1:56 am ] |
| Post subject: | |
Only if you have 2 copies of it running in which case it will terminate the first copy. If I start a gridding script and it stalls then I start it again then the stalled first copy gets a force terminate command which is exactly what I want here. I can think of no instance where I would want 2 copies of the same script running. |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|