MWSE - question about Setx versus Set

Post » Sat May 28, 2011 6:30 am

according to scripting for dummies, its possible to use the commands: Set (something) To (something else) to reference a global (or targeted?) script variable from outside the script running on the object or global script.

Can the command Setx do this? AFAICT it does not. perhaps I have it set up wrong or have a simple syntax error that I don't see. this is the script I'm referencing:
    begin ST_cont_scrp    ; silentthief's container script    ; declares variable (short) for    ; container for use from    ; other script    short ST_cont    end ST_cont_scrp


and this is what I'm trying to do with it:

    Begin ST_test_script    long lookref    short reftype    long checkref    float plrHowFar    If ( MenuMode )       Return    Endif    Setx lookref to xGetPCTarget    if ( lookref == 0 )       set reftype to 0       return ;looking at nothing    endif    Setx checkref to lookref->xRefType    xSetRef, lookref    setx plrHowFar to xDistance, checkref    if ( checkref == 1414418243 )       if ( plrHowFar < 200 )       messagebox "container"       ;ref->xPostion FLOAT_x, FLOAT_y, FLOAT_z, FLOAT_zRot       set reftype to 1       ;return       endif    elseif ( checkref == 1380929348 )       if ( plrHowFar < 200 )       messagebox "door"       ;ref->xPostion FLOAT_x, FLOAT_y, FLOAT_z, FLOAT_zRot       ;set reftype to 2       ;return       endif    else       return ; I don't believe there are any more objects that can be locked/trapped...?    endif    ; should have xsetref already set from before the if block ?    xSetRef lookref    Setx ST_cont_scrp.ST_cont to 1    ;the line above is a reference to the other script (ST_cont_scrp) to modify the variable (ST_cont)    ;and does NOT work. And Set command does not work with object variables    end ST_test_script


this is the testing phase of my trap project. So far, I've determined that MWSE is necessary to finish it, and I can find the reference type to what the player is looking at (container or door in this example) and I've figured out how to test for the disarm action. But I'm trying to make sure the reference to the exact container is absolute (and not just the "first on the list" located in the cell)

ST
ps I think I'll have a working beta for this in within the next week... will let you all know
User avatar
Elisha KIng
 
Posts: 3285
Joined: Sat Aug 18, 2007 12:18 am

Post » Fri May 27, 2011 6:06 pm

I believe that syntax is to avoided in general, I've had some issues with using targeted local variable Set commands. I'm not sure if Setx can handle it at all, but either way, you may be better off using globals. Targeting a variable in a script, using the syntax you are (xSetRef, Setx script.var) also looks like it may be an issue.
User avatar
Poetic Vice
 
Posts: 3440
Joined: Wed Oct 31, 2007 8:19 pm

Post » Sat May 28, 2011 4:52 am

I believe that syntax is to avoided in general, I've had some issues with using targeted local variable Set commands. I'm not sure if Setx can handle it at all, but either way, you may be better off using globals. Targeting a variable in a script, using the syntax you are (xSetRef, Setx script.var) also looks like it may be an issue.


yeah, I thought as much about changing variables in another script with Setx. MWEdit kept arguing with me on that one. I believe that the idea of a global script will be the way I have to go on this.

Anyhow, thanks for the reply.
ST
User avatar
Sara Johanna Scenariste
 
Posts: 3381
Joined: Tue Mar 13, 2007 8:24 pm


Return to III - Morrowind