Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Setting up a menu

Billybob Flatley
Registered User
Join date: 9 Nov 2007
Posts: 36
03-08-2009 08:52
heres what i want to do.
create a drop down menu that will link to multiple webpages.
I have sub menu demo.lsl and can create the tabs. but when i try to get it to open the page nothing happens.
Is there anyone willing to help me work this out?
the goal here is to listen to an audio book from the web it has around 22 chapters. I would like the user to be able to access them by touching
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
03-08-2009 09:07
hi Billybob!
If you whant some help or tip about your script try to post a part of your code because we cant help you if any body can see how its working or what the script do.
_____________________


RAW terrain files - terraform your SIM!!
http://www.wishland.info/
PD:the wiki its your friend ;)
http://wiki.secondlife.com/wiki/LSL_Portal
Billybob Flatley
Registered User
Join date: 9 Nov 2007
Posts: 36
03-08-2009 09:29
ok thanks
here's what i have this works fine but i have 18 of these.

default
{
touch(integer total_number)
{
llLoadURL(llDetectedKey(0), "http://www.ejunto.com/sounds/roosevelt5b/rooseveltchs1-2.mp3","http://www.ejunto.com/sounds/roosevelt5b/rooseveltchs1-2.mp3";);
llResetScript();
}
}

what i am try to do is adapt this script

integer channel; // channel that we are listening on
integer listener; // internal number representing the listener
key agentKey; // persons key who is using menu
string agentName; // person who is using menu
float timeout = 60; // number of seconds before dialogs time out

string menu = ""; // current menu being displayed to user

// menu buttons ...
list mainButtons = ["color", "taste"];
list colorButtons = ["red", "green", "blue"];
list tasteButtons = ["yummy", "sour", "sweet", "moldy"];


init()
{
llTargetOmega(<0,0,1>, 1, 1);

stopListening();
}
stopListening()
{
// stop listening
if(listener != 0)
{
llListenRemove(listener);
listener = 0;
}

// set to main menu
menu = "";

// forget current user
agentKey = NULL_KEY;
agentName = "";
channel = 0;

// stop timing out
llSetTimerEvent(0);
}
mainMenuHandler(string message)
{
menu = message;

if(message == "color";)
llDialog(agentKey, "pick a color", colorButtons, channel);
else if(message == "taste";)
llDialog(agentKey, "pick a taste", tasteButtons, channel);
else
{
llInstantMessage(agentKey, "Unknown menu item - " + message);
stopListening();
return;
}

// extend timeout
llSetTimerEvent(timeout);
}
colorMenuHandler(string message)
{
llSay(0, "My favorite color is " + message);
stopListening();
}
tasteMenuHandler(string message)
{
llSay(0, "I like things that taste " + message);
stopListening();
}
unknownMenuHandler(string message)
{
llInstantMessage(agentKey, "Unknown menu item - " + message);
stopListening();
}
default
{
state_entry()
{
init();
}
on_rez(integer start_param)
{
init();
}

touch_start(integer total_number)
{
// someone else using this?
if(listener != 0 && llDetectedKey(0) != agentKey)
{
llInstantMessage(llDetectedKey(0), agentName + " is using that.";);
return;
}

// remember who is using this
agentKey = llDetectedKey(0);
agentName = llDetectedName(0);

// if we are not listening already
if(listener == 0)
{
// set a random channel betweed -4000 and -2000
channel = (integer)(llFrand(2000) - 4000);

// start listening only to the agent on our hidden channel
listener = llListen(channel, agentName, agentKey, "";);
}

// set menu to default
menu = "";

// show them buttons
llDialog(agentKey, "pick something", mainButtons, channel);

// set timeout
llSetTimerEvent(timeout);
}
listen(integer channel, string name, key id, string message)
{
// handle results based on menu end-user was viewing
if(menu == "";) mainMenuHandler(message);
else if(menu == "color";) colorMenuHandler(message);
else if(menu == "taste";) tasteMenuHandler(message);
else unknownMenuHandler(message);
}
timer()
{
// let agent know that we are not listening
llInstantMessage(agentKey, "Your menu has timed out!";);

stopListening();
}
}

so that i can use the 18 urls in it hope this help you understand what I want here

im starting to get this I think I have all the menu tabs now I would like to add a Next and a back option if i can. then its just a matter of finding where to add in the url to each tab for that chapter

script as it is now

integer channel; // channel that we are listening on
integer listener; // internal number representing the listener
key agentKey; // persons key who is using menu
string agentName; // person who is using menu
float timeout = 60; // number of seconds before dialogs time out

string menu = ""; // current menu being displayed to user

// menu buttons ...
list mainButtons = ["part1", "part2"];
list part1Buttons = ["C1&2", "C3", "C4","C4&5","C6","C7","C8","C9&10"];
list part2Buttons = ["C11", "C12", "C13", "C14","C15","C16","C17&18","C19","C20&21"];


