Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *
- * Scripts and prims are property of GwyUnder, or Gwyneth
- *
- * Utility collar Script v1.0
- */
- // NOTES
- // use llLinkMessage instead of llListen to reduce overhead!
- //
- //
- //
- //
- //
- //////////////////////////////////////////////////////////////////////////////////////
- //defing common data sets
- key ownerUUID;
- key ownerDisplayName;
- key ownerLName;
- list cmd;
- //define channel names
- integer broadcastComms = 0;
- integer cmdComms = 7;
- integer debugComms;
- //Comms handlers
- integer broadcastHand;
- integer cmdHand;
- integer debugHand;
- //DEBUG state
- //integer DEBUG = TRUE;
- //setup the uuid2Channel funtion
- integer uiKey2Range(key vkID, integer viBase, integer viRange)
- {
- // # Result will be added or subtracted dependent on viBase being positive or negative, for intuitive results.
- // > Example: -56000/1000 will result in -56000 to -56999, whereas 56000/1000 will result in 56000 to 56999
- integer viMult = 1;
- if( viBase < 0 ) { viMult = -1; }
- return (viBase+(viMult*(((integer)("0x"+(string)vkID)&0x7FFFFFFF)%viRange)));
- }
- default
- {
- //set things up when owner equips the item
- changed(integer change)
- {
- if (change & CHANGED_OWNER)
- {
- llResetScript();
- }
- }
- on_rez(integer start_param)
- {
- llResetScript();
- }
- state_entry()
- {
- ownerUUID = (string)llGetOwner();
- ownerDisplayName = (string)llGetDisplayName(ownerUUID);
- ownerLName = (string)llKey2Name(ownerUUID);
- debugComms = uiKey2Range(ownerUUID, -740000, 10000);
- broadcastHand = llListen(broadcastComms, "", ownerUUID, "");
- cmdHand = llListen(cmdComms, "", ownerUUID, "");
- debugHand = llListen(debugComms, "", ownerUUID, "");
- llOwnerSay("GwynTools :: Initializing...");
- }
- //enter the listen state
- listen(integer channel, string name, key ownerUUID, string message)
- {
- llOwnerSay("LISTEN : initicialized!");
- name = llToLower(llGetObjectName());
- llOwnerSay("LISTEN : name!");
- llOwnerSay("LISTEN : Message = " + (string)channel + (string)name + (string)message);
- //parse the relevant command and strip bad chars and spaces
- if( llSubStringIndex(llToLower(message),name) != 0) return;
- message = llStringTrim(llGetSubString(message,llStringLength(name),-1),STRING_TRIM);
- //string trim_msg = llStringTrim(message)
- llOwnerSay("LISTEN : trim!");
- list params = llParseString2List(message,[" "],[]);
- string command = llToLower(llList2String(params,0));
- string param = llDumpList2String(llDeleteSubList(params,0,0)," ");
- llOwnerSay("LISTEN : parse!");
- /*
- if ( command == "channel")
- {
- cmdComms = (integer)llList2String( cmd, 2);
- llListenRemove( cmdHand );
- cmdHand = llListen(cmdComms, "" , ownerUUID, "");
- llOwnerSay( "Listen Channel set to " + (string)cmdComms);
- }
- else
- */
- if(channel == cmdComms)
- {
- //llListenRemove(cmdHand);
- llOwnerSay("LISTEN : channel cmdComms!");
- if(command == "avatar" && message == "AVATAR")
- {
- llOwnerSay("Hello, Avatar!");
- }
- else if(command == "test")
- {
- llOwnerSay("This is a test!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement