Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: GiTech Menu-Talk MultiPage System v5.0.0

Tre Giles
Registered User
Join date: 16 Dec 2005
Posts: 294
09-08-2007 05:41
Havn't submitted anything here in a LOOONG time - so I'm probably doing something horribly wrong lol.

This is a little script I whipped up one day for a friend who wanted a dynamic device that would read a notecard and present touchers with a dialog menu based on the information provided in the notecard - without having to tinker with the script.

This script basically takes your settings, turns then into multi-paged (that means a near infinite amount of options - not limited to 12) llDialog Popup Menu to whoever touches it. When an option is selected, the script will give the user inventory if specified in the notecard, and say a message if specified in the notecard.

This is useful for those of us who do not have the time to create different llDialog Scripts for every single occasion, or those of us who don't have the skills to.

From: EXAMPLE

A person has a lunch box

This person wants the lunch box, when clicked on, to give the clicker a menu displaying different food items (soda, pear, pizza, etc.)

When clicked, said person wants the object to say something to the use ('Mmm... Pizza', 'Enjoy your soda!', etc.)

Also, said person wants the object to give a copy of an inventory object per each dialog button (*click pizza* -- Give "thisIzThePIsszzAObject'sName";)

And all from a convienient notecard without having to even look at an LSL function!


If you don't get it, maybe reading the help notecard below will help xD

If you still don't get it, IM me whenever :P

If you want, IM me and I'll give you the example object full with custom objects, example settings notecard, a set of Help and Settings Notecards that are humanly legible, etc.

-------------------------
The Help Notecard
-------------------------

From: The Help Notecard

To use the GiTech MenuTalk Multi-Page System you first much configure the settings note card.

A "#" at the start of a phrase will 'comment out' the note card line, and the compiler will ignore it

A "$" at the start of a phrase will tell the compiler that it is a variable, and that you want to alter it in some way

Make sure its put in exactly as follows:

(IF you have any leading whitespace)($)(no space)(variable)(space)(=)(space)(parameter)(IF you have any trailing whitespace)

I.e. $owner_only = FALSE



The compiler skips over empty (white) lines, so you can have as many empty lines as you want

If it’s none of these, the compiler assumes its a Menu Entry:

ButtonName||AssosiatedText||AssosiatedInventory



Besides 'ButtonName', the entries can contain more than one sub entry by using the sub separator ";;" (which means that your text/entries cannot contain ";;" or "||" unless you intent to parse) - since I didn't feel like writing a multi-liner (instead I wrote the "Menu Page" function) function; you can't go longer than one line for the config note card entries, maybe later I'll write one, or maybe someone on the forums will be nice and write one for us *hint hint* :D

Ie. Hello 1||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||DeathBombKillNuke;;New Script
I.e. Hello 2||||DeathBombKillNuke;;New Script
I.e. Hello 3||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||

(If the above examples are on two lines on the forum because the Quote Box is not big enough)



This is a list of the variables you're allowed to alter from the Settings Notecard:
From: someone

How long to wait before the active dialog menu deactivates
integer menu_timeout_wait = 35; //default = 35

How should we announce 'AssosiatedText' to the world?
0: Whisper, 1: Say, 2: Shout, 3: RegionSay
integer verbose = 1;

How long to lag while chatting text
integer verb_lag = 2;

What channel to announce text on
integer custom_channel = 0;

The custom maximum limit of available channels that this object can use *do not touch this if you don't understand it*
integer chan_limit = -2000000000;

Check this off if you want to skip the note card process and just load directly from this script
integer direct_customization = FALSE;

