Jump to content
Sign in to follow this  
Wandering Soulstar

Alternative to Dialog

Recommended Posts

Hi All,

I was looking to see how to get a clickable teleport output in a chat message (Topic HERE) and @Innula Zenovka pointed me to the following Wiki entry (Viewer URI Name Space) which did the trick. I saw that this gave a lot of options for things that could be done and one that jumped right out was the \app\chat option. I realised that this gives us a way to give the user options, in chat, that can then go back to our scripts. This could be very useful when we have a dynamic set of options for the user, some that may be longer than the text available in a button, and much simpler than having to write all the code for a dynamic, multi-panel, dialog. I created the following code snippet to test:


string gName;
key gUser;

default
{
    touch_start(integer total_number)
    {
        gUser = llDetectedKey(0);
        gName = llDetectedName(0);
        llListen(5,"",NULL_KEY,"");
        llSay(0, "Select your Option (click on underlined text):");
        llSay(0, "Option 1: [secondlife:///app/chat/5/one]");
        llSay(0, "Option 2: [secondlife:///app/chat/5/two]");
    }
    listen(integer channel, string name, key id, string message)
    {
        llSay(0, "Option Selected was: " + message);
        llSay(0, "confirm id & name");
        llSay(0, "id: " + (string)(id == gUser)); 
        llSay(0, "name: " + (string)(name == gName));
    }
}

And the results were exactly as I hoped:

Quote

[03:19] Object: Select your Option (click on underlined text):
[03:19] Object: Option 1: [secondlife:///app/chat/5/one]
[03:19] Object: Option 2: [secondlife:///app/chat/5/two]

-- Clicked on Option 2
[03:19] Object: Option Selected was: two
[03:19] Object: confirm id & name
[03:19] Object: id: 1
[03:19] Object: name: 1

 

To make it more like a dialog, instead of using llSay in the initial 'dialog' we can use llInstantMessage or llRegionSayTo .. and as well set the listen to listen just to the AV that has clicked.

Just thought I'd share 🙂

Edited by Wandering Soulstar
added clarification
  • Like 3
  • Thanks 2

Share this post


Link to post
Share on other sites

Thanks to a pointer from @Wulfie Reanimator in another thread, saw how to make this more user frindly. The above code was showing the full link, whilst the below just shows an underlined word!

string gName;
key gUser;

default
{
    touch_start(integer total_number)
    {
        gUser = llDetectedKey(0);
        gName = llDetectedName(0);
        llListen(5,"",NULL_KEY,"");
        llRegionSayTo(gUser, 0, "Select your Option (click on underlined text):");
        llSay(0, "Option 1: [secondlife:///app/chat/5/one One]");
        llSay(0, "Option 2: [secondlife:///app/chat/5/two Two]");
    }
    listen(integer channel, string name, key id, string message)
    {
        llSay(0, "Option Selected was: " + message);
        llSay(0, "confirm id & name");
        llSay(0, "id: " + (string)(id == gUser)); 
        llSay(0, "name: " + (string)(name == gName));
    }
}

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...