// This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ // or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. // Put this script in the root prim of your item // CUSTOMIZABLE VALUES // change here to set the desired scale change +- from the base of 1.0 // eg. 0.2 will make the scale 0.8 or 1.2 respectively float scale_step = 0.2; // eSimple srl 2008 - www.esimple.it - www.virtuy.com // Ploreho design 2008 - www.ploreho.com // Modified by Winter Seale 2008 - winterseale.com // -- Got rid of constant listen/remove listen code and changed to using listencontrol to turn the handle on and off // -- Got rid of all the magic numbers. // -- Moved repeated code to functions // -- Changed it to handle optionally having a color change script dropped in. // -- I also changed the formatting to match my own scripts =p // DO NOT CHANGE BELOW THIS LINE integer LM_RESET_SECRIPTS = 101; integer LM_SCALE_MESSAGE = 102; integer LM_CAN_COLOR_CHANGE = 103; integer LM_SHOW_COLOR_DIALOG = 104; integer LM_SET_COLOR = 105; integer LM_SHOW_MAIN_DIALOG = 106; integer LM_DEL_SCRIPTS = 200; string DEFAULT_SCALE = "d"; integer CHANNEL = -114757313; // popup options string MENU_NAME = "Choose the desired option:"; string DN_SIZE = "- Size"; string DF_SIZE = "Default"; string UP_SIZE = "+ Size"; list MENU_OPTIONS = [DN_SIZE, DF_SIZE, UP_SIZE ]; string COLOR = "Color"; string NOOP = "-"; list COLOR_OPTIONS = [ NOOP, COLOR, NOOP ]; string DEL_SCRIPTS = "Del Scripts"; list DELETE_OPTIONS = [ NOOP, NOOP, DEL_SCRIPTS ]; integer listenhandler; integer have_colors; // Rebuild our listener and turn it off. reset_listener() { llListenRemove(listenhandler); listenhandler = llListen( CHANNEL, "", llGetOwner(), ""); llListenControl( listenhandler, FALSE ); } // Show change menu, optionally including color the option to change colors // if a color change script was included. Time out after 60 seconds. show_dialog() { list options = []; options += DELETE_OPTIONS; if ( have_colors ) { options += COLOR_OPTIONS; } options += MENU_OPTIONS; llDialog(llGetOwner(), MENU_NAME, options, CHANNEL); llSetTimerEvent(60); llListenControl( listenhandler, TRUE ); } // Send link messages, using the numeric part to control what happens and // the string part for arguments. // All commands except LM_SHOW_COLOR_DIALOG go to the entire linkset. The // dialog command only goes to the same prim as the core script. send_linked(integer command, string options ) { integer dest = LINK_SET; if ( command == LM_SHOW_COLOR_DIALOG ) { dest = LINK_THIS; } llMessageLinked( dest, command, options, NULL_KEY ); } default { state_entry() { reset_listener(); have_colors = FALSE; } touch_end(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { show_dialog(); } } listen(integer channel, string name, key id, string button) { if ( button == DN_SIZE) { send_linked( LM_SCALE_MESSAGE, (string)(1.0 - scale_step) ); show_dialog(); } else if ( button == UP_SIZE ) { send_linked( LM_SCALE_MESSAGE, (string)(1.0 + scale_step) ); show_dialog(); } else if ( button == DF_SIZE ) { send_linked( LM_SCALE_MESSAGE, DEFAULT_SCALE ); show_dialog(); } else if ( have_colors && button == COLOR) { llListenControl( listenhandler, FALSE ); send_linked( LM_SHOW_COLOR_DIALOG, "" ); } else if ( button == DEL_SCRIPTS ) { send_linked( LM_DEL_SCRIPTS, "" ); llRemoveInventory( llGetScriptName() ); } } // This is just here to reset things when this is sold... changed(integer mask) { if ( mask & CHANGED_OWNER ) { // Strictly speaking, there's no reason to reset the listener, as the llMessageLinked will // result in a full script reset. However, in case it somehow gets dropped this way the item // won't be inert. reset_listener(); llMessageLinked(LINK_SET, LM_RESET_SECRIPTS, "", NULL_KEY); } } link_message(integer sender_num, integer command, string message, key id) { if ( command == LM_RESET_SECRIPTS ) { llResetScript(); } else if ( command == LM_CAN_COLOR_CHANGE ) { have_colors = TRUE; } else if ( command == LM_SHOW_MAIN_DIALOG ) { show_dialog(); } } timer() { llListenControl( listenhandler, FALSE ); llSetTimerEvent(0); } }