Jump to content

need scripting help


dianestwin
 Share

You are about to reply to a thread that has been inactive for 2836 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have a song request box on my tipjar that allows me to look at nearby chat for requests once I hit the box... how do I get it to send the requests to my drop and attach hud ? My requests get lost in all of the other chat going on at the sims.

Thank you in advance,. I am not a scripter so any help would be appreciated.

Link to comment
Share on other sites


dianestwin wrote:

I was just hoping there was a way to allow me to see the request via a hud

There is. Any function that allows communication through chat (llSay, llRegionSayTo, etc) can enable conversation between scripted objects (rezzed objects and/or attachments/HUDs). This is definitely possible, but not necessarily feasible with the scripts you're using right now. If both of these objects aren't either clearly described (in terms of what they can send and receive) or fully modifiable then this won't be possible with your existing items. It's also not possible for us to help you with scripts that we can't see, and are unfamiliar with.

Sorry if my earlier reply was terse, I was in a rush but wanted to make sure you got a speedy reply and could decide for yourself where to go from here. :) I'll try to detail my thoughts more clearly.

This forum (LSL Scripting) is typically for those who'd like to learn to script, or are having trouble writing scripts of their own. Given that this doesn't appear to fit your case, I recommended use of the Wanted forum - a place that non-scripters can ask for people to write or edit scripts for them (probably at a cost).

If you do want to learn how to script this solution yourself, then the LSL Scripting forum is the right place to be, but we'll need more to go on. You could help us by establishing:-

  • How these objects listen and talk to other objects at present (ideally, with examples)
  • How you'd like to have the scripts understand these requests from what's being posted in local chat (with examples)

Good luck. :)

Link to comment
Share on other sites

Thank you again for your reply... I am trying to learn scripting but I'm a noob :)

This is the script I have in my tipjar request button: 


integer DEDICATION_CHANNEL = 98;
 
list requests = [];
 
default
{
 
    touch_start(integer total_number)
    {
        if(llDetectedKey(0) != llGetOwner())
            jump user;
        if(llGetListLength(requests) == 0) {
            llOwnerSay("No dedications are currently lined up.");
            return;
        }
        llOwnerSay("----------------- BEGIN REQUESTS ------------------");
        integer itra;
        for(itra=0; itra<llGetListLength(requests); itra+=3) {
            llOwnerSay(llList2String(requests, itra) + " requested the song: " + llList2String(requests, itra+1));
            llOwnerSay("With the dedication: " + llList2String(requests, itra+2));
            if(itra+3<llGetListLength(requests)-1)
                llOwnerSay("-------------------------------------------------------");
        }
        llOwnerSay("------------------ END REQUESTS -------------------");
        return;
@user;
        integer comHandle = llListen(DEDICATION_CHANNEL, "", llDetectedKey(0), "");
        llInstantMessage(llDetectedKey(0), "To request a song \"Song Title - Aritist\" with the dedication \"For (NAME)!\", you would type into the main chat:\n\n/" + (string)DEDICATION_CHANNEL + " Song Title - Artist Name%For (Name)\n\nThe forward-slash and the number after the slash are important.");
    }
 
    listen( integer channel, string name, key id, string message )
    {
        if(channel != DEDICATION_CHANNEL) return;
 
        requests +=  (list)name + llList2List(llParseString2List(message, ["%"], [""]), 0, 0) + llList2List(llParseString2List(message, ["%"], [""]), 1, 1);
        llInstantMessage(id, "Thank you! Your dedication has been stored and will be forwarded to the artist.");
    }
}

 

Script that is in the Hud:

 
   default
   {
       state_entry()
       {
           llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
      }
  
      run_time_permissions( integer vBitPermissions )
      {
          if(PERMISSION_ATTACH & vBitPermissions)
          {
              llAttachToAvatar( ATTACH_HUD_BOTTOM );
          }
          else
          {
              llOwnerSay( "You must attach this as a HUD" );
          }
      }
  
      on_rez(integer rez)
      {
          if(!llGetAttached())
          { //reset the script if it's not attached.
              llResetScript();
          }
      }
  
   
  }// END //

 

Link to comment
Share on other sites

Current Behaviour

      Tipjar

It looks like what happens, is that requests are sent to the jar, by manual entry, on chat channel 98 (DEDICATION_CHANNEL). When you touch (TOUCH_START) the jar, it will dump the list of requests to you privately, via llOwnerSay.

      HUD

Doesn't do anything at all at present other than complain if you attach it wrongly.

Method to Change

  1. Probably remove the TOUCH_START behaviour for the TIPJAR (you don't need to touch the jar anymore if the HUD will control this)
  2. Use the LISTEN event in the TIPJAR to pass a MESSAGE on a non-zero chat channel to the HUD each time it hears a dedication. llRegionSayTo (range: whole sim) or llSay (range 20m) are ideal for this. (This will send each request immediately to be displayed by the HUD)
  3. Then EITHER:
    1. If the requests will total less than 128 characters: Use llSetText in the HUD to display the requests and add TOUCH_START behaviour to the HUD that flushes the variable being passed to llSetText and resets llSetText to "" (empty string).
    2. If the requests are longer (up to 1024 characters total): Use llDialog to display the requests when you TOUCH_START the HUD. TOUCH_START would also flush the variable being passed to the MESSAGE argument of llDialog. (remember to use a non-zero channel for the llDialog so that button-clicks don't post to local chat - which is channel zero)

             (the advantage of these two functions is that they will keep requests out of your Chat History window)
             (remember that both functions use '\n' as line-break characters, to start a new line)

This might be a little complex but perhaps gives you an idea of what will be involved.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2836 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...