// "00-MagnaMural Main Script" // // by Apollia Pirandello // // Free, public domain, open source. May be used and modified // for any purpose, including commercial purposes. // // If you like it, or even if you don't, I welcome donations of // any size. // // MagnaMural Home Page, with manual and scripts: // http://magnamural.astroblahhh.com/ //*******Start of constants you might like to change. string MagnaMuralReady="MagnaMural ready! "; //string MagnaMuralReady="."; // Used only twice, but, might as well save some // memory. Memory is scarce in LSL scripts. integer seconds_to_listen=600; //How long the MagnaMural listens for commands. //Shuts down automatically after this amount of //time if it's not clicked and it hears no //chat from the owner. //You can uncomment this, along with the "mem" command way //below, for debugging purposes: integer memory_left; string scriptname="Main: "; //******************* End of constants you might like to change. //******* Start of generic variables, used for multiple purposes //******* in multiple places throughout the script: string allpurpose_string_A; string allpurpose_string_B; string allpurpose_string_C; integer x; integer y; integer z; integer inc; float float_x; vector vec; key allpurpose_key; //******************** End of generic variables. //******* Start of listen stuff. integer silent_channel=-1; //This is initially -1, and must stay this way, since //it's used as a clue to the script that the MagnaMural //was just rezzed or reset. integer silent_listen_handle; integer audible_listen_handle; integer listening_to_silent_channel; integer listening_to_audible_channel; //******************** End of listen stuff. //******* Start of command parser stuff. //These next several variables aren't even used until it has //been found that the user didn't enter a recognized one-word //command. string command; string arg1; string arg2; string arg3; integer number_of_arguments; list input; //These just make the code a bit more readable. If memory is //_really_ scarce, they can be done without, at the cost of //easy human readability. integer MAIN_PROMPT_MODE=1; integer RESIZE_MODE=2; integer TEXTCOLOR_MODE=3; integer CHANNEL_MODE=4; integer FREEFORM_MODE=5; integer DELETE_MODE=6; //The different prompt modes cause the script to behave //differently when going through the listen event. For instance, //in Resize mode, saying numbers will cause the MagnaMural to be //resized, instead of what it does in Main Prompt Mode, which is //to go to the texture which is the number you stated. integer prompt_mode; integer orig_prompt_mode=MAIN_PROMPT_MODE; //This notes which prompt mode the MagnaMural was in //previously, so if the MagnaMural is put temporarily //into a different prompt mode, it can get back to the //original one when it's done. integer execute_command=FALSE; integer do_subaction; //In the prompt modes, if the user typed in the wrong //arguments, then, these variables stop the whatever //that prompt mode is supposed to do from being //carried out. integer return_to_default_state=TRUE; //Set to true when the MagnaMural is supposed to return //to the default state, such as when the user issues //the command "off". integer ARGS_ALREADY_DETERMINED=FALSE; //Indicates a command where in the process of finding //out the command being used, some arguments were found //as well, so, the upcoming prompt mode code shouldn't //run its own code to get the arguments. //******************** End of command parser stuff. //******* Start of variables involved in resizing the MagnaMural. //Five variables to make the code more readable, but which //could be sacrificed if memory is really scarce. integer SQUARE=0; integer SCREENSHOT=1; integer LONG_RECTANGLE=2; integer FREEFORM=3; integer NOT_YET_SET=4; integer shape_mode=NOT_YET_SET; //These are used in the process of calculating what the //size and position of the prims of the MagnaMural //should be. float float_intended_panel_width; float float_intended_panel_height; vector vector_intended_panel_size; float float_intended_full_width; float float_intended_full_height; float float_neg_panel_height; integer silent_resize=FALSE; //If false, prevents the text "Resized to " (size) being //displayed to the user. //******************** End of variables involved in resizing the // MagnaMural. //******* Start of variables related to changing the texture on //******* display. integer num_of_textures; //The number of textures in the //MagnaMural. //Five more variables to make the code more readable, but //they could be done without if memory is scarce. integer STEPBACK=-3; integer RANDOM=-2; integer FORWARD=1; integer BACKWARD=-1; integer GOTO=5; integer where_to_go; integer current_texture_number=-1; integer next_texture_number; integer most_recent_increment=0; integer most_recent_texture_number=-1; integer selected_goto_number; integer display_num; //The texture number which is displayed to the user. //Internally, textures are numbered from 0 to whatever, //but in the output, they're numbered from 1 to //whatever, so the display_num is the internal texture //number +1. All the other variables are in the //internal format (0 to whatever). //******************** End of variables related to changing the // texture on display. //******* Start of variables related to the floating text. string hovertext; vector textcolor=<1,1,0>; integer display_hovertext=FALSE; float OPAQUE=1; //******************** End of variables related to the floating // text. //******* Start of variables related to clicks/touches. integer touched_panel; integer is_this_permitted; integer lock_mode=FALSE; //*************************** End of variables related to // clicks/touches. //*******Start of last few miscellaneous variables. key owner_key; //Not only used for the owner key, but also used in //any llMessageLinked commands instead of NULL_KEY. // //I have no idea why, but using this in place of NULL_KEY //saves a staggering amount of memory (like 2700 bytes //in this script). Just change all the llMessageLinked //owner_keys to NULL_KEY, and uncomment the stuff that //tells you how much memory is being used, and you'll see //what I mean (if the script didn't crash already). // //So, if you want to save some memory in your scripts, //it may be a good idea to cut down on the use of NULL_KEY. //I don't use NULL_KEY at all in this script. // //By the way, changing blank_string in llMessageLinked //commands to owner_key doesn't do any good, memory-wise, //and nor does changing owner_key to blank_string. For //some mysterious reason, this is the best configuration, //as far as memory is concerned. integer delete_texture_number; //Used by the command to delete textures. string blank_string=" "; //Used in the llMessageLinked commands. //******************** End of last few miscellaneous variables. integer PrintList() //Outputs a list of all textures contained in the //MagnaMural for the user. { llMessageLinked(2,88,blank_string,owner_key); //"Listing all textures inside:"; for (x=0;x1) { next_texture_number=most_recent_texture_number; llMessageLinked(2,28,blank_string,owner_key); //"Going back to most recent previously-displayed texture."; } else { llMessageLinked(2,25,(string)most_recent_increment,owner_key); //"The script was recently reset, so the Most Recent feature //isn't functioning yet. Please browse //"+(string)num_to_browse+" other " texture(s). return 1; } } if (where_to_go==GOTO) { next_texture_number=selected_goto_number; } if (next_texture_number>=num_of_textures) { next_texture_number=0; } if (next_texture_number<0) { next_texture_number=num_of_textures-1; } most_recent_increment++; if (most_recent_increment>8) { most_recent_increment=2; } allpurpose_string_A=llGetInventoryName(INVENTORY_TEXTURE,next_texture_number); llSetLinkTexture(LINK_SET,allpurpose_string_A,ALL_SIDES); most_recent_texture_number=current_texture_number; current_texture_number=next_texture_number; if (display_hovertext==TRUE) { SetHovertext(); } return 1; } integer SetHovertext() { allpurpose_string_A=llGetTexture(0); if (current_texture_number==-1) { hovertext=MagnaMuralReady+(string)num_of_textures+" textures inside. Current texture: "+allpurpose_string_A; } else { display_num=current_texture_number+1; hovertext="#"+(string)display_num+" of "+(string)num_of_textures+": "+allpurpose_string_A; } llSetText(hovertext,textcolor,OPAQUE); return 1; } integer PanelAction(integer touched_panel) { //Clicks by the owner on the MagnaMural cause //this function to be called, if the MagnaMural //is not in Locked Mode. if (touched_panel==1) { GoToTexture(FORWARD); } if (touched_panel==4) { GoToTexture(RANDOM); } if (touched_panel==2) { GoToTexture(BACKWARD); } if (touched_panel==3) { llMessageLinked(2,500,blank_string,owner_key); //The Messager script shows the blue menu dialog to the user. } return 1; } string CurrentSize() //Returns a string containing the current width and height //in meters. { vec=llGetScale(); float_intended_panel_width=(vec.x)*2; float_intended_panel_height=(vec.z)*2; allpurpose_string_C=(string)float_intended_panel_width+" m x "+(string)float_intended_panel_height+" m"; return allpurpose_string_C; } integer Resize() { float_intended_panel_width=float_intended_full_width/2; if (shape_mode==SQUARE) { float_intended_panel_height=float_intended_panel_width; } if (shape_mode==LONG_RECTANGLE) { float_intended_panel_height=float_intended_panel_width/2; } if (shape_mode==SCREENSHOT) { float_intended_panel_height=float_intended_panel_width*.75; } if (shape_mode==FREEFORM) { float_intended_panel_height=float_intended_full_height/2; } vector_intended_panel_size=; llSetScale(vector_intended_panel_size); float_neg_panel_height=0-float_intended_panel_height; vec=; llMessageLinked(2,42,(string)vec,owner_key); //Prim 2 silently repositions itself. vec=; llMessageLinked(3,42,(string)vec,owner_key); //Prim 3 silently repositions itself. vec=<0,0,float_neg_panel_height>; llMessageLinked(4,42,(string)vec,owner_key); //Prim 4 silently repositions itself. llMessageLinked(2,41,(string)vector_intended_panel_size,owner_key); llMessageLinked(3,41,(string)vector_intended_panel_size,owner_key); llMessageLinked(4,41,(string)vector_intended_panel_size,owner_key); //Prims 2, 3 and 4 silently resize themselves. if (silent_resize==FALSE) { allpurpose_string_A=CurrentSize(); llMessageLinked(2,62,allpurpose_string_A,owner_key); //"Resized to "+str+"." } silent_resize=FALSE; return 1; } //The MagnaMural enters the default state at these times: // //a) whenever it is rezzed // //b) whenever it is reset // //c) whenever the owner issues the command "off" // //d) if the number of seconds in the variable seconds_to_listen has //passed without the owner saying anything in the presence of the //MagnaMural, and without the owner clicking the MagnaMural at all. default { state_entry() { num_of_textures=llGetInventoryNumber(INVENTORY_TEXTURE); owner_key=llGetOwner(); if (display_hovertext==FALSE) { llSetText("",textcolor,OPAQUE); } else { SetHovertext(); } if (silent_channel==-1) //This means the MagnaMural was just rezzed or reset. //So, we retrieve the silent chat channel from the name //of the Messager prim, prim 2. { allpurpose_string_A=llGetLinkName(2); //Should be something like "MagnaMural (9)". allpurpose_string_A=llDeleteSubString(allpurpose_string_A,0,11); //Removes the text up to and including the left parenthesis. allpurpose_string_A=llDeleteSubString(allpurpose_string_A,-1,1); //Deletes the parenthesis on the right of the string, //leaving behind only the silent chat channel number. silent_channel=(integer)allpurpose_string_A; llMessageLinked(2,400,(string)silent_channel,owner_key); //This just lets the Messager script know what the //current silent chat channel is. llOwnerSay(MagnaMuralReady); //Uncomment if you want the amount of memory to be //announced when the MagnaMuarl script starts. //memory_left=llGetFreeMemory(); //llOwnerSay(scriptname+(string)memory_left); } } on_rez(integer start_param) { silent_channel=-1; state restart_default; } changed(integer change) { if (change==CHANGED_INVENTORY) { //If anything is changed about this prim's inventory, //then, the number of textures is updated in the hovertext, //provided hovertext is on. num_of_textures=llGetInventoryNumber(INVENTORY_TEXTURE); if (display_hovertext==TRUE) { SetHovertext(); } } } touch_start(integer total_number) { touched_panel=llDetectedLinkNumber(0); //Gets which prim was clicked/touched. allpurpose_key=llDetectedKey(0); //Gets the key of who clicked/touched it. //Clicks from anyone besides the owner are ignored. if (allpurpose_key==owner_key) { if (lock_mode==FALSE || touched_panel==3) { //However, if the MagnaMural is in Locked Mode, then, even the //owner's clicks/touches are ignored, unless the owner happened //to click panel 3. //If Locked Mode is false or the owner clicked panel 3, then the //MagnaMural goes to the "awake" state, where it listens for the //owner's commands. PanelAction(touched_panel); state awake; } } } } //This is used whenever the MagnaMural is rezzed in the default state //to restart the default state: state restart_default { state_entry() { state default; } } //And the same thing for the awake state: state restart_awake { state_entry() { state awake; } } //The state where the MagnaMural listens for the owner's commands. //This state can be left in several ways: // //a) If the owner says the command "off", or the command "reset script". // //b) If the number of seconds "seconds_to_listen" passes without the //owner either clicking the MagnaMural, or saying any chat in the //MagnaMural's presence. // //c) If the MagnaMural has just been rezzed from inventory. // //d) Or, if the script is reset in some other way. // //In each case, the MagnaMural will return to the default state. state awake { state_entry() { num_of_textures=llGetInventoryNumber(INVENTORY_TEXTURE); silent_listen_handle=llListen(silent_channel,"",owner_key,""); listening_to_silent_channel=TRUE; audible_listen_handle=llListen(0,"",owner_key,""); listening_to_audible_channel=TRUE; prompt_mode=MAIN_PROMPT_MODE; llSetTimerEvent(seconds_to_listen); } on_rez(integer start_param) //If the MagnaMural has just been rezzed, we //go back to the default state to do some setting up. { silent_channel=-1; state default; } changed(integer change) { if (change==CHANGED_INVENTORY) { llSetTimerEvent(seconds_to_listen); num_of_textures=llGetInventoryNumber(INVENTORY_TEXTURE); if (display_hovertext==TRUE) { SetHovertext(); } } } touch_start(integer total_number) { touched_panel=llDetectedLinkNumber(0); allpurpose_key=llDetectedKey(0); if (allpurpose_key==owner_key) { if (lock_mode==FALSE || touched_panel==3) { PanelAction(touched_panel); if (listening_to_silent_channel==FALSE ) { state restart_awake; } } } } timer() { llSetTimerEvent(0); llMessageLinked(2,16,blank_string,owner_key); //"Command prompt mode timed out."; llMessageLinked(2,74,blank_string,owner_key); //"No longer listening for commands."; state default; //A state change automatically ends any open Listens. } listen(integer channel, string name, key id, string message) { return_to_default_state=FALSE; llSetTimerEvent(seconds_to_listen); if (prompt_mode==DELETE_MODE) { prompt_mode=MAIN_PROMPT_MODE; if (message=="y") { delete_texture_number=current_texture_number; allpurpose_string_C=llGetInventoryName(INVENTORY_TEXTURE,delete_texture_number); llRemoveInventory(allpurpose_string_C); delete_texture_number++; //Incremented so the proper number is displayed to //the user. allpurpose_string_C=(string)delete_texture_number+", "+allpurpose_string_C; llMessageLinked(2,84,allpurpose_string_C,owner_key); //"Deleted former texture #"+str+"."; num_of_textures=llGetInventoryNumber(INVENTORY_TEXTURE); GoToTexture(BACKWARD); jump EndOfListenLoopTdelEnd; } else { llMessageLinked(2,1000,blank_string,owner_key); //"Aborted texture delete."; } } if (prompt_mode==MAIN_PROMPT_MODE) //Then, we'll first check to see if the user entered //just a texture number to go to. { integer cur_num=(integer)message; if (cur_num==0) { if (message=="0") //If the user literally typed in 0, we display an //error message. { llMessageLinked(2,18,(string)num_of_textures,owner_key); //"Please say a number higher than 0 and lower than //or equal to "+max_textures+", the number of textures in this object."; } else //Every non-numerical command the user types in equates to the value 0, //so, if they didn't literally type in "0" we continue checking to see //if the user typed in a command which is recognized. { jump Continue; } } if (cur_num>num_of_textures) { llMessageLinked(2,17,(string)num_of_textures,owner_key); //"There are only "+max_textures+" textures in this //object. Please say a lower number, from 1 to //"+max_textures+"."; } if (cur_num<0) { llMessageLinked(2,18,(string)num_of_textures,owner_key); //"Please say a number higher than 0 and lower than //or equal to "+max_textures+", the number of //textures in this object."; } if (cur_num>=1 && cur_num<=num_of_textures) { selected_goto_number=cur_num-1; GoToTexture(GOTO); } jump EndOfListenLoopMainPromptMode; } @Continue; if (message=="y") { llMessageLinked(2,1002,blank_string,owner_key); //"If you wish to delete a texture, please say 'tdel'."; jump EndOfListenLoopY; } else if (message=="x") { if (prompt_mode==RESIZE_MODE || prompt_mode==FREEFORM_MODE) { llMessageLinked(2,65,blank_string,owner_key); //"Exiting Resize Mode." } else if (prompt_mode==TEXTCOLOR_MODE) { llMessageLinked(2,64,blank_string,owner_key); //"Exiting Text Color Change Mode." } else if (prompt_mode==CHANNEL_MODE) { llMessageLinked(2,68,blank_string,owner_key); //"Exiting Silent Chat Channel Select Mode. } else if (prompt_mode==MAIN_PROMPT_MODE) { llMessageLinked(2,76,blank_string,owner_key); //"Already in main command prompt mode." } prompt_mode=MAIN_PROMPT_MODE; jump EndOfListenLoopX; } else if (message=="ph") //Phantom. { llSetStatus(STATUS_PHANTOM,TRUE); llMessageLinked(2,96,blank_string,owner_key); //"Now in Phantom Mode."; jump EndOfListenLoopPhantom; } else if (message=="so") //Solid Mode. { llSetStatus(STATUS_PHANTOM,FALSE); llMessageLinked(2,97,blank_string,owner_key); //"Now in Solid Mode."; jump EndOfListenLoopSolid; } else if (message=="hi") //Hide - Invisible Mode. { llSetLinkAlpha(LINK_SET,0,ALL_SIDES); llMessageLinked(2,94,blank_string,owner_key); //"Now in Invisible Mode."; jump EndOfListenLoopHide; } else if (message=="sh") //Show - Visible Mode. { llSetLinkAlpha(LINK_SET,1,ALL_SIDES); llMessageLinked(2,95,blank_string,owner_key); //"Now in Visible Mode."; jump EndOfListenLoopShow; } else if (message=="br") //Brief Mode. { llMessageLinked(2,90,blank_string,owner_key); //The Messager script silently sets brief_mode to TRUE. llMessageLinked(2,92,blank_string,owner_key); //"Now in Brief Mode."; jump EndOfListenLoopBrief; } else if (message=="ve") //Verbose Mode; { llMessageLinked(2,91,blank_string,owner_key); //The Messager script silently sets brief_mode to FALSE. llMessageLinked(2,93,blank_string,owner_key); //"Now in Verbose Mode."; jump EndOfListenLoopVerbose; } else if (message=="HELP" || message=="help" || message=="h") { llMessageLinked(2,29,blank_string,owner_key); //"You should receive the manual notecard momentarily." //The Messager script also gives the user the Manual notecard. jump EndOfListenLoopHelp; } else if (message=="u") //Moves the MagnaMural up 1 meter. { vec=llGetPos(); vec=; llSetPos(vec); jump EndOfListenLoopU; } else if (message=="j") //Moves the MagnaMural down 1 meter. { vec=llGetPos(); vec=; llSetPos(vec); jump EndOfListenLoopJ; } else if (message=="gest") { llMessageLinked(2,777,blank_string,owner_key); //"You should receive a folder titled "+foldertitle+" //momentarily." //The Messager script then gives the user gestures //which can control the MagnaMural. jump EndOfListenLoopGest; } //Uncomment this if you want to be able to give the command "mem" to //see how much memory is being used. // // else if (message=="mem") // { memory_left=llGetFreeMemory(); // llOwnerSay(scriptname+(string)memory_left); // jump EndOfListenLoopMem; // } else if (message=="off") { llMessageLinked(2,74,blank_string,owner_key); //"No longer listening for commands."; return_to_default_state=TRUE; jump EndOfListenLoopOff; } else if (message=="COMMANDS" || message=="commands" || message=="co") { llMessageLinked(2,81,blank_string,owner_key); //"You should receive the commands summary notecard //momentarily." //The Messager script then gives the commands summary //notecard to the user. jump EndOfListenLoopCommands; } else if (message=="BACK") { llMessageLinked(2,500,blank_string,owner_key); //The Messager script presents the user with the main blue dialog menu. jump EndOfListenLoopBack; } else if (message=="f") { GoToTexture(FORWARD); jump EndOfListenLoopForward; } else if (message=="d") { GoToTexture(BACKWARD); jump EndOfListenLoopBackward; } else if (message=="r") { GoToTexture(RANDOM); jump EndOfListenLoopRandom; } else if (message=="MORE") { llMessageLinked(2,501,blank_string,owner_key); //The Messager script presents the user with the //second blue dialog menu. jump EndOfListenLoopMore; } else if (message=="HOME PAGE" || message=="www") { llLoadURL(owner_key, "MagnaMural Home at Astroblahhh.Com", "http://magnamural.astroblahhh.com/"); jump EndOfListenLoopWww; } else if (message=="LIST" || message=="list") { num_of_textures=llGetInventoryNumber(INVENTORY_TEXTURE); PrintList(); jump EndOfListenLoopList; } else if (message=="lo") //Locked Mode. { lock_mode=TRUE; llMessageLinked(2,13,blank_string,owner_key); //"Now in Locked Mode."; jump EndOfListenLoopLock; } else if (message=="ul") //Unlocked Mode. { lock_mode=FALSE; llMessageLinked(2,14,blank_string,owner_key); //"Now in Unlocked Mode."; jump EndOfListenLoopUnlock; } else if (message=="reset script") { llMessageLinked(2,56,blank_string,owner_key); //"Resetting script..."; llResetScript(); jump EndOfListenLoopReset; } else if (message=="LOCK/UNLOCK") { if (lock_mode==FALSE) { y=TRUE; llMessageLinked(2,13,blank_string,owner_key); //"Now in Locked Mode."; } else { y=FALSE; llMessageLinked(2,14,blank_string,owner_key); //"Now in Unlocked Mode."; } lock_mode=y; jump EndOfListenLoopLockUnlock; } else if (message=="k") { allpurpose_string_A=llGetTexture(0); allpurpose_key=llGetInventoryKey(allpurpose_string_A); llMessageLinked(2,79,(string)allpurpose_key,owner_key); //The Messager script just displays the texture's //UUID key. jump EndOfListenLoopKey; } else if (message=="NAME/NUM" || message=="name" || message=="n" || message=="sn" || message=="hn") { if (message=="NAME/NUM" || message=="name" || message=="n") { if (display_hovertext==FALSE) { display_hovertext=TRUE; } else { display_hovertext=FALSE; } } if (message=="sn") { display_hovertext=TRUE; } if (message=="hn") { display_hovertext=FALSE; } if (display_hovertext==TRUE) { SetHovertext(); llMessageLinked(2,26,blank_string,owner_key); //"Now displaying name and number of texture above Panel 2."; } if (display_hovertext==FALSE) { llSetText("",textcolor,OPAQUE); llMessageLinked(2,27,blank_string,owner_key); //"No longer displaying name and number of texture above Panel 2."; } jump EndOfListenLoopName; } else if (message=="e") { GoToTexture(FORWARD); GoToTexture(BACKWARD); jump EndOfListenLoopReload; } else if (message=="size" || message=="s") { allpurpose_string_A=CurrentSize(); llMessageLinked(2,75,allpurpose_string_A,owner_key); //"Current size is "+str+"." } else if (message=="MOST RECENT" || message=="v" || message=="m") { GoToTexture(STEPBACK); jump EndOfListenLoopRecent; } else if (message=="GIVE TEXTURE" || message=="g") { llMessageLinked(2,30,blank_string,owner_key); //"You should receive the displayed texture momentarily."; allpurpose_string_A=llGetTexture(0); llGiveInventory(owner_key,allpurpose_string_A); jump EndOfListenLoopGive; } else if (message=="DONATE" || message=="donate" || message=="do") { llLoadURL(owner_key, "Info on Donating to Apollia Pirandello", "http://astroblahhh.com/donations.shtml"); jump EndOfListenLoopDonate; } else if (message=="tdel") { delete_texture_number=current_texture_number; if (delete_texture_number==-1) { llMessageLinked(2,83,blank_string,owner_key); //"The script was recently reset, so the texture delete //function won't be available until you've browsed another texture."; } else if (num_of_textures==1) { llMessageLinked(2,87,blank_string,owner_key); //"Cannot delete - this is the last texture left in the MagnaMural."; } else { prompt_mode=DELETE_MODE; llMessageLinked(2,1001,blank_string,owner_key); //"Are you sure you want to delete this texture? If so, say 'y'. //If not, say 'n' or anything else."; } jump EndOfListenLoopTdelStart; } ARGS_ALREADY_DETERMINED=FALSE; input=[]; float_x=(float)message; if (float_x==0) { message=llGetSubString(message, 0,40); input=llParseString2List(message,[" ", "x", ","],[]); message=llList2String(input,0); number_of_arguments=(llGetListLength(input))-1; //llOwnerSay((string)number_of_arguments); if (number_of_arguments>0) { ARGS_ALREADY_DETERMINED=TRUE; } } if (message=="RESIZE" || message=="resize" || message=="rs" || message=="TEXT COLOR" || message=="co" || message=="color" || message=="col" || message=="ch" || message=="chan" || message=="CHANNEL" || message=="channel" || message=="FREEFORM" || message=="ff") { if (message=="FREEFORM" || message=="ff") { prompt_mode=FREEFORM_MODE; if (shape_mode!=FREEFORM) { shape_mode=FREEFORM; llMessageLinked(2,46,blank_string,owner_key); //"Now in Freeform Shape Mode." } if (ARGS_ALREADY_DETERMINED==FALSE) { orig_prompt_mode=prompt_mode; allpurpose_string_A=CurrentSize(); //We send the current size to the Messager script so it //will be printed in the message displayed to the user. llMessageLinked(2,57,allpurpose_string_A,owner_key); //"Please say the width and height in meters you want the // MagnaMural to be, in the format '3 x 4.5' or '5x8' or '8 12'. // The current size is "+str+". To exit Resize Mode, please say 'x'." } } else if (message=="ch" || message=="CHANNEL" || message=="chan" || message=="channel") { prompt_mode=CHANNEL_MODE; if (ARGS_ALREADY_DETERMINED==FALSE) { orig_prompt_mode=prompt_mode; //We send the current silent chat channel number to the Messager //script so it will be printed in the message displayed to the user. llMessageLinked(2,70,(string)silent_channel,owner_key); //"Please say what number you'd like the silent chat //channel to be. Currently using channel "+str+". //To exit Silent Chat Channel Select Mode, please say 'x'."; } } else if (message=="RESIZE" || message=="resize" || message=="rs") { if (shape_mode==NOT_YET_SET) //...then we find out what the current shape //mode is, based on the MagnaMural's current //dimensions. { vec=llGetScale(); if (vec.x==vec.z) { shape_mode=SQUARE; } else if (vec.x==((vec.z)*2)) { shape_mode=LONG_RECTANGLE; } else if ((vec.z/vec.x)==.75) { shape_mode=SCREENSHOT; } else { shape_mode=FREEFORM; } } //Then, if the user supplied no arguments, we prepare a string to be //included in the message that will be displayed to the user. It //will contain the MagnaMural's current size and shape mode. if (ARGS_ALREADY_DETERMINED==FALSE) { allpurpose_string_A=CurrentSize(); if (shape_mode==SQUARE) { allpurpose_string_B="Square Shape"; } else if (shape_mode==LONG_RECTANGLE) { allpurpose_string_B="Long Rectangle Shape"; } else if (shape_mode==SCREENSHOT) { allpurpose_string_B="Screenshot Shape"; } else if (shape_mode==FREEFORM) { allpurpose_string_B="Freeform Shape"; } allpurpose_string_A=allpurpose_string_A+". Currently in "+allpurpose_string_B; } if (shape_mode==FREEFORM) { prompt_mode=FREEFORM_MODE; if (ARGS_ALREADY_DETERMINED==FALSE) { orig_prompt_mode=prompt_mode; llMessageLinked(2,57,allpurpose_string_A,owner_key); //"Please say the width and height in meters you want the //MagnaMural to be, in the format '3 x 4.5' or '5x8' or '8 12'. //The current size is "+str+". To exit Resize Mode, please say 'x'." } } else { prompt_mode=RESIZE_MODE; if (ARGS_ALREADY_DETERMINED==FALSE) { orig_prompt_mode=prompt_mode; llMessageLinked(2,33,allpurpose_string_A,owner_key); //"Please say how many meters wide you want the MagnaMural to be. //The current size is "+str+". To exit Resize Mode, please say 'x'." } } } else if (message=="TEXT COLOR" || message=="co" || message=="col" || message=="color") { prompt_mode=TEXTCOLOR_MODE; if (ARGS_ALREADY_DETERMINED==FALSE) { orig_prompt_mode=prompt_mode; //We get the current text color so we can display it in the message //given to the user. vec=textcolor*255; x=(integer)vec.x; y=(integer)vec.y; z=(integer)vec.z; allpurpose_string_A=(string)x+" "+(string)y+" "+(string)z; llMessageLinked(2,73,allpurpose_string_A,owner_key); //"Please say the text color you'd like in RGB (Red Green Blue) //format, three numbers from 0 to 255. '255 255 255' = white, '0 //0 0' = black. The current text color is "+str+". To exit Text //Color Change Mode, please say 'x'." } } } if (message=="SQUARE" || message=="sq" || message=="SCREENSHOT" || message=="ss" || message=="LONG RECTANGLE" || message=="lr") { if (message=="SQUARE" || message=="sq") { if (shape_mode!=SQUARE) { shape_mode=SQUARE; llMessageLinked(2,43,blank_string,owner_key); //"Now in Square Shape." } } else if (message=="SCREENSHOT" || message=="ss") { if (shape_mode!=SCREENSHOT) { shape_mode=SCREENSHOT; llMessageLinked(2,44,blank_string,owner_key); //"Now in Screenshot Shape." } } else if (message=="LONG RECTANGLE" || message=="lr") { if (shape_mode!=LONG_RECTANGLE) { shape_mode=LONG_RECTANGLE; llMessageLinked(2,45,blank_string,owner_key); //"Now in Long Rectangle Shape."; } } silent_resize=TRUE; vec=llGetScale(); float_intended_full_width=(vec.x)*2; Resize(); prompt_mode=RESIZE_MODE; if (ARGS_ALREADY_DETERMINED==FALSE) { orig_prompt_mode=prompt_mode; //Then, we get the MagnaMural's current size so we can mention it in the //message given to the user. allpurpose_string_A=CurrentSize(); llMessageLinked(2,33,allpurpose_string_A,owner_key); //"Please say how many meters wide you want the MagnaMural to be. //The current size is "+str+". To exit Resize Mode, please say 'x'."; } } if (prompt_mode==RESIZE_MODE) { if (ARGS_ALREADY_DETERMINED==TRUE) { float_intended_full_width=llList2Float(input,1); message=llList2String(input,1); } else { float_intended_full_width=(float)message; } execute_command=TRUE; if (float_intended_full_width!=0) { if (float_intended_full_width<0.04) //Then the user named a width which is too small. { llMessageLinked(2,38,blank_string,owner_key); //"Please name a length greater than or equal to 0.04 m." execute_command=FALSE; } if (float_intended_full_width>20) { llMessageLinked(2,37,blank_string,owner_key); //"You named a length higher than 20 m, the maximum length, so, //automatically setting the length to 20 m."; float_intended_full_width=20; } } if (float_intended_full_width==0) { if (message=="0") { llMessageLinked(2,38,blank_string,owner_key); //"Please name a length greater than or equal to 0.04 m." } execute_command=FALSE; } if (execute_command==TRUE) { Resize(); } prompt_mode=orig_prompt_mode; } if (prompt_mode==FREEFORM_MODE) { execute_command=TRUE; if (ARGS_ALREADY_DETERMINED==TRUE) { inc=1; } else { inc=0; message=llGetSubString(message, 0,25); input=llParseString2List(message, ["x", " ", ","], [] ); } float_intended_full_width=0; float_intended_full_height=0; allpurpose_string_A=""; allpurpose_string_B=""; float_intended_full_width=llList2Float(input,0+inc); float_intended_full_height=llList2Float(input,1+inc); allpurpose_string_A=llList2String(input,0+inc); allpurpose_string_B=llList2String(input,1+inc); if (float_intended_full_height==0 && allpurpose_string_B!="0") { float_intended_full_height=-99872; } if (float_intended_full_width!=0 && float_intended_full_height!=0) { if (float_intended_full_height!=-99872) { if (float_intended_full_width<0.04 || float_intended_full_height<0.04) { llMessageLinked(2,38,blank_string,owner_key); //"Please name a length greater than or equal to 0.04 m."; execute_command=FALSE; } if (float_intended_full_width>20 || float_intended_full_height>20) { llMessageLinked(2,37,blank_string,owner_key); //"You named a length higher than 20 m, the maximum //length, so, automatically setting the length to 20 m." if (float_intended_full_width>20) { float_intended_full_width=20; } if (float_intended_full_height>20) { float_intended_full_height=20; } } } if (float_intended_full_height==-99872) { llMessageLinked(2,69,blank_string,owner_key); //"A second value is required in order to resize the MagnaMural //when it's in Freeform Shape."; execute_command=FALSE; } } if (float_intended_full_width==0 || float_intended_full_height==0) { if (allpurpose_string_A=="0" || allpurpose_string_B=="0") { llMessageLinked(2,38,blank_string,owner_key); //"Please name a length greater than or equal to 0.04 m."; } execute_command=FALSE; } if (execute_command==TRUE) { Resize(); } prompt_mode=orig_prompt_mode; } if (prompt_mode==TEXTCOLOR_MODE) { execute_command=TRUE; do_subaction=FALSE; if (ARGS_ALREADY_DETERMINED==TRUE) { inc=1; } else { inc=0; message=llGetSubString(message, 0,12); input=llParseString2List(message,[" ",","],[]); } x=0; y=0; z=0; x=llList2Integer(input,0+inc); y=llList2Integer(input,1+inc); z=llList2Integer(input,2+inc); allpurpose_string_A=""; allpurpose_string_B=""; allpurpose_string_C=""; allpurpose_string_A=llList2String(input,0+inc); allpurpose_string_B=llList2String(input,1+inc); allpurpose_string_C=llList2String(input,2+inc); if ( (x!=0 || (x==0 && allpurpose_string_A=="0")) && (y!=0 || (y==0 && allpurpose_string_B=="0")) && (z!=0 || (z==0 && allpurpose_string_C=="0")) ) { if (x>255 || y>255 || z>255 || x<0 || y<0 || z<0) { if (x>255 || y>255 || z>255) { llMessageLinked(2,60,blank_string,owner_key); //"You input a value higher than 255, so, automatically //setting it to 255."; if (x>255) { x=255; allpurpose_string_A="255"; } if (y>255) { y=255; allpurpose_string_B="255"; } if (z>255) { z=255; allpurpose_string_C="255"; } } if (x<0 || y<0 || z<0) { llMessageLinked(2,61,blank_string,owner_key); //"You input a value lower than 0, so, automatically //setting it to 0."; if (x<0) { x=0; allpurpose_string_A="0"; } if (y<0) { y=0; allpurpose_string_B="0"; } if (z<0) { z=0; allpurpose_string_C="0"; } } } } if ((x==0 && allpurpose_string_A!="0") || (y==0 && allpurpose_string_B!="0") || z==0 && allpurpose_string_C!="0") { if ( (x!=0 || (x==0 && allpurpose_string_A=="0")) || (y!=0 || (y==0 && allpurpose_string_B=="0")) ) { llMessageLinked(2,54,blank_string,owner_key); //"Please input three RGB (Red Green Blue) format color //values from 0 to 255."; } execute_command=FALSE; } if (do_subaction==TRUE) { llMessageLinked(2,54,blank_string,owner_key); //"Please input three RGB (Red Green Blue) format color values from 0 to 255." } if (execute_command==TRUE) { allpurpose_string_B=allpurpose_string_A+" "+allpurpose_string_B+" "+allpurpose_string_C; vec=; vec=vec/255; textcolor=vec; display_hovertext=TRUE; SetHovertext(); if (orig_prompt_mode==TEXTCOLOR_MODE) { llMessageLinked(2,55,allpurpose_string_B,owner_key); //"Text color changed to "+str+". Say 'x' to exit Text Color Change Mode."; } else { llMessageLinked(2,1100,allpurpose_string_B,owner_key); //"Text color changed to "+str+"."; } } prompt_mode=orig_prompt_mode; } if (prompt_mode==CHANNEL_MODE) { if (ARGS_ALREADY_DETERMINED==TRUE) { x=llList2Integer(input,1); message=llList2String(input,1); } else { x=(integer)message; } execute_command=FALSE; if (x>0 || x<0) { if (x<=9999 && x>0) { silent_channel=(integer)message; llListenRemove(silent_listen_handle); silent_listen_handle=llListen(silent_channel,"",owner_key,""); allpurpose_string_A="MagnaMural ("+(string)silent_channel+")"; llMessageLinked(2,51,(string)silent_channel,owner_key); //"Silent chat channel set to "+str+"."; llMessageLinked(2,72,allpurpose_string_A,owner_key); //The Messager script silently changes the name of //the prim it's in, prim 2. execute_command=TRUE; } else { llMessageLinked(2,80,blank_string,owner_key); //"Please name a channel from 1 to 9999 for the silent chat channel."; } } if (x==0 && message=="0") { llMessageLinked(2,67,blank_string,owner_key); //"Please name a channel other than 0 for the silent chat channel, //since 0 is the audible chat channel."; } if (execute_command==TRUE) { if (orig_prompt_mode==CHANNEL_MODE) { llMessageLinked(2,68,blank_string,owner_key); //"Exiting Silent Chat Channel Select Mode."; } prompt_mode=MAIN_PROMPT_MODE; } //prompt_mode=orig_prompt_mode; } //All these different jump labels are necessary because the same jump label //can't reliably be jumped to from more than one place in the code. @EndOfListenLoopTdelEnd; @EndOfListenLoopMainPromptMode; @EndOfListenLoopY; @EndOfListenLoopX; @EndOfListenLoopPhantom; @EndOfListenLoopSolid; @EndOfListenLoopHide; @EndOfListenLoopShow; @EndOfListenLoopBrief; @EndOfListenLoopVerbose; @EndOfListenLoopHelp; @EndOfListenLoopU; @EndOfListenLoopJ; @EndOfListenLoopGest; @EndOfListenLoopMem; @EndOfListenLoopOff; @EndOfListenLoopCommands; @EndOfListenLoopBack; @EndOfListenLoopForward; @EndOfListenLoopBackward; @EndOfListenLoopRandom; @EndOfListenLoopMore; @EndOfListenLoopWww; @EndOfListenLoopList; @EndOfListenLoopLock; @EndOfListenLoopUnlock; @EndOfListenLoopReset; @EndOfListenLoopLockUnlock; @EndOfListenLoopKey; @EndOfListenLoopName; @EndOfListenLoopReload; @EndOfListenLoopRecent; @EndOfListenLoopGive; @EndOfListenLoopDonate; @EndOfListenLoopTdelStart; if (return_to_default_state==TRUE) { llSetTimerEvent(0); state default; }; } } //********End of main script.