If the name of the settings note card changes dynamically, set this to TRUE (you can only have that one note card in the object's inventory at all times)
integer custom_note = FALSE;

Toggles the owner only functionality
integer owner_only = TRUE;

If the settings note card is not found, instead of crashing, we will search for any other note card to load from. To active this successfully, you cannot have any other note cards then this and the main default note card. Good for note cards that change names dynamically. Most people can leave this FALSE
integer sub_search = FALSE;

Should we show hover text time from to time?
integer hover_text = TRUE;

If this is set to TRUE, when the object starts, it'll display the custom text (specified under the custom_text variable above)
integer custom_start = FALSE;

If this is set to TRUE, the system will alert you with debug messages when anything goes bad
integer debug = TRUE;

The name of the custom configurations note card
string settings_notecard = "_Settings";

Custom text that, if the var is set properly, repeated it
string custom_text = "Put here the text you want the object to say on initialization (If 'custom_start' is set to TRUE).";

The text that will show up in the menu window
string custom_dialog_text = "Please choose an option:";

--------------
Separators
--------------

string separator = "||";
string sub_separator = ";;";
string comment_char = "#";
string var_char = "$";


Example: "string separator = "||";
To change this in the script, you'd write "separator = "]["
Replace ][ with whatever you want

As you can see, the "string" and ";" has been discarded, do this with any and all functions you change

You DO NOT have to list every single function in the settings note card for a change if you don't need to, in fact, it'll make your script go much faster! If you like it the way it is, don't even include any function changes!




Going a bit deeper into the Menu Entries:
1. Hello 1||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||
2. Hello 2||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||DeathBombKillNuke;;New Script
3. Hello 3||||DeathBombKillNuke;;New Script


These values would return:

1. The Menu Dialog Window would display "Hello 1", when clicked it'll say out loud "This 2cr1pt be is teh l33tz0r!" then "Am I right folks?" and finally "Here, have some nice gifts", and then stop.

2. The Menu Dialog Window would display "Hello 2", when clicked it'll say out loud "This 2cr1pt be is teh l33tz0r!" then "Am I right folks?" and finally "Here, have some nice gifts", and then give the current user an inventory item called "DeathBombKillNuke" and then another inventory item called "New Script", then stop.

3. The Menu Dialog Window would display "Hello 3", when clicked it'll say nothing and give the current user an inventory item called "DeathBombKillNuke" and then another inventory item called "New Script", then stop.

The note card cannot contain more than 250 lines in all, from top to bottom. This is a self imposed limit to protect the simulation and the script's free memory.
For menu entries its best not to go over 50 Menu Lines- but I believe it can you up to around 175-200 if you have a full set of variable edits and comments.
For more information contact Tre Giles.


-------------------------------
The _Settings Notecard
-------------------------------

From: The Settings Notecard

#This is a comment line, it is not read by the compiler
#Empty space is also ignored by the compiler, and so are leading and trailing spaces, so feel free to make it as readable as you can
#Leave the "END OF FILE" marker alone. You can create new entries above it (as much as you want) but do not create anything below it, unless you want it ingored like a comment and spam the current owner
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#

#Notecard Entry Format...
#ButtonName||AssosiatedText||AssosiatedInventory

#Except for 'ButtonName', the entries can contain more than one sub entry by using the sub separator ";;" (which means that your text/entries cannot contain ";;" or "||" unless #you intent to parse).
#Also you can't go longer than one line for the config notecard entries.

#Insert the variables here that you want to alter
#Examples - Remove these before use
#$debug = TRUE
#$owner_only = FALSE

#Menu Entries: best not to go over 50 - but I believe it can go up to around 200
#Examples - remove these before use
#Hello 1!||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||
#Hello 2!||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||ExampleObject1;;ExampleScript1
#Hello 3!||||ExampleClothes1;;ExampleGesture1

|| END OF FILE ||


Complicated huh lol!



And finally: The Source Code!
(excuse its condition on this forum, it only looks scarey because the Code (PHP) tag is broken

CODE

//Copyright 2007-2008 (c) The GiTechnologies Corporation. All Rights Reserved.
//You have permissions to do whatever you want with this script, besides sell it as is - unless approved by The GiTechnologies Corporation (which it isn't)
//You may sell it if you integrate it within your own code or use it in a project etc. as long as you keep this header intact.
//Credits: Tre Giles

//Notecard Entry Format...
//ButtonName||AssosiatedText||AssosiatedInventory
//Besides 'ButtonName', the entries can contain more than one sub entry by using the sub seperator ";;" (which means that your text/entries cannot contain ";;" or "||" unless you intent to parse) - since I didn't feel like writing a multi-liner (instead I wrote the "Menu Page" function) function: you can't go longer than one line for the config notecard entries, maybe later I'll write one, or maybe someone on the forums will be nice and write one for us *hint hint* :D
//Ie. Hello World!||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||DeathBombKillNuke;;New Script
//I.e. Hello World!||||DeathBombKillNuke;;New Script
//I.e. Hello World!||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||

//---- {[ Do Not Touch ]} ----
//----------------------------------
key queryid;
key current_user;
integer rchan;
integer line = -1;
integer handle = -1;
integer MAX_BUTTONS = 12;
integer MAX_STRLEN = 12;
integer list_index = 0;
//----------------------------------
//----------------------------------
//How long to wait before the active dialog menu deactivates
integer menu_timeout_wait = 10; //default = 35
//How should we announce 'AssosiatedText' to the world?
//0: Whisper
//1: Say
//2: Shout
//3: RegionSay
integer verbose = 1;
//How long to lag while chatting text
integer verb_lag = 2;
//What channel to announce text on
integer custom_channel = 0;
//The custom maximum limit of available channels that this object can use *do not touch this if you don't understand it*
integer chan_limit = -2000000000;
//Unless you're manually customizing the script, these do not need to be tampered with.
list buttons = [];
list chat = [];
list inventory = [];
//----------------------------------
//Check this off if you want to skip the notecard process and just load directly from this script
integer direct_customization = FALSE;
//If the name of the settings notecard changes dynamically, set this to TRUE (you can only have that one notecard in the object's inventory at all times)
integer custom_note = FALSE;
//Toggles the owner only functionality
integer owner_only = TRUE;
//If the settings notecard is not found, instead of crashing, we will search for any other notecard to load from. To active this sucessfully, you cannot have any other notecards then this and the main default notecard. Good for notecards that change names dynamically. Most people can leave this FALSE
integer sub_search = FALSE;
//Should we show hovertext time from to time?
integer hover_text = TRUE;
//If this is set to TRUE, when the object starts, it'll display the bustom text (specified under the variable '')
integer custom_start = FALSE;
//If this is set to TRUE, the system will alert you with debug messages when anything goes bad
integer debug = FALSE;
//The name of the custom configurations notecard
string settings_notecard = "_Settings";
//Custom text that, if the var is set properly, repeated it
string custom_text = "Put here the text you want the object to say on initilization (If 'custom_start' is set to TRUE).";
//The text that will show up in the menu window
string custom_dialog_text = "Please choose an option:";
//Separator
string separator = "||";
string sub_separator = ";;";
string comment_char = "#";
string var_char = "$";
//----------------------------------
//End Of File Marker
string EOL = "|| END OF FILE ||";
integer index4List(string data)
{
return llListFindList(compile_Buttons(buttons, list_index), [data]);
}
list compile_Buttons(list old_buttons, integer index)
{
integer start = index;
integer end = start + MAX_BUTTONS - 1;
integer len = llGetListLength(old_buttons);
list result = [];
if(len > MAX_BUTTONS)
{
string n_bn = "Next";

if(list_index + 11 > len)
{
n_bn = "Previous";
}

result = [n_bn] + llList2List(old_buttons, start, end - 1);
}

else
{
result = llList2List(old_buttons, start, end);
}
integer i = llGetListLength(result);

while(i--)
{
result = llListReplaceList(result, [llGetSubString(llList2String(result, i), 0, MAX_STRLEN - 1)], i, i);
}

return result;
}
string parser(string data, integer rule)
{
string l = llList2String(llParseStringKeepNulls(data, [separator], []), rule);

if(l)
{
return l;
}

else
{
return "~!|;";
}
}
insert_param(string variable, string parameter)
{
if(debug)
{
llOwnerSay("Altering Code...");
llSleep(1);
llOwnerSay("Altered Code Function " + variable + " With Parameter " + parameter + ".");
}

if(parameter == "TRUE")
{
parameter = "1";
}

else if(parameter == "FALSE")
{
parameter = "0";
}

integer n_parameter = (integer)parameter;

if(variable == "menu_timeout_wait")
{
menu_timeout_wait = n_parameter;
}

if(variable == "verbose")
{
verbose = n_parameter;
}

if(variable == "verb_lag")
{
verb_lag = n_parameter;
}

if(variable == "custom_channel")
{
custom_channel = n_parameter;
}

if(variable == "chan_limit")
{
chan_limit = n_parameter;
}

if(variable == "direct_customization")
{
direct_customization = n_parameter;
}

if(variable == "custom_note")
{
custom_note = n_parameter;
}

if(variable == "owner_only")
{
owner_only = n_parameter;
}

if(variable == "sub_search")
{
sub_search = n_parameter;
}

if(variable == "hover_text")
{
hover_text = n_parameter;
}

if(variable == "custom_start")
{
custom_start = n_parameter;
}

if(variable == "debug")
{
debug = n_parameter;
}

if(variable == "settings_notecard")
{
settings_notecard = parameter;
}

if(variable == "custom_text")
{
custom_text = parameter;
}

if(variable == "custom_dialog_text")
{
custom_dialog_text = parameter;
}

if(variable == "separator")
{
separator = parameter;
}

if(variable == "sub_separator")
{
sub_separator = parameter;
}

if(variable == "comment_char")
{
comment_char = parameter;
}

if(variable == "var_char")
{
var_char = parameter;
}
}
default
{
on_rez(integer start)
{
llWhisper(0, "Initalizing...\n\t\tLoading " + settings_notecard + " Notecard...");
llResetScript();
}

state_entry()
{
handle = 0;
if(hover_text)
{
llSetText("Loading...", <0,0,1>, 1);
}

if(custom_start && custom_text != "")
{
llOwnerSay(custom_text);
}

llSleep(1);

if(direct_customization)
{
jump here;
}

if(llGetInventoryType(settings_notecard) == -1)
{
if(custom_note == FALSE)
{
llOwnerSay("The Default Settings notecard was not found!");
}

if(sub_search)
{
if(custom_note == FALSE)
{
llOwnerSay("Searching object for a Secondary Settings notecard...");
}

if(llGetInventoryNumber(INVENTORY_NOTECARD))
{
settings_notecard = llGetInventoryName(INVENTORY_NOTECARD, 3);

if(custom_note == FALSE && settings_notecard != "")
{
llOwnerSay("Reading Secondary Settings notecard " + settings_notecard);
}

return;
}

llOwnerSay("No Secondary Settings notecard was not found!");
}

llSetText("ERROR...", <1,0,0>, 1);
llSetScriptState(llGetScriptName(), FALSE);
}

queryid = llGetNumberOfNotecardLines(settings_notecard);

@ here;

if(debug)
{
llOwnerSay((string)llGetFreeMemory() + ".");
}

if(hover_text)
{
llSetText("", <0,0,0>, 0);
}
}

touch_start(integer num)
{
llSetTimerEvent(menu_timeout_wait);
rchan = llRound(chan_limit * (llFrand(.9) + .1));

if(handle != -1)
{
integer i;

for(i = 0; i < num; i++)
{
llInstantMessage(llDetectedKey(i), "This Object Is Busy, Please Try Again.");
}

return;
}

if(owner_only && llDetectedKey(0) == llGetOwner())
{
current_user = llGetOwner();
handle = llListen(rchan, llKey2Name(llGetOwner()), llGetOwner(), "");
}

else
{
current_user = llDetectedKey(0);
handle = llListen(rchan, "", NULL_KEY, "");
}

llDialog(current_user, custom_dialog_text, compile_Buttons(buttons, list_index), rchan);
}

listen(integer c, string n, key id, string m)
{
llSetTimerEvent(0);
integer temp_int = llListFindList(buttons, [m]);
llListenRemove(handle);
handle = -1;

if(c == rchan)
{
if(m == "Previous")
{
list_index -= 11;

if(list_index < 0)
{
list_index = 0;
}

if(owner_only && llGetOwnerKey(id) == llGetOwner())
{
current_user = llGetOwner();
handle = llListen(rchan, llKey2Name(llGetOwner()), llGetOwner(), "");
}

else
{
current_user = llGetOwnerKey(id);
handle = llListen(rchan, "", NULL_KEY, "");
}


llDialog(current_user, custom_dialog_text, compile_Buttons(buttons, list_index), rchan);
}

if(m == "Next")
{
integer len = llGetListLength(buttons);
list_index = (list_index + 11);

if(list_index > len)
{
list_index = 0;
}

if(owner_only && llGetOwnerKey(id) == llGetOwner())
{
current_user = llGetOwner();
handle = llListen(rchan, llKey2Name(llGetOwner()), llGetOwner(), "");
}

else
{
current_user = llGetOwnerKey(id);
handle = llListen(rchan, "", NULL_KEY, "");
}

llDialog(current_user, custom_dialog_text, compile_Buttons(buttons, list_index), rchan);
}

else if(temp_int >= 0)
{
integer p;

list temp_str_list = llParseString2List(llList2String(chat, temp_int), [sub_separator], []);
list temp_obj_list = llParseString2List(llList2String(inventory, temp_int), [sub_separator], []);

integer str_len = llGetListLength(temp_str_list);
integer obj_len = llGetListLength(temp_obj_list);

for(p = 0; p < str_len; p++)
{
string temp_str = llList2String(temp_str_list, p);
llSleep(verb_lag - 0.5);

if(temp_str == "~!|;" || temp_str == "")
{
jump overhere;
}

if(verbose == 0)
{
llWhisper(custom_channel, temp_str);
}

if(verbose == 2)
{
llShout(custom_channel, temp_str);
}

if(verbose == 3)
{
llRegionSay(custom_channel, temp_str);
}

else //Just in case you 'somehow' make a mistake, End User
{
if(debug && verbose != 1)
{
llOwnerSay("You have entered an incorrect parameter for the \"verbose\" variable, switching to default...");
}

llSay(custom_channel, temp_str);
}

@ overhere;
}

for(p = 0; p < obj_len; p++)
{
string temp_obj = llList2String(temp_obj_list, p);

if(llGetInventoryType(temp_obj) != -1)
{
llGiveInventory(current_user, temp_obj);
}

else if(debug)
{
llOwnerSay("It seems that inventory item " + temp_obj + " does not exist. Please contact the object creator for support.");
}
}
}
}

current_user = "";
}

timer()
{
llSetTimerEvent(0);
llListenRemove(handle);

if(debug)
{
llOwnerSay("Listen Timed Out!");
}

current_user = "";
}

dataserver(key id, string data)
{
data = llStringTrim(data, STRING_TRIM);

if(line == -1)
{
integer cap = (integer)data;

if(cap > 250)
{
llOwnerSay("The specified Configuration Notecard contains too many entries, please specify a new Settings notecard, or try again.");
}

else
{
for(line = 0; line <= cap; line++)
{
queryid = llGetNotecardLine(settings_notecard, line);
}
}
}

else if(line != -1)
{
if(data != EOF && data != EOL)
{
if(data != "" && llGetSubString(data, 0, 0) != comment_char)
{
if(llGetSubString(data, 0, 0) == var_char) //$[hover_text = FALSE]
{
data = llDeleteSubString(data, 0, 0);
list l = llParseString2List(data, [" = "], []);
string var = llList2String(l, 0);
string param = llList2String(l, 1);
insert_param(var, param);
}

else
{
buttons = (buttons=[]) + buttons + parser(data, 0);
chat = (chat=[]) + chat + parser(data, 1);
inventory = (inventory=[]) + inventory + parser(data, 2);
}
}
}

else
{
llOwnerSay("Ready. >");
handle = -1;
}
}
}

changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llOwnerSay("Change Detected. Resetting Script...");
llResetScript();
}
}
}



