Scripting Discuss scripting and programming for SL and other platforms |
![]() |
| LinkBack | Thread Tools | Display Modes |
![]() | #1 (permalink) |
Junior Member ![]()
Sleepy
| Noob help please :) I have this script Code: list Access = ["player name, player name"]; vector scale = <1,1,1>;//scale of the texture vector offset = <0,0,0>;//offset of the texture float rot = 0;//rotation of the texture string gCard; integer gLine; key gLineKey; integer numberoftextures;//number of textures in inventory integer currenttexture;//inventory number of current texture changetexture()//user fucntion to change texture; { string texture = llGetInventoryName(INVENTORY_TEXTURE,currenttexture);//gets texture key //PRIM_TEXTURE:integer face, string name, vector repeats, vector offsets, float rotation llSetLinkPrimitiveParams(LINK_SET,[PRIM_TEXTURE,ALL_SIDES, texture, scale, offset, rot]); } default { state_entry() { if (llGetInventoryNumber(INVENTORY_NOTECARD)) { Access = []; // Clears internal Access list, prepares for external list gCard = llGetInventoryName(INVENTORY_NOTECARD,0); // Read from the first notecard in inventory gLine = 0; // Start with the first line gLineKey = llGetNotecardLine(gCard,gLine); // Queue a "read" request for the dataserver event } else { llOwnerSay("There's no configuration notecard in inventory. Using internal access list as default."); // Access will be read from the list at the top of this script } } dataserver(key qID, string data) { if(qID == gLineKey) // If this really is a request from this script { if(data != EOF) // And if there's a line to read { Access += [data]; // Add the data from this line to the Access list ++gLine; // Advance to the next line gLineKey = llGetNotecardLine(gCard,gLine); // And queue a new "read" request for the dataserver } } } changed (integer change) { if (change & CHANGED_INVENTORY) { llResetScript(); } } touch_start(integer total_number) { numberoftextures = llGetInventoryNumber(INVENTORY_TEXTURE); ++currenttexture; if(currenttexture == numberoftextures) currenttexture = 0; if (llDetectedKey(0) == llGetOwner() || ~llListFindList(Access, [llDetectedName(0)])) changetexture(); else llSay(0,"Only those on the list can change me."); } } Thank you in advance ![]() |
![]() | ![]() |
![]() | #2 (permalink) | ||
That Bitch ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() *SLU Supporter* ![]() ![]() ![]() ![]() ![]() ![]() ![]()
Innocent as far as you know
Join Date: Nov 2011 Location: Online
Posts: 14,947
My Mood: ![]() SL Join Date: late 04 original account, mid 05 current | easy? depends on how you feel about building a list of all the textures in contents, and then updating it as needed. also depends on if you want to use just numbers or name in contents (requires santization) or some sort of friendly names. something like this would need to be in the state_entry to build the texture list Code: integer vIntCnt = llGetInventoryNumber( INVENTORY_TEXTURE ); while (vIntCnt--){ vLstMnu = [llGetSubString( llGetInventoryName( INVENTORY_TEXTURE, --vIntCnt ), 0, 24 )] + vLstMnu; }
__________________ - These eyes can do more than see Quote:
Quote:
| ||
![]() | ![]() |
![]() | #3 (permalink) |
Not as dumb as I look ![]() ![]()
More coffee, please
Join Date: Sep 2009 Location: In a TP
Posts: 351
SL Join Date: March 2007 | If you want to look at a script that uses Void's dialog pagination code to do the sort of job you are asking about, see Dialog Choices from Numbered Buttons - Second Life . The dialog lists in that one are built from data read off notecards, but could as easily be built in exactly the way Void described. /me waves at Void
__________________ I'm awake ... I think. Look for my scripted tools and my mesh items for the home and garden in SL's Marketplace at https://marketplace.secondlife.com/stores/12305 |
![]() | ![]() |
Thread Tools | |
Display Modes | |
| |
|