|
Zanduar Ceawlin
Registered User
Join date: 23 Apr 2007
Posts: 14
|
07-13-2007 19:31
I'm totaly new to this, but am wondering if anyone has done this yet..
I am looking for a landmark giver that will show all the lms in a given prim in a popup menue so that when people click it they will see the menu & not get blasted with say 20 lms + it would have to auto update due to having people drop in lms at random times. I know this is alot of asking, but has someone has done anything like this or even close?? Thanks you ahead of time...
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
07-13-2007 22:00
shouldnt be too hard, with lldialog and a loop or 2
its abit too late for me to fuss with it right now, but its certainly doable
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
07-14-2007 10:36
As Osgeld said pretty straight forward. You will need to be careful that people dont drop additional things in that are of a less "polite nature". // Newgate Ludd's Multi Landmark Menu Script // written in responce to a forum post by Zanduar Ceawlin // list Landmarks; // List of landmark names integer maxLandmarks; // Number of landmarks integer CHANNEL; // Channel on which Dialog listens list Choices; // List being chosen From integer Listening = 0; // Listen handle integer pagesize = 5; // Number of Items per Dialog string title; // text of Dialog integer first; // first index into list integer i; // -------------------------- UpdateListen(key id) { CancelListen(); CHANNEL = 0 - (integer)llFrand(2147483647); Listening = llListen(CHANNEL,"",id,""); llSetTimerEvent(20); } // -------------------------- CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); } // -------------------------- ShowMenu(key avatar) { title = "Which Landmark would you like?"; Choices = [ ]; // Now add the items if(first > 0) Choices += "<<"; if(maxLandmarks > (first + pagesize)) { Choices += ">>"; } // Add x items for(i = 0;i < pagesize;i++) { integer j = (i + first); string num = (string)j; string strname = llList2String(Landmarks,j); if( llStringLength(strname) > 0) { title += "\n" + num + ") " + strname; Choices += [ num ]; } } // finally show the dialog UpdateListen(avatar); llDialog(avatar, title, Choices, CHANNEL); } // -------------------------- GetLandmarkList() { // Clear out any existing items Landmarks = []; // Get the number of Landmarks integer number = llGetInventoryNumber(INVENTORY_LANDMARK); // iterate through them all while(--number >= 0) { string name = llGetInventoryName(INVENTORY_LANDMARK, number); Landmarks = (Landmarks = []) + Landmarks + [ name ]; } } // -------------------------- default { state_entry() { llOwnerSay("Initialising, Please wait..."); GetLandmarkList(); maxLandmarks = llGetListLength(Landmarks); llOwnerSay("Ready. " + (string)maxLandmarks + " Available."); llAllowInventoryDrop(TRUE); } touch_start(integer total_number) { first = 0; ShowMenu(llDetectedKey(0) ); }
listen(integer channel, string name, key id, string message) { CancelListen(); // verify dialog choice if("<<" == message) { first -= pagesize; if(first < 0) first = 0; ShowMenu(id); } else if(">>" == message) { first += pagesize; if(first > maxLandmarks) first = (maxLandmarks - pagesize); ShowMenu(id); } else { integer index = llListFindList(Choices, [message]); if(index >= 0) { string LandmarkName = llList2String(Landmarks,(integer)message); llGiveInventory(id,LandmarkName); } } } timer() { CancelListen(); } changed(integer change) { if(change & CHANGED_INVENTORY) llResetScript(); } on_rez(integer num) { llResetScript(); } }
My usual Caveat's apply!!!!!
_____________________
I'm back......
|
|
Zanduar Ceawlin
Registered User
Join date: 23 Apr 2007
Posts: 14
|
07-14-2007 14:43
I have the object it is set for accessable only to the current group so it'll be safe for the most part.. Thanks again... I should sit down & disect this & figure out howto do this.. Will save some headaches for evreyone... From: Newgate Ludd As Osgeld said pretty straight forward. You will need to be careful that people dont drop additional things in that are of a less "polite nature". // Newgate Ludd's Multi Landmark Menu Script // written in responce to a forum post by Zanduar Ceawlin // list Landmarks; // List of landmark names integer maxLandmarks; // Number of landmarks integer CHANNEL; // Channel on which Dialog listens list Choices; // List being chosen From integer Listening = 0; // Listen handle integer pagesize = 5; // Number of Items per Dialog string title; // text of Dialog integer first; // first index into list integer i; // -------------------------- UpdateListen(key id) { CancelListen(); CHANNEL = 0 - (integer)llFrand(2147483647); Listening = llListen(CHANNEL,"",id,""); llSetTimerEvent(20); } // -------------------------- CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); } // -------------------------- ShowMenu(key avatar) { title = "Which Landmark would you like?"; Choices = [ ]; // Now add the items if(first > 0) Choices += "<<"; if(maxLandmarks > (first + pagesize)) { Choices += ">>"; } // Add x items for(i = 0;i < pagesize;i++) { integer j = (i + first); string num = (string)j; string strname = llList2String(Landmarks,j); if( llStringLength(strname) > 0) { title += "\n" + num + ") " + strname; Choices += [ num ]; } } // finally show the dialog UpdateListen(avatar); llDialog(avatar, title, Choices, CHANNEL); } // -------------------------- GetLandmarkList() { // Clear out any existing items Landmarks = []; // Get the number of Landmarks integer number = llGetInventoryNumber(INVENTORY_LANDMARK); // iterate through them all while(--number >= 0) { string name = llGetInventoryName(INVENTORY_LANDMARK, number); Landmarks = (Landmarks = []) + Landmarks + [ name ]; } } // -------------------------- default { state_entry() { llOwnerSay("Initialising, Please wait..."); GetLandmarkList(); maxLandmarks = llGetListLength(Landmarks); llOwnerSay("Ready. " + (string)maxLandmarks + " Available."); llAllowInventoryDrop(TRUE); } touch_start(integer total_number) { first = 0; ShowMenu(llDetectedKey(0) ); }
listen(integer channel, string name, key id, string message) { CancelListen(); // verify dialog choice if("<<" == message) { first -= pagesize; if(first < 0) first = 0; ShowMenu(id); } else if(">>" == message) { first += pagesize; if(first > maxLandmarks) first = (maxLandmarks - pagesize); ShowMenu(id); } else { integer index = llListFindList(Choices, [message]); if(index >= 0) { string LandmarkName = llList2String(Landmarks,(integer)message); llGiveInventory(id,LandmarkName); } } } timer() { CancelListen(); } changed(integer change) { if(change & CHANGED_INVENTORY) llResetScript(); } on_rez(integer num) { llResetScript(); } }
My usual Caveat's apply!!!!!
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
07-15-2007 07:26
Well hopefully the code is clear enough that you should be able to follow it reasonably easily. I try to post code that even if nnot overly commented is at least functionally obvious. Any problems post them and I'm sure someone will help out.
_____________________
I'm back......
|
|
Zanduar Ceawlin
Registered User
Join date: 23 Apr 2007
Posts: 14
|
07-15-2007 07:28
Thanks I will, looks not to bad, I'm use to VB so this is 180 from what i do...Yikes...
|