Difference between revisions of "OnTouchSelectTexture"
(New page: '''IMPORTANT NOTE:''' This menus control REQUIRED Nargus Dialog Control script and Nargus Menus Control script. You MUST have all three scripts ...) |
|||
Line 1: | Line 1: | ||
'''IMPORTANT NOTE:''' This menus control REQUIRED [[Dialog Control|Nargus Dialog | '''IMPORTANT NOTE:''' This menus control REQUIRED [[Dialog Control|Nargus Dialog Control script]]. You MUST have all both the script and this one in the same prim for it to work. | ||
==Scripts== | ==Scripts== | ||
OnTouchSelectTexture.lsl | OnTouchSelectTexture.lsl | ||
<lsl> | <lsl> | ||
// | // ********** DIALOG FUNCTIONS ********** | ||
// Dialog constants | // Dialog constants | ||
integer lnkDialog = 14001; | integer lnkDialog = 14001; | ||
Line 33: | Line 20: | ||
string seperator = "||"; | string seperator = "||"; | ||
integer dialogTimeOut = 0; | integer dialogTimeOut = 0; | ||
// ********** END DIALOG FUNCTIONS ********** | |||
// ********** DIALOG FUNCTIONS ********** | |||
string | string texturesDialog; | ||
initTextures(){ | |||
// Please me reminded that Nargus Dialog script autometicly add Back/Next buttons for you. | |||
// Optimised dialog generator script. Much more memory efficient than usage of Dialog+Menus control function | |||
llOwnerSay("Inventory change detected; re-initializing..."); | |||
texturesDialog = "Click BACK/NEXT to change page.\n" + | |||
"Click a texture button to choose." + | |||
seperator + (string)dialogTimeOut; | |||
integer count = llGetInventoryNumber(INVENTORY_TEXTURE); | |||
integer i; | integer i; | ||
for(; i<count; ++i){ | |||
for( | string name = llGetInventoryName(INVENTORY_TEXTURE, i); | ||
texturesDialog += seperator + name + seperator + llGetSubString(name, 0, 15); | |||
} | |||
} | texturesDialog += seperator + "CLOSE" + seperator; | ||
llOwnerSay("Initializing completed."); | |||
} | } | ||
default{ | default{ | ||
state_entry(){ | state_entry(){ | ||
initTextures(); | |||
} | |||
changed(integer changes){ | |||
if(changes & CHANGED_INVENTORY) initTextures(); | |||
} | } | ||
link_message(integer sender_num, integer num, string str, key id){ | link_message(integer sender_num, integer num, string str, key id){ | ||
if(num == lnkDialogResponse){ | |||
if(llGetInventoryType(str) == INVENTORY_TEXTURE) llSetTexture(str, ALL_SIDES); | |||
if( | |||
} | } | ||
} | } | ||
touch_start(integer num_detected){ | touch_start(integer num_detected){ | ||
llMessageLinked(LINK_THIS, | llMessageLinked(LINK_THIS, lnkDialog, texturesDialog, llDetectedOwner(0)); | ||
} | } | ||
} | } | ||
</lsl> | </lsl> |
Latest revision as of 18:55, 6 January 2009
IMPORTANT NOTE: This menus control REQUIRED Nargus Dialog Control script. You MUST have all both the script and this one in the same prim for it to work.
Scripts
OnTouchSelectTexture.lsl <lsl> // ********** DIALOG FUNCTIONS ********** // Dialog constants integer lnkDialog = 14001; integer lnkDialogNotify = 14004; integer lnkDialogResponse = 14002; integer lnkDialogTimeOut = 14003;
integer lnkDialogReshow = 14011; integer lnkDialogCancel = 14012;
integer lnkMenuClear = 15001; integer lnkMenuAdd = 15002; integer lnkMenuShow = 15003;
string seperator = "||"; integer dialogTimeOut = 0; // ********** END DIALOG FUNCTIONS **********
string texturesDialog;
initTextures(){ // Please me reminded that Nargus Dialog script autometicly add Back/Next buttons for you. // Optimised dialog generator script. Much more memory efficient than usage of Dialog+Menus control function
llOwnerSay("Inventory change detected; re-initializing..."); texturesDialog = "Click BACK/NEXT to change page.\n" + "Click a texture button to choose." + seperator + (string)dialogTimeOut; integer count = llGetInventoryNumber(INVENTORY_TEXTURE); integer i; for(; i<count; ++i){ string name = llGetInventoryName(INVENTORY_TEXTURE, i); texturesDialog += seperator + name + seperator + llGetSubString(name, 0, 15); } texturesDialog += seperator + "CLOSE" + seperator;
llOwnerSay("Initializing completed.");
}
default{
state_entry(){ initTextures(); } changed(integer changes){ if(changes & CHANGED_INVENTORY) initTextures(); } link_message(integer sender_num, integer num, string str, key id){ if(num == lnkDialogResponse){ if(llGetInventoryType(str) == INVENTORY_TEXTURE) llSetTexture(str, ALL_SIDES); } } touch_start(integer num_detected){ llMessageLinked(LINK_THIS, lnkDialog, texturesDialog, llDetectedOwner(0)); }
} </lsl>