Hope it proves useful for someone out there! ;)
Tre Giles
Registered User
Join date: 16 Dec 2005
Posts: 294
Update 5.1.2!
11-05-2007 15:00
Once again, sitting in a sandbox next to Gemini, I got bored and fixed some small bugs in this system. Enjoy xD

CODE

//Copyright 2007-2008 (c) The GiTechnologies Corporation. All Rights Reserved.
//You have permissions to do whatever you want with this script, besides sell it as is - unless approved by The GiTechnologies Corporation (which it isn't)
//You may sell it if you integrate it within your own code or use it in a project etc. as long as you keep this header intact.
//Credits: Tre Giles

//Notecard Entry Format...
//ButtonName||AssosiatedText||AssosiatedInventory
//Besides 'ButtonName', the entries can contain more than one sub entry by using the sub seperator ";;" (which means that your text/entries cannot contain ";;" or "||" unless you intent to parse) - since I didn't feel like writing a multi-liner (instead I wrote the "Menu Page" function) function: you can't go longer than one line for the config notecard entries, maybe later I'll write one, or maybe someone on the forums will be nice and write one for us *hint hint* :D
//Ie. Hello World!||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||DeathBombKillNuke;;New Script
//I.e. Hello World!||||DeathBombKillNuke;;New Script
//I.e. Hello World!||This 2cr1pt be is teh l33tz0r!;;Am I right folks?;;Here, have some nice gifts||

