Detecting copies of script

Post » Sun Sep 16, 2012 8:26 pm

I need to detect if there is more than 1 copy of local script is running. I tried this but it doesnt work
    short var    set global_var to ( global_var + global_var )    set var to ( var + var )    if ( global_var != var )   	 messagebox "WE ARE MANY"	 endif
User avatar
Laura Hicks
 
Posts: 3395
Joined: Wed Jun 06, 2007 9:21 am

Post » Sun Sep 16, 2012 7:38 pm

I had a case where I needed to check for (and disable) multiple instances of an NPC. That may be very close to what you require. I do not have that script handy at the moment, but something like this may work for you. Of course, since it is a local script the player will have to enter the cell of more than one such script before it will detect others.

short localVarshort messageOnceif ( var == 0 )   set localVar to 1   set globalVar to 1endifif ( messageOnce == 0 )   if ( globalVar > 1 )	  set messageOnce to 1	  messagebox "We are legion."   endifendif
User avatar
Alberto Aguilera
 
Posts: 3472
Joined: Wed Aug 29, 2007 12:42 am


Return to III - Morrowind