Dataserver

From InWorldz Wiki
Jump to: navigation, search

Events: dataserver( key query_id, string data)

The dataserver event is designed to read or retrieve asynchronous data from any script within the object. It receives that data in the form of a list, which is then usually converted to standard variable forms.

Example


 key cardKey;
 integer cardLine = 0;
 string cardName="MyNotecard";
  
 default{
 
 state_entry(){// get current card key and line
   cardKey = llGetNotecardLine( cardName, cardLine++ ); //triggers dataserver event, reading the first card line
   }
  
  
   dataserver( key query_id, string data ) {
   if( query_id != cardKey )  // checks to see if proper card being read
          {llOwnerSay( "Problem reading notecard" );
           return;
          }
   if( data == EOF) {llOwnerSay( "Finished reading notecard");}  // checks for end of file
   else {cardKey = llGetNotecardLine( cardName,cardLine++ );}  // reads the next line in the card
   }
   
}