//---- {[ Do Not Touch ]} ----
//----------------------------------
key queryid;
key current_user;
integer rchan;
integer line = -1;
integer handle = -1;
integer MAX_BUTTONS = 12;
integer MAX_STRLEN = 12;
integer list_index = 0;
integer data_cap = FALSE;
//----------------------------------
//----------------------------------
//How long to wait before the active dialog menu deactivates
integer menu_timeout_wait = 10; //default = 35
//How should we announce 'AssosiatedText' to the world?
//0: Whisper
//1: Say
//2: Shout
//3: RegionSay
integer verbose = 1;
//How long to lag while chatting text
integer verb_lag = 2;
//What channel to announce text on
integer custom_channel = 0;
//The custom maximum limit of available channels that this object can use *do not touch this if you don't understand it*
integer chan_limit = -2000000000;
//Unless you're manually customizing the script, these do not need to be tampered with.
list buttons = [];
list chat = [];
list inventory = [];
//----------------------------------
//Check this off if you want to skip the notecard process and just load directly from this script
integer direct_customization = FALSE;
//If the name of the settings notecard changes dynamically, set this to TRUE (you can only have that one notecard in the object's inventory at all times)
integer custom_note = FALSE;
//Toggles the owner only functionality
integer owner_only = TRUE;
//If the settings notecard is not found, instead of crashing, we will search for any other notecard to load from. To active this sucessfully, you cannot have any other notecards then this and the main default notecard. Good for notecards that change names dynamically. Most people can leave this FALSE
integer sub_search = FALSE;
//Should we show hovertext time from to time?
integer hover_text = TRUE;
//If this is set to TRUE, when the object starts, it'll display the bustom text (specified under the variable '')
integer custom_start = FALSE;
//If this is set to TRUE, the system will alert you with debug messages when anything goes bad
integer debug = FALSE;
//The name of the custom configurations notecard
string settings_notecard = "_Settings";
//Custom text that, if the var is set properly, repeated it
string custom_text = "Put here the text you want the object to say on initilization (If 'custom_start' is set to TRUE).";
//The text that will show up in the menu window
string custom_dialog_text = "Please choose an option:";
//Separator
string separator = "||";
string sub_separator = ";;";
string comment_char = "#";
string var_char = "$";
//----------------------------------
//End Of File Marker
string EOL = "|| END OF FILE ||";
list compile_Buttons(list old_buttons, integer index)
{
integer start = index;
integer end = start + MAX_BUTTONS - 1;
integer len = llGetListLength(old_buttons);
list result = [];
if(len > MAX_BUTTONS)
{
string n_bn = "Next";

if(list_index + 11 > len)
{
n_bn = "Previous";
}

result = [n_bn] + llList2List(old_buttons, start, end - 1);
}

else
{
result = llList2List(old_buttons, start, end);
}
integer i = llGetListLength(result);

while(i--)
{
result = llListReplaceList(result, [llGetSubString(llList2String(result, i), 0, MAX_STRLEN - 1)], i, i);
}

return result;
}
string parser(string data, integer rule)
{
string l = llList2String(llParseStringKeepNulls(data, [separator], []), rule);

if(l)
{
return l;
}

else
{
return "~!|;";
}
}
insert_param(string variable, string parameter)
{
if(debug)
{
llOwnerSay("Altering Code...");
llSleep(1);
llOwnerSay("Altered Code Function " + variable + " With Parameter " + parameter + ".");
}

if(parameter == "TRUE")
{
parameter = "1";
}

else if(parameter == "FALSE")
{
parameter = "0";
}

integer n_parameter = (integer)parameter;

if(variable == "menu_timeout_wait")
{
menu_timeout_wait = n_parameter;
}

if(variable == "verbose")
{
verbose = n_parameter;
}

if(variable == "verb_lag")
{
verb_lag = n_parameter;
}

if(variable == "custom_channel")
{
custom_channel = n_parameter;
}

if(variable == "chan_limit")
{
chan_limit = n_parameter;
}

if(variable == "direct_customization")
{
direct_customization = n_parameter;
}

if(variable == "custom_note")
{
custom_note = n_parameter;
}

if(variable == "owner_only")
{
owner_only = n_parameter;
}

if(variable == "sub_search")
{
sub_search = n_parameter;
}

if(variable == "hover_text")
{
hover_text = n_parameter;
}

if(variable == "custom_start")
{
custom_start = n_parameter;
}

if(variable == "debug")
{
debug = n_parameter;
}

if(variable == "settings_notecard")
{
settings_notecard = parameter;
}

if(variable == "custom_text")
{
custom_text = parameter;
}

if(variable == "custom_dialog_text")
{
custom_dialog_text = parameter;
}

if(variable == "separator")
{
separator = parameter;
}

if(variable == "sub_separator")
{
sub_separator = parameter;
}

if(variable == "comment_char")
{
comment_char = parameter;
}

if(variable == "var_char")
{
var_char = parameter;
}
}
default
{
on_rez(integer start)
{
llWhisper(0, "Initalizing...\n\t\tLoading " + settings_notecard + " Notecard...");
llResetScript();
}

state_entry()
{
handle = 0;
if(hover_text)
{
llSetText("Loading...", <0,0,1>, 1);
}

if(custom_start && custom_text != "")
{
llOwnerSay(custom_text);
}

llSleep(1);

if(direct_customization)
{
jump here;
}

if(llGetInventoryType(settings_notecard) == -1)
{
if(custom_note == FALSE)
{
llOwnerSay("The Default Settings notecard was not found!");
}

if(sub_search)
{
if(custom_note == FALSE)
{
llOwnerSay("Searching object for a Secondary Settings notecard...");
}

if(llGetInventoryNumber(INVENTORY_NOTECARD))
{
settings_notecard = llGetInventoryName(INVENTORY_NOTECARD, 3);

if(custom_note == FALSE && settings_notecard != "")
{
llOwnerSay("Reading Secondary Settings notecard " + settings_notecard);
}

return;
}

llOwnerSay("No Secondary Settings notecard was not found!");
}

llSetText("ERROR...", <1,0,0>, 1);
llSetScriptState(llGetScriptName(), FALSE);
}

queryid = llGetNumberOfNotecardLines(settings_notecard);

@ here;

if(debug)
{
llOwnerSay((string)llGetFreeMemory() + ".");
}

if(hover_text)
{
llSetText("", <0,0,0>, 0);
}
}

touch_start(integer num)
{
llSetTimerEvent(menu_timeout_wait);
rchan = llRound(chan_limit * (llFrand(.9) + .1));

if(handle != -1)
{
integer i;

for(i = 0; i < num; i++)
{
llInstantMessage(llDetectedKey(i), "This Object Is Busy, Please Try Again.");
}

return;
}

if(owner_only && llDetectedKey(0) == llGetOwner())
{
current_user = llGetOwner();
handle = llListen(rchan, llKey2Name(llGetOwner()), llGetOwner(), "");
}

else
{
current_user = llDetectedKey(0);
handle = llListen(rchan, "", NULL_KEY, "");
}

llDialog(current_user, custom_dialog_text, compile_Buttons(buttons, list_index), rchan);
}

listen(integer c, string n, key id, string m)
{
llSetTimerEvent(0);
integer temp_int = llListFindList(buttons, [m]);
llListenRemove(handle);
handle = -1;

if(c == rchan)
{
if(m == "Previous")
{
list_index -= 11;

if(list_index < 0)
{
list_index = 0;
}

if(owner_only && llGetOwnerKey(id) == llGetOwner())
{
current_user = llGetOwner();
handle = llListen(rchan, llKey2Name(llGetOwner()), llGetOwner(), "");
}

else
{
current_user = llGetOwnerKey(id);
handle = llListen(rchan, "", NULL_KEY, "");
}


llDialog(current_user, custom_dialog_text, compile_Buttons(buttons, list_index), rchan);
}

if(m == "Next")
{
integer len = llGetListLength(buttons);
list_index = (list_index + 11);

if(list_index > len)
{
list_index = 0;
}

if(owner_only && llGetOwnerKey(id) == llGetOwner())
{
current_user = llGetOwner();
handle = llListen(rchan, llKey2Name(llGetOwner()), llGetOwner(), "");
}

else
{
current_user = llGetOwnerKey(id);
handle = llListen(rchan, "", NULL_KEY, "");
}

llDialog(current_user, custom_dialog_text, compile_Buttons(buttons, list_index), rchan);
}

else if(temp_int >= 0)
{
integer p;

list temp_str_list = llParseString2List(llList2String(chat, temp_int), [sub_separator], []);
list temp_obj_list = llParseString2List(llList2String(inventory, temp_int), [sub_separator], []);

integer str_len = llGetListLength(temp_str_list);
integer obj_len = llGetListLength(temp_obj_list);

for(p = 0; p < str_len; p++)
{
string temp_str = llList2String(temp_str_list, p);
llSleep(verb_lag - 0.5);

if(temp_str == "~!|;" || temp_str == "")
{
jump overhere;
}

if(verbose == 0)
{
llWhisper(custom_channel, temp_str);
}

if(verbose == 2)
{
llShout(custom_channel, temp_str);
}

if(verbose == 3)
{
llRegionSay(custom_channel, temp_str);
}

else //Just in case you 'somehow' make a mistake, End User
{
if(debug && verbose != 1)
{
llOwnerSay("You have entered an incorrect parameter for the \"verbose\" variable, switching to default...");
}

llSay(custom_channel, temp_str);
}

@ overhere;
}

for(p = 0; p < obj_len; p++)
{
string temp_obj = llList2String(temp_obj_list, p);

if(llGetInventoryType(temp_obj) != -1)
{
llGiveInventory(current_user, temp_obj);
}

else if(debug && temp_obj != "~!|;")
{
llOwnerSay("It seems that inventory item " + temp_obj + " does not exist. Please contact the object creator for support.");
}
}
}
}

current_user = "";
}

timer()
{
llSetTimerEvent(0);
llListenRemove(handle);

if(debug)
{
llOwnerSay("Listen Timed Out!");
}

current_user = "";
}

dataserver(key id, string data)
{
data = llStringTrim(data, STRING_TRIM);

if(line == -1)
{
integer cap = (integer)data;

if(cap > 250)
{
llOwnerSay("The specified Configuration Notecard contains too many entries, please specify a new Settings notecard, or try again.");
}

else
{
for(line = 0; line <= cap; line++)
{
queryid = llGetNotecardLine(settings_notecard, line);
}
}
}

else if(line != -1)
{
if(data != EOF && data != EOL && !data_cap)
{
if(data != "" && llGetSubString(data, 0, 0) != comment_char)
{
if(llGetSubString(data, 0, 0) == var_char) //$[hover_text = FALSE]
{
data = llDeleteSubString(data, 0, 0);
list l = llParseString2List(data, [" = "], []);
string var = llList2String(l, 0);
string param = llList2String(l, 1);
insert_param(var, param);
}

else
{
buttons = (buttons=[]) + buttons + parser(data, 0);
chat = (chat=[]) + chat + parser(data, 1);
inventory = (inventory=[]) + inventory + parser(data, 2);
}
}
}

else if(!data_cap)
{
llOwnerSay("Ready. >");
handle = -1;
data_cap = TRUE;
}
}
}

changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llOwnerSay("Change Detected. Resetting Script...");
llResetScript();
}
}
}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-06-2007 00:38
heh might want to change that last PHP to /PHP
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Daten Thielt
Registered User
Join date: 1 Dec 2006
Posts: 104
11-06-2007 07:40
wouldent matter, BBcode has been disabled untill linden labs feels its a high priority update
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
11-06-2007 08:03
From: Daten Thielt
wouldent matter


Matters to those of us who use Strife's BBCode Emulation in greasemonkey (see /327/b2/188445/1.html) and also for compatibility should LL ever fix the forums.
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Tre Giles
Registered User
Join date: 16 Dec 2005
Posts: 294
11-06-2007 12:47
From: Void Singer
heh might want to change that last PHP to /PHP


Thx!
Tre Giles
Registered User
Join date: 16 Dec 2005
Posts: 294
11-06-2007 12:50
When LL finally does fix the forums (I'll bet you 20L on "a year";) we wouldn't want a whole generation of unreadable & broken tags floating around everywhere ;)

Imagine the casualties!

From: Void Singer
heh might want to change that last PHP to /PHP


Thx!