Talk:Changed

From Second Life Wiki
Jump to navigation Jump to search

CHANGED_REGION and CHANGED_TELEPORT not in default state

This caveat went on the change page.

If there is no changed event in the default state, the changed event will not be triggered in other states for CHANGED_REGION or CHANGED_TELEPORT. An empty changed state in default corrects this.

I cannot reproduce it with this script. It works OK with the teleport and a walk over a region line for me, both on LSO and on Mono. <lsl> default {

   state_entry()
   {
       llOwnerSay("default state_entry");
       state other;
   }

}

state other {

   state_entry()
   {
       llOwnerSay("other state_entry");
   }
   changed(integer change)
   {
       if (change & CHANGED_TELEPORT)
       {
           llOwnerSay("got CHANGED_TELEPORT");
       }
       if (change & CHANGED_REGION)
       {
           llOwnerSay("got CHANGED_REGION");
       }
   }
   touch_start(integer num)
   {
       llOwnerSay("reset on touch");
       llResetScript();
   }

} </lsl> Is there a script that can show the trouble? Maybe it is better to put that on the JIRA than on here if it can happen. --Cerise Sorbet 05:55, 21 February 2010 (UTC).

Tested: Made fresh script and using the above had the following returned in chat when teleporting and walking between regions -

Object: default state_entry

Object: other state_entry

Object: got CHANGED_TELEPORT

Object: got CHANGED_REGION

Connecting to in-world Voice Chat...

Connected

Object: got CHANGED_REGION

Connecting to in-world Voice Chat...

Connected

-- Fred Gandt (talk|scripts|contribs) 06:21, 21 February 2010 (UTC)

I had planned to promote it to JIRA and convert it to a bug entry but since there is no repro... no need. -- Strife (talk|contribs) 18:59, 21 February 2010 (UTC)

New caveat seems less helpful than confusing

This new caveat - Always test the value of change, even if your script doesn't seem to need it now. New CHANGED_* triggers are added once in a while, and a script can do surprising things when unexpected events suddenly come in. doesn't make sense to me. CHANGED_* indicates a flag of a partially unspecified nature, not a trigger and I am confused by when unexpected events...come in. What is an unexpected event and how does it come in? I also don't consider the advice (I believe it to be advice after interpretation) to be a caveat. -- Fred Gandt (talk|contribs) 21:43, 22 July 2011 (PDT)

Really now.
An unexpected event is an event that was not expected. un·ex·pect·ed - : not expected : unforeseen That is something that happens when scripts are written with bad assumptions built in, like an assumption that what triggers an event or an event flag will never change or get expanded.
A new CHANGED_* trigger is a new thing that can make a CHANGED_* flag flip. trig·ger - something that acts like a mechanical trigger in initiating a process or reaction. It could be a new flag, or it could be a new condition that triggers an existing flag.
A caveat is cautionary advice.
ca·ve·at -
a : a warning enjoining one from certain acts or practices
b : an explanation to prevent misinterpretation
c : a modifying or cautionary detail to be considered when evaluating, interpreting, or doing something

--Incoherendt Randt 22:28, 22 July 2011 (PDT)