I was just wondering how to recognize a specific objectid while a MWSE script searches through the "items" (activators, doors, perhaps some other categories?) references of a loaded cell (already filtered to look just for doors). I specifically want the script to know when it comes across its first PrisonMarker reference (which is actually type "door"). I currently have:
Begin ik_DivineIntRingScriptshort doOnceshort refcorrectshort workonitemrefshort finished ;apologies for so many variables, it's my first MWSE script so I'd rather be safe than sorryshort staticfinishedlong staticref ;this script is attached to a disabled (invisible) ring in the cell in which I need to find the PrisonMarker and DivineMarker that the ring itself places with PlaceAtMe. The first (non-MWSE) part works great,long itemref ;except the markers show up opaque in-game and can only be disabled (made invisible) through the console. I need this script to find those markers after generating them and disable them on the spot.long temp;global ik_DivineInterventif ( MenuMode == 1 ) returnendifif ( GetDisabled == 0 ) Disableelse if ( ik_DivineIntervent == 1 ) if ( doOnce == 0 ) PlaceAtMe "DivineMarker" 1 1 1 PlaceAtMe "PrisonMarker" 1 1 1 Set doOnce to 1 endif endifendif ;end non-MWSE partif ( doOnce == 0 ) returnelseif ( doOnce == 2 ) SetDelete 1endififx ( finished ) ;this will be set to 1 when MWSE part is completed Set staticref to 0 Set itemref to 0 Set doOnce to 2 returnendififx ( staticfinished ) ;if done searching for the reference of static DivineMarker, start searching for the reference of "door" PrisonMarker ifx ( itemref ) Setx itemref to xNextRef itemref else Setx itemref to xFirstItem endifelse ifx ( staticref ) Setx staticref to xNextRef staticref ;first search for the reference of static DivineMarker else Setx staticref to xFirstStatic endifendifif ( staticfinished == 1 ) ;staticfinished ==1 means we've already searched for the DivineMarker and are now searching for PrisonMarker. Unfortunate syntax limitations with MWSE force me to use at the top of if ( itemref == 0 ) ;no fewer than six of the following blocks :( Set finished to 1 ;this calls the script to start ending return endifendififx ( staticfinished ) Setx temp to itemref->xRefTypeendifif ( staticfinished == 1 ) if ( temp != 1380929348 ) return endifendififx ( staticfinished ) Setx temp to itemref->xRefID ;start here, see below for problemendifif ( staticfinished == 1 ) if ( temp != "PrisonMarker" ) ;this is where the MWEdit compiler hates my guts and won't complie; is this the correct way to check for an objectid string? return else Set refcorrect to 1 endifendifif ( staticfinished == 1 ) if ( refcorrect == 1 ) Set workonitemref to 1 endifendififx ( workonitemref ) xSetRef itemref Disableendifif ( workonitemref == 1 ) Set finished to 1 Set refcorrect to 0 Set workonitemref to 0 returnendifif ( staticref == 0 ) Set staticfinished to 1 returnendifSetx temp to staticref->xRefTypeif ( temp != 1413567571 ) returnendifSetx temp to staticref->xRefIDif ( temp != "DivineMarker" ) returnelse Set refcorrect to 1endififx ( refcorrect ) xSetRef staticref Disableendifif ( refcorrect == 1 ) Set staticfinished to 1 Set refcorrect to 0 returnendifEnd
I just don't know whether or not I'm doing this correctly when setting temp to itemref->xRefID, then checking for the string with just if ( temp == "objectid that I want" ) MWedit certainly thinks I'm doing something wrong, and outputs the error:
LIne 78 (32): Error -1003: Unknown token ')'()) found!
Line 78 is the line where I have ";this is where the MWEdit compiler hates my guts...."
Thanks in advance everyone!