|
Thorne Kaiser
Nice Guy
Join date: 29 Nov 2005
Posts: 132
|
03-11-2006 17:16
I have a bunch of linked prims. In one on them is a script that will make it change color, size, etc... Well in the main prim, there is a script that reads a notecard...so I wrote a change event so that it would detect any change in the inventory (the notecard)...and it Whispers ...reading notecard. Also in the state entry it whispers "Ready." So now when the child prim changes shape, color or whatever, it triggers the main prim's script and it Whispers: Reading notecard... Ready. There was no change in that prims inventory so why is it whispering anything??? state_entry() { llWhisper(0, "Ready."); llGetNotecardLine("MyNotecard", lineNum); }
changed(integer change) { if (change & CHANGED_INVENTORY); //Check to see if there have been any notecard changes { llWhisper(0, "Reading Notecard..."); llResetScript(); } }
|
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
03-11-2006 17:35
From: Thorne Kaiser There was no change in that prims inventory so why is it whispering anything??? if (change & CHANGED_INVENTORY);
The semicolon (;) at the end of the conditional statement defeats its purpose. Your script is checking if the change is an inventory change, but not executing code *because* of that. Rather, its just going on to the next instruction, which creates a new scope. You can have a headless scope: default { state_entry() { { llSay(0, "eep"); } } }
This produces perfectly valid code. In short, just get rid of the semicolon after the if() statement. ==Chris
|
|
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
|
03-11-2006 17:39
My first guess is that they may have changed the nice, neat binary constatants in the changed() event, so there could be something like CHANGED_FOO = 0x10001.
In this case, the defensive way to program around "not-quite" bit-fields is if ((changed & CHANGED_INVENTORY) == CHANGED_INVENTORY)
Recompiling scripts between version changes has also been known to catch the bytecode up to the latest VM.
Or it could be a bug.
|
|
Thorne Kaiser
Nice Guy
Join date: 29 Nov 2005
Posts: 132
|
03-12-2006 07:00
K, I got rid of the semicolon... I still get the same thing, even after resetting the scriptss. 
|