talking-to-uhud

How can I get my toy to talk to the LULU uHUD?

The LULU uHUD (Utility HUD) allows third-party toys to talk to it and learn various information about the sub:

  • sub's gender
  • sub's owner list (name, and avie key)
  • sub type (e.g. slave, pet, sex-slave, ponygirl, doll, etc.)
  • is RLV turned on?
  • what is sub's spacial emote preference? (whisper, say, direct message, none)

By default, the uHUD will allow any third-party gear to get the above information from it.

If privacy is desired, this can be turned off: uHUD Menu > plugin… > untick remote

Here's how:

//copy this 'universal' function into your script
// LULU uHUD FUNCTION START ======================================
integer uHUDPublicHandle;
integer uHUDPublicChannel = -1742387;

getUHUD(key avieKey, string param) {
      string get = "get ";
      if (param == "ping") get = "";
      llSay(uHUDPublicChannel,(string) avieKey + get + param);
      llListenRemove(uHUDPublicHandle);
      uHUDPublicHandle = llListen(uHUDPublicChannel,"","","");   //we put this here so we don't have to add this line somewhere else. Simpler to have it all in one drop-in function.
}
// LULU uHUD FUNCTION END ========================================



//this section shows how you can call the getUHUD() function, and how you can listen to the response and do stuff with it...
default {
     touch_start(integer count) {
          key subKey = llDetectedKey(0);

          getUHUD(subKey,"ping"); //pings the uHUD, if present, will reply "pong"
          getUHUD(subKey,"all"); //will get all available parameters.
          getUHUD(subKey,"isMale"); //or you can get specific parameters.
     }

     listen(integer channel, string name, key id, string msg) {

          if (channel == uHUDPublicChannel) {
             //we parse the data, which is in the format: paramName paramVal

             integer pos = llSubStringIndex(msg," ");             
             string paramName = llGetSubString(msg,0,pos - 1);
             string paramVal = llStringTrim(llGetSubString(msg,pos + 1, -1),STRING_TRIM_HEAD);

             //reply to ping
             if (msg == "pong") llWhisper(0,"Hello, you're wearing a LULU uHUD. Now I can know things about you.");

             //list of sub's owners.
             if (paramName == "ownerNameCSV") llWhisper(0,"You are owned by: " + paramVal);

             //list of sub's owners' avie keys.
             if (paramName == "ownerKeyCSV") llWhisper(0,"Your owner keys are: " + paramVal);

             //sub's gender
             if (paramName == "isMale") {
                 string gender = "female";
                 if ((integer) paramVal) gender = "male";
                 llWhisper(0,"You are a sexy " + gender + ".");
             }

             //does sub have RLV on?
             if (paramName == "isRLV") {
                 if ((integer) paramVal) llWhisper(0,"You have RLV turned on.");
             }

             //what type of sub?
             if (paramName == "subType2") llWhisper(0,"You are a " + paramVal + "."); //slave, pet, sex-slave, ponygirl, etc.

             //what is sub's emote preference? (say, whisper, direct sayTo, or none)
             if (paramName == "spacial") {
                  integer spacial = (integer) paramName;
                  if (spacial == 0) ; //do nothing
                  else if (spacial == 1) llRegionSayTo(llGetOwnerKey(id),0,"You prefer direct messages.");
                  else if (spacial == 2) llWhisper(0,"You prefer whisper emotes");
                  else if (spacial == 3) llSay(0,"You prefer 'say' emotes.");
             }             


          }
     }
    
}

https://lu2.me/uHUDRemote

  • talking-to-uhud.txt
  • Last modified: 2024/06/30 04:42
  • by lulu