init()
{
llTargetOmega(<0,0,1>, 1, 1);

stopListening();
}
stopListening()
{
// stop listening
if(listener != 0)
{
llListenRemove(listener);
listener = 0;
}

// set to main menu
menu = "";

// forget current user
agentKey = NULL_KEY;
agentName = "";
channel = 0;

// stop timing out
llSetTimerEvent(0);
}
mainMenuHandler(string message)
{
menu = message;

if(message == "part1";)
llDialog(agentKey, "pick a color", part1Buttons, channel);
else if(message == "part2";)
llDialog(agentKey, "pick a taste", part2Buttons, channel);
else
{
llInstantMessage(agentKey, "Unknown menu item - " + message);
stopListening();
return;
}

// extend timeout
llSetTimerEvent(timeout);
}
colorMenuHandler(string message)
{
llSay(0, "My favorite color is " + message);
stopListening();
}
tasteMenuHandler(string message)
{
llSay(0, "I like things that taste " + message);
stopListening();
}
unknownMenuHandler(string message)
{
llInstantMessage(agentKey, "Unknown menu item - " + message);
stopListening();
}
default
{
state_entry()
{
init();
}
on_rez(integer start_param)
{
init();
}

touch_start(integer total_number)
{
// someone else using this?
if(listener != 0 && llDetectedKey(0) != agentKey)
{
llInstantMessage(llDetectedKey(0), agentName + " is using that.";);
return;
}

// remember who is using this
agentKey = llDetectedKey(0);
agentName = llDetectedName(0);

// if we are not listening already
if(listener == 0)
{
// set a random channel betweed -4000 and -2000
channel = (integer)(llFrand(2000) - 4000);

// start listening only to the agent on our hidden channel
listener = llListen(channel, agentName, agentKey, "";);
}

// set menu to default
menu = "";

// show them buttons
llDialog(agentKey, "pick something", mainButtons, channel);

// set timeout
llSetTimerEvent(timeout);
}
listen(integer channel, string name, key id, string message)
{
// handle results based on menu end-user was viewing
if(menu == "";) mainMenuHandler(message);
else if(menu == "color";) colorMenuHandler(message);
else if(menu == "taste";) tasteMenuHandler(message);
else unknownMenuHandler(message);
}
timer()
{
// let agent know that we are not listening
llInstantMessage(agentKey, "Your menu has timed out!";);

stopListening();
}
}
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
03-08-2009 11:18
ok first the right statement for llLoadURL is

llLoadURL(avatar key,"message","url";);
like this:

CODE

default

{
state_entry()
{

}

touch_start(integer total_number)
{

llLoadURL(llDetectedKey(0),"hear my chapter", "http://www.ejunto.com/sounds/roosevelt5b...5b/rooseveltchs1-2.mp3");
}
}

_____________________


RAW terrain files - terraform your SIM!!
http://www.wishland.info/
PD:the wiki its your friend ;)
http://wiki.secondlife.com/wiki/LSL_Portal
Billybob Flatley
Registered User
Join date: 9 Nov 2007
Posts: 36
03-08-2009 11:53
ok I got that now.
This 1 is for chapter 1&2
how do i get the tab for chapter 1&2 on my menu to load this now? Thats where i'm lost.
this has to be repeated for each chapter tab. each chapter has its own mp3
Billybob Flatley
Registered User
Join date: 9 Nov 2007
Posts: 36
03-08-2009 12:38
this will work placing this 1 after another brings down the go to page tab. so all i did was name each chapter and add its url. thanks for the help
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
03-08-2009 18:41
From: Billybob Flatley
this will work placing this 1 after another brings down the go to page tab. so all i did was name each chapter and add its url. thanks for the help


yw ;)

If you need more tips just post it on the forum , a lot of people are glad to help you .
_____________________


RAW terrain files - terraform your SIM!!
http://www.wishland.info/
PD:the wiki its your friend ;)
http://wiki.secondlife.com/wiki/LSL_Portal
Billybob Flatley
Registered User
Join date: 9 Nov 2007
Posts: 36
03-09-2009 05:19
I would still like to try and work this out a single drop down with options on it would be better.
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
03-09-2009 09:54
From: Billybob Flatley
I would still like to try and work this out a single drop down with options on it would be better.
You might find some of the examples at http://lslwiki.net/lslwiki/wakka.php?wakka=ZenMondo of interest here. He does pretty much what you're trying, except he reads the lists from a notecard and splits them into two lists, urlData and titleData, in the dataserver event.

If I were doing this, I would start with one of the examples of how to create multi-page menus on the fly at http://wiki.secondlife.com/wiki/SimpleDialogMenuSystem or /54/94/235155/1.html and then have two lists, urlData and titleData, with the titles and urls in the same order.

I would grap the user's uuid in the touch_start event and assign it to a global variable, user, so I can refer to it in the listen event.

Then I would then use something like integer n = llListFindList(titleData, [choice]); in the listen event to find out the index number of the title the user chooses, then say string myURL = llList2String(urlData,n); to find the corresponding url in that list, and then just say llLoadUrl(user, choice, myurl);

You will notice that ZenMondo has the names of the choices numbered in the title section of his llDialog boxes and then asks you to press the button with the corresponding number. This is certainly worth considering since it works round both the problems of only being able to display 8 or 10 characters on a button and not being able to have more than 24 character to a button title anyway.
Billybob Flatley
Registered User
Join date: 9 Nov 2007
Posts: 36
03-10-2009 06:54
thanks Innula
This sounds good to me I will see if I can work threw it.