MWSE Scripting - xGetBaseID & xGetName for Activators?

Post » Fri May 04, 2012 7:06 pm

I have a bunch of activators in a cell called iio_act_trap_enliftDR and iio_act_trap_enliftRG. I need to filter of these strings which means I need to use xGetBaseID which works a treat for NPCs but I can't get the string compare to work for activators. See code below:

setx targetref to xFirstItemwhilex ( targetref )  ;Check the type because we want activators	 setx temp to targetref ->xRefType  if ( temp != 1230259009 )   ; it's an activator   set componentOk to 1	 endif  ;Found an activator  ifx (componentOk)	   set componentOk to 0   ;Check type of reference   setx prospectid to targetref->xGetBaseID   setx refname to targetref->xGetName     set temp to 100  ;setting to 1 doesn;t seem to work	  setx temp to xStringCompare prospectid "iio_act_trap_enliftDR"   Messagebox, "prospectid : %.1f  targetref: %.1f  temp : %.1f",prospectid  ,targetref , temp	  if ( temp == 0 )		  ; it's the door    Messagebox, "FOUND DOOR"    set checkDistance to REF_DOOR	  endif   set temp to 100  ;setting to 1 doesn't seem to work   setx temp to xStringCompare prospectid "iio_act_trap_enliftRG"	  if ( temp == 0 )		  ; it's the register    Messagebox, "FOUND REGISTER"    set checkDistance to REF_REGISTER	  endif   ;setx temp to xStringCompare prospectid "iio_act_trap_enliftMK"	  ;if ( temp == 0 )		  ; it's the marker		  ;set constrefmarker to targetref	  ;endif   set temp to 100  ;setting to 1 doesn't seem to work   setx temp to xStringCompare prospectid "Enemy Lift Register"   if ( temp == 0 )		  ; it's the register    Messagebox, "FOUND ENEMY LIFT REGISTER"    set checkDistance to REF_REGISTER	  endif  endif ;componentOk  setx targetref to xNextRef targetref  endwhileMessagebox, "constrefdoor: %.1f -- constrefregister: %.1f ", constrefdoor , constrefregisterendif ;STATE_INITIALIZE
User avatar
Peter P Canning
 
Posts: 3531
Joined: Tue May 22, 2007 2:44 am

Post » Fri May 04, 2012 9:11 am

I just found some info: Fligg mentions on his site that he doesn't believe non-npcs get the same unique identifying suffixes appended like npcs do. I have decided just to use uniquely named instances as it'll save me some time and I only need a few per cell.
User avatar
April D. F
 
Posts: 3346
Joined: Wed Mar 21, 2007 8:41 pm


Return to III - Morrowind