1. Create two blocks one on top of the other and link them together. Make the bottom box transparent and the top box textured with something that would be a good background for red text. Link the two boxes together.
2. Add the script below to the bottom box. What this script does is display the text “Click HUD for dialog of options” and then waits for a touch. When a touch occurs it creates a dialog and then listens for a response. When a response occurs the hovering text is updated.
3. Right click on linked boxes and select attach to HUD -> Center. I recommend you start with the center because if you start with your HUD in the corner it can sometimes be off the screen. You can use the edit button and adjust the position left and lower on the screen from the center HUD position so that when you move it to the upper left hand corner (if you want to) it will fit better.
That's about it.
Here's the code:
CODE
// when HUD touched, present a dialog with four color choices
integer CHANNEL = 42; // dialog channel
list MENU_MAIN = ["Sit", "Stand", "Fly", "Cheat", "Options..."]; // the main menu
list MENU_OPTIONS = ["Cherry", "Blueberry", "Vinegar", "Slime", "Chips", "Salad", "...Back"]; // a submenu
default {
state_entry()
{
llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users)
// Set text to display in bright red
llSetText("Click HUD for dialog of options", <1,0,0>, 1.0);
}
touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL); // present dialog on click
}
listen(integer channel, string name, key id, string message)
{
string response_string;
if (llListFindList(MENU_MAIN + MENU_OPTIONS, [message]) != -1) // verify dialog choice
{
//llSay(0, name + " picked the option '" + message + "'."); // output the answer
response_string = name + " picked the option '" + message + "'.";
if (message == "Options...")
llDialog(id, "Pick an option!", MENU_OPTIONS, CHANNEL); // present submenu on request
else if (message == "...Back")
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL); // present main menu on request to go back
// here you have the name and key of the user and can easily verify if they have the permission to use that option or not
else if (message == "Sit")
{
//llSay(0, "This is where stuff would happen if this wasn't just an example");
response_string = "This is where stuff would happen if this wasn't just an example\n";
response_string = response_string + "Click HUD for dialog of options";
}
}
else
{
//llSay(0, name + " picked invalid option '" + llToLower(message) + "'."); // not a valid dialog choice
response_string = name + " picked invalid option '" + llToLower(message) + "'.\n";
response_string = response_string + "Click HUD for dialog of options";
}
// Set text to display in bright red
llSetText(response_string, <1,0,0>, 1.0);
}
}