LlRequestSimulatorData Test

From Second Life Wiki
Jump to navigation Jump to search

[LLRequestSimulatorDataTest]

[VERSION] 0.3

[LENGTH] 00:10

[TESTERS] 1

[OVERVIEW] This test has been designed to exercise the llRequestSimulatorData LSL function.

[SETUP] This test requires 1 Tester and rezzable land

[*]

[0010] Create a new script containing the following:

[SCRIPT] llRequestSimulatorDataScript

[0020] Create a box on the ground, Named SimDataTest

[0030] Place the Script in the Box

[0040] Type /1 and then a sim name, Example: "/1 Ahern" minus the quotations, This will have you say on channel 1 "Ahern" so that the object with this script hears it and responds.

[0050] Verify the script responds with correct information. Example: "SimDataTest: Ahern (PG) (255232, 256512) is up" and "SimDataTest: Gibson (MATURE) (254976, 256000) is up"

[0060] Remember to clear up after your tests.

[END]


[llRequestSimulatorDataScript]

<lsl>string gSimName; key gStatusQuery; string gStatus; string gRating; key SimPos;

default {

   state_entry() 
   { 
       llListen(1, "", "", ""); 
   } 
   listen(integer channel, string name, key id, string mesg) 
   { 
       gSimName = mesg; 
       gStatusQuery = llRequestSimulatorData(gSimName, DATA_SIM_STATUS); 
       gRating = llRequestSimulatorData(gSimName, DATA_SIM_RATING);
       SimPos = llRequestSimulatorData(gSimName, DATA_SIM_POS);
   }
   
   dataserver(key queryId, string data) 
   {
       if (queryId == gStatusQuery)
       {
           gStatus = data;
       }
       else if (queryId == gRating)
       {
           gRating = data;
       }    
       else 
       {
           vector SimPos? = (vector) data; 
           llSay(0, gSimName + " (" + gRating + ") " + "(" + 
               (string)((integer) SimPos?.x) + ", " + 
               (string)((integer) SimPos?.y) + ") is " + gStatus); 
       }
   }

}</lsl>