Difference between revisions of "LlRequestSimulatorData Test"

From Second Life Wiki
Jump to: navigation, search
 
m (whitespacing)
 
Line 34: Line 34:
 
[llRequestSimulatorDataScript]
 
[llRequestSimulatorDataScript]
  
<pre>
+
<lsl>string gSimName;  
string gSimName;  
+
 
key gStatusQuery;
 
key gStatusQuery;
 
string gStatus;
 
string gStatus;
Line 45: Line 44:
 
     state_entry()  
 
     state_entry()  
 
     {  
 
     {  
    llListen(1, "", "", "");  
+
        llListen(1, "", "", "");  
 
     }  
 
     }  
  
 
     listen(integer channel, string name, key id, string mesg)  
 
     listen(integer channel, string name, key id, string mesg)  
 
     {  
 
     {  
    gSimName = mesg;  
+
        gSimName = mesg;  
    gStatusQuery = llRequestSimulatorData(gSimName, DATA_SIM_STATUS);  
+
        gStatusQuery = llRequestSimulatorData(gSimName, DATA_SIM_STATUS);  
    gRating = llRequestSimulatorData(gSimName, DATA_SIM_RATING);
+
        gRating = llRequestSimulatorData(gSimName, DATA_SIM_RATING);
    SimPos = llRequestSimulatorData(gSimName, DATA_SIM_POS);
+
        SimPos = llRequestSimulatorData(gSimName, DATA_SIM_POS);
 
     }
 
     }
 
      
 
      
Line 68: Line 67:
 
         else  
 
         else  
 
         {
 
         {
        vector SimPos? = (vector) data;  
+
            vector SimPos? = (vector) data;  
        llSay(0, gSimName + " (" + gRating + ") " + "(" +  
+
            llSay(0, gSimName + " (" + gRating + ") " + "(" +  
        (string)((integer) SimPos?.x) + ", " +  
+
                (string)((integer) SimPos?.x) + ", " +  
        (string)((integer) SimPos?.y) + ") is " + gStatus);  
+
                (string)((integer) SimPos?.y) + ") is " + gStatus);  
 
         }
 
         }
 
     }
 
     }
}
+
}</lsl>
</pre>
+
  
 
[[Category:QA Portal]]
 
[[Category:QA Portal]]
 
[[Category:Quality Assurance]]
 
[[Category:Quality Assurance]]

Latest revision as of 21:43, 20 June 2009

[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>