Difference between revisions of "SCRIPTED"
Jump to navigation
Jump to search
(Thoroughly tested to the best of my abilities.) |
|||
Line 57: | Line 57: | ||
++done; | ++done; | ||
} | } | ||
if(done == 1) | else if(done == 1) | ||
{ // Now I'll search for moving physical objects scripted or not and avatars. | { // Now I'll search for moving physical objects scripted or not and avatars. | ||
llSensorRepeat("", "", 3, 20.0, PI, 1.0); | llSensorRepeat("", "", 3, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 2) | else if(done == 2) | ||
{ // Now I'll search for non physical objects (not avatars) scripted or not. | { // Now I'll search for non physical objects (not avatars) scripted or not. | ||
llSensorRepeat("", "", PASSIVE, 20.0, PI, 1.0); | llSensorRepeat("", "", PASSIVE, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 3) | else if(done == 3) | ||
{ // Now I'll search for non physical objects scripted or not and avatars. | { // Now I'll search for non physical objects scripted or not and avatars. | ||
llSensorRepeat("", "", 5, 20.0, PI, 1.0); | llSensorRepeat("", "", 5, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 4) | else if(done == 4) | ||
{ // Now I'll search for stationary non physical and physical objects (not avatars) scripted or not. | { // Now I'll search for stationary non physical and physical objects (not avatars) scripted or not. | ||
llSensorRepeat("", "", 6, 20.0, PI, 1.0); | llSensorRepeat("", "", 6, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 5) | else if(done == 5) | ||
{ // Now I'll search for stationary non physical and physical objects scripted or not and avatars. | { // Now I'll search for stationary non physical and physical objects scripted or not and avatars. | ||
llSensorRepeat("", "", 7, 20.0, PI, 1.0); | llSensorRepeat("", "", 7, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 6) | else if(done == 6) | ||
{ // Now I'll search for moving physical objects with active scripts. | { // Now I'll search for moving physical objects with active scripts. | ||
llSensorRepeat("", "", SCRIPTED, 20.0, PI, 1.0); | llSensorRepeat("", "", SCRIPTED, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 7) | else if(done == 7) | ||
{ // Now I'll search for moving physical objects with active scripts. Erm... again. | { // Now I'll search for moving physical objects with active scripts. Erm... again. | ||
llSensorRepeat("", "", 9, 20.0, PI, 1.0); | llSensorRepeat("", "", 9, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 8) | else if(done == 8) | ||
{ // Now I'll search for stationary, scripted physical objects. | { // Now I'll search for stationary, scripted physical objects. | ||
llSensorRepeat("", "", 10, 20.0, PI, 1.0); | llSensorRepeat("", "", 10, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 9) | else if(done == 9) | ||
{ // And again just in case I missed something....*coughs* | { // And again just in case I missed something....*coughs* | ||
llSensorRepeat("", "", 11, 20.0, PI, 1.0); | llSensorRepeat("", "", 11, 20.0, PI, 1.0); | ||
++done; | ++done; | ||
} | } | ||
if(done == 10) | else if(done == 10) | ||
{ // Even though I did this before I will now finish by searching for any scripted objects. | { // Even though I did this before I will now finish by searching for any scripted objects. | ||
llSensorRepeat("", "", 12, 20.0, PI, 1.0); | llSensorRepeat("", "", 12, 20.0, PI, 1.0); |
Revision as of 16:01, 8 August 2009
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Description
Constant: integer SCRIPTED = 0x8;The integer constant SCRIPTED has the value 0x8
This is used by sensors to find objects that have a script attached to them.
Caveats
Related Articles
Constants
|
Functions
• | llDetectedType | |||
• | llSensor | |||
• | llSensorRepeat |
Examples
<lsl>integer type;
integer done;
default {
state_entry() { done = 0; llVolumeDetect(TRUE); // I am now very sensitive to touch. So much so I feel things before they touch me. } collision_start(integer detected) { type = llDetectedType(0); if(type == AGENT)// = 1 { llSay(0, "This is impossible. Since to make contact either I have to be moving or the avatar does."); } else if(type == ACTIVE)// = 2 { llSay(0, "I have either been struck by a physical moving object or I have struck a stationary physical object. In either case the object was not scripted"); } else if(type == PASSIVE)// = 4 { llSay(0, "If I was moving I have struck a non physical object not containing an active script."); } else if(type == SCRIPTED)// = 8 { llSay(0, "I have struck an object with an active script"); } else if(type == 3)// AGENT & ACTIVE { llSay(0, "I have definately made contact with an avatar. If I was stationary the avatar was moving."); } else if(type == 10)// SCRIPTED & ACTIVE { llSay(0, "I have been struck by a moving phisical object (not an avatar) containing an active script"); } else if(type == 12)// SCRIPTED & PASSIVE { llSay(0, "I struck a stationary non-physical object (not an avatar) containing an active script"); //Seems like a good time to try something a bit less confrontational. llSensorRepeat("", "", AGENT, 20.0, PI, 1.0); // Radar!! I'll search only for avatars untill I find one. } } sensor(integer detected) { if(done == 0) { // Now I'll search for moving physical objects (not avatars) scripted or not. llSensorRepeat("", "", ACTIVE, 20.0, PI, 1.0); ++done; } else if(done == 1) { // Now I'll search for moving physical objects scripted or not and avatars. llSensorRepeat("", "", 3, 20.0, PI, 1.0); ++done; } else if(done == 2) { // Now I'll search for non physical objects (not avatars) scripted or not. llSensorRepeat("", "", PASSIVE, 20.0, PI, 1.0); ++done; } else if(done == 3) { // Now I'll search for non physical objects scripted or not and avatars. llSensorRepeat("", "", 5, 20.0, PI, 1.0); ++done; } else if(done == 4) { // Now I'll search for stationary non physical and physical objects (not avatars) scripted or not. llSensorRepeat("", "", 6, 20.0, PI, 1.0); ++done; } else if(done == 5) { // Now I'll search for stationary non physical and physical objects scripted or not and avatars. llSensorRepeat("", "", 7, 20.0, PI, 1.0); ++done; } else if(done == 6) { // Now I'll search for moving physical objects with active scripts. llSensorRepeat("", "", SCRIPTED, 20.0, PI, 1.0); ++done; } else if(done == 7) { // Now I'll search for moving physical objects with active scripts. Erm... again. llSensorRepeat("", "", 9, 20.0, PI, 1.0); ++done; } else if(done == 8) { // Now I'll search for stationary, scripted physical objects. llSensorRepeat("", "", 10, 20.0, PI, 1.0); ++done; } else if(done == 9) { // And again just in case I missed something....*coughs* llSensorRepeat("", "", 11, 20.0, PI, 1.0); ++done; } else if(done == 10) { // Even though I did this before I will now finish by searching for any scripted objects. llSensorRepeat("", "", 12, 20.0, PI, 1.0); ++done; llSay(0, "Phew!"); } }
}</lsl>