Jump to content

Pedlar Decosta

Resident
  • Posts

    99
  • Joined

  • Last visited

Reputation

14 Good

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Right. Ok. Thanks. I can do that. Some of these functions confuse me a little bit. I thought that was being done in the compiling code above before it added it to the list. But I can write code to do each individually and add them individually to the user list. Thanks mate.
  2. Does anyone understand why the space in the user list names don't get trimmed ? I can put it in the instructions that they don't leave spaces between the commas and the names, but realistically, to be user friendly, it would be best if the spaces just got trimmed automatically. I've posted the relevant code earlier or above. But unless I remove the spaces in the user notecard, it gives incorrect results when I search for the name. Any advise or opinions are appreciated.
  3. Thanks Frionil, however I have that in 3 places when compiling the list already. And unsure why it hasn't worked. i.e.- if(llGetSubString(data, 0, 0) != "#" && llStringTrim(data, STRING_TRIM) != "") { temp = llParseString2List(data, [], []); name = llStringTrim(llToLower(llList2String(temp, 0)), STRING_TRIM); list temp2 = llParseString2List(name, [], []); value = llStringTrim(llList2String(temp2, 0), STRING_TRIM); USERS = llParseString2List(value, [","], []);
  4. Ok, I haven't fixed the actual issue but I think I know the problem. When I add the name to the users notecard and don't leave a space after the comma of the previous name, the code works as expected. So I'm assuming there is an issue with the trimming of the elements of the USER list. I thought the code above trimmed the user list of spaces, but it certainly appears like there is a space before the user name/s. Can anyone tell me what they error is ? Once I manually remove the space most of the methods suggested work. But for user convenience I don't want to have to make them leave spaces out of the list ?
  5. I tried it and got a negative both times with the name on the list and not on the list. I'm obviously not understanding this.
  6. So I should try something like index = (llListFindList(BlahBlah){if (index != -1){ show result} ?
  7. I tried it with and without the ~ and then I tried it differnetly like this; if(~llListFindList( USERS, [llDetectedName(0)])){ONLIST = TRUE;llOwnerSay("user onlist = TRUE");} With the ~ it reports False whether the name is on the list or not and conversely positive for both if I remove the ~.
  8. I was using the ~ because of the wiki example.. So I removed the ~ and onlist still comes back as false ? Wiki; if(~llListFindList(myList, (list)item)) {//it exists // This works because ~(-1) produces 0, but ~ of any other value produces non-zero and causes the 'if' to succeed // So any return value (including 0) that corresponds to a found item, will make the condition succeed // It saves bytecode and is faster then doing != -1 // This is a bitwise NOT (~) not a negation (-) }
  9. I am being confounded by an issue with a result from llListFindList. I've stripped the script down to essentials and added feedback all over to try and find the issue. Can anyone tell me what could possibly be causing this. I am using a user notecard for an extended user access. This is in the state entry if (llGetInventoryType(NOTECARD) == INVENTORY_NOTECARD) { NOTECARDLINE = 0; QueryID = llGetNotecardLine( NOTECARD, NOTECARDLINE ); } else { llSay(0,"No Specific 'users' notecard, access will only be set via menu"); } The touch event is; touch_start(integer num) { ONLIST = FALSE; CURRENTUSERKEY = llDetectedKey(0); CURRENTUSERNAME = llDetectedName(0); llOwnerSay("user list is "+llList2CSV(USERS)); llOwnerSay("current user "+llToLower(llKey2Name(CURRENTUSERKEY))); integer index = (~llListFindList( USERS, [llDetectedName(0)])); if(index != -1){ONLIST = TRUE;llOwnerSay("user onlist = TRUE");} llOwnerSay("ONLIST = "+(string)ONLIST); } This is the feedback I'm getting; [17:11] Object: user list is jeremiah bullfrog, ben linden [17:11] Object: current user andie resident [17:11] Object: user onlist = TRUE [17:11] Object: ONLIST = 1 [17:11] Object: onlist: 0 The llListFindList() seems to be returning '!= -1' when the name is not on the list ? I was intially using CURRENTUSERKEY and also tried CURRENTUSERNAME both converted into lowered trimmed strings. They exist for the dialogue menu, but I still have the same issue of the ' != -1' result when they aren't on the list. This is the dataserver; dataserver(key queryid, string data) { string name; list temp; string value; if (queryid == QueryID) { if(data != EOF) { if(llGetSubString(data, 0, 0) != "#" && llStringTrim(data, STRING_TRIM) != "") { temp = llParseString2List(data, [], []); name = llStringTrim(llToLower(llList2String(temp, 0)), STRING_TRIM); list temp2 = llParseString2List(name, [], []); value = llStringTrim(llList2String(temp2, 0), STRING_TRIM); USERS = llParseString2List(value, [","], []); } NOTECARDLINE++; QueryID = llGetNotecardLine( NOTECARD, NOTECARDLINE ); } else { return; } } }
  10. Ok, finally got back to it. I think I have it sorted. I did need to reverse the list for it to send the correct item. This is probably more complicated than it needs to be, but seems to work. Again, any advice is appreciated. list name_simple; list name_real; list name_real2 = []; string name_simple_last; string name; list menu = []; list menu2 = []; integer listener; integer MENU_CHANNEL = -19908734; key id; integer i; SayCount() { menu = []; i = llGetInventoryNumber( INVENTORY_OBJECT ); name = llGetObjectName(); llSetText(name + "\n" + "Has " + (string)i + " items.", <0.0,1.0,0.0>, 1 ); llSetObjectDesc("Has " + (string)i+ " items."); while(~--i) { string objname = llGetInventoryName(INVENTORY_OBJECT,i); list parsed = llParseString2List(objname,[" "],[]); while((integer)llList2String(parsed,-1)) { parsed = llDeleteSubList(parsed,-1,-1); } string name_simple_check = llDumpList2String(parsed," "); if(name_simple_check!=name_simple_last) { name_real+=objname; menu2 = []; menu2 = menu + name_simple_check; name_simple += name_simple_check; menu =ListXorY(menu,menu2); } } } list ListItemDelete(list mylist,string element_old) { integer placeinlist = llListFindList(mylist, [element_old]); if (placeinlist != -1) return llDeleteSubList(mylist, placeinlist, placeinlist); return mylist; } Dialog(key id, list menu) { llListenRemove(listener); listener = llListen(MENU_CHANNEL, "", NULL_KEY, ""); llDialog(id, "Select an item below: ", menu, MENU_CHANNEL); } list ListXorY(list lx, list ly){ list lz = []; integer x; for (x = 0; x < llGetListLength(ly); ++x){ if (~llListFindList(lx,llList2List(ly,x,x))){ ; } else { lz = lz + llList2List(ly,x,x); } } return lx + lz; } list uListReverse( list name_real ){ integer vIntCnt = (name_real != []); while (vIntCnt){ name_real += llList2List( name_real, (vIntCnt = ~-vIntCnt), vIntCnt ); name_real = llDeleteSubList( name_real, vIntCnt, vIntCnt ); } return name_real; } default { state_entry() { SayCount(); } listen(integer channel, string name ,key id, string msg) { integer index = llListFindList(uListReverse(name_simple), [msg]); if (index != -1) { llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT,index)); SayCount(); } SayCount(); Dialog(llDetectedKey(0),menu); } touch_start(integer total_number) { id = llDetectedKey(0); if(llGetInventoryNumber(INVENTORY_OBJECT) == 0) { llWhisper(0,"No items left!"); } else { if (llDetectedGroup(0)) { id = llDetectedKey(0); Dialog(llDetectedKey(0),menu); } else llWhisper(0, "Wrong active group!"); } } on_rez(integer total_number) { SayCount(); } changed(integer change) { if (change & CHANGED_INVENTORY) { SayCount(); } } }
  11. so far, and I haven't had a lot of time, I have used Quistess's awesome suggestions and added ListXorY to eliminate duplicates for the menu.Just have to get it to give out the right objects now from the menu choices. But its getting there. I'll add the menu, a numbered list for potential long names when everything is working. Any other suggestions are appreciated list name_simple; list name_real; string name_simple_last; list menu = []; list menu2 = []; list ListXorY(list lx, list ly){ // add the lists eliminating duplicates list lz = []; integer x; for (x = 0; x < llGetListLength(ly); ++x){ if (~llListFindList(lx,llList2List(ly,x,x))){ ;} else {lz = lz + llList2List(ly,x,x); } } return lx + lz; } default { state_entry() { integer i = llGetInventoryNumber(INVENTORY_OBJECT); while(~--i) { string name = llGetInventoryName(INVENTORY_OBJECT,i); list parsed = llParseString2List(name,[" "],[]); while((integer)llList2String(parsed,-1)) { parsed = llDeleteSubList(parsed,-1,-1); } string name_simple_check = llDumpList2String(parsed," "); if(name_simple_check!=name_simple_last) { name_real+=name; menu2 = menu + name_simple_check; name_simple += name_simple_check; menu =ListXorY(menu,menu2); } } } touch_start(integer total_number) { llSay(0, "name_simple "+ llList2CSV(name_simple)); llSay(0,"menu = "+llList2CSV(menu)); } }
  12. Wulfie said: Is there a known list of valid items that would be put into this giver? Yes...and no. the items these people would put in might have a few hundred known items, but they also have new items being added at times as well. And it would be good to be able to use the script for other things. I mean there's no shortage of no copy items that are part of some gaming system or another in SL. And some people use multiple systems and might want to keep both in their box. For example G&S and DFS. There's a lot that use both.
  13. Quistess Alpha said: but if by some contrived circumstance, you add "soup 2" to a box that already has a "soup 2" in it, you get a "soup 2 1" Yeah, I can see that being an issue. They have items that have been boxed up (previously) and it is highly probably that they end up with "soup 2 1". Or "soup 245" for that matter. Which is why I was hoping to just delete all the numbers off the end. And knowing which item to give them did seem to me to be a bit tricky at this point. I thought maybe it would need to look for the item again, and then give the first instance of that name it found ?
  14. Hi, someone asked me if there was a script out there already, or if not to make something for them. I can't really find anything that suits. So I'm looking for some tips or help please. They use one of those game systems in SL which means that their community has lots of no copy items that they want to share with people as they need. So a menu that lists the object contents for them to choose from, but only shows one menu button for the items with identical names. so let's say they had 20x tomato soup portions, 4 x fresh celery, 1 fish head (or whatever), all no copy, no mod, but transferable items in the box, the menu would show Tomato Soup, celery and also fish head. When they choose one it gives them one item of their choice. The obvious difference in the names of all the tomato sauce would be numbers on the end. I'm assuming you'd just parse the numbers off the end with something like llParseString2List() ? Then check if the names are the same and condense the list using ListXorY to eliminate duplicates ? I think I'll use the numbered menu method too in case the names are long. I can't believe there isn't a script already for something like this, but maybe I'm not looking with the best search terms.
  15. Oh. ok. Thank you Rolig. And just to be clear, do I need to detect if they are online before attempting to send the notecard that way. i.e. if they aren't online will it fail ?
×
×
  • Create New...