Dan Medici
Registered User
Join date: 25 Jan 2004
Posts: 132
|
11-22-2004 07:08
I have been trying to be able to do this for a very long time, but I'm not sure if it is even possible anymore? Does anybody have a technique to find the most recently added item to an inventory, without deleting all old items in the inventory?
|
billy Madison
www.SLAuctions.com
Join date: 6 Jun 2004
Posts: 2,175
|
11-22-2004 07:12
open your inventory click sort and then sort by date.. newest should be on top.
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
11-22-2004 07:17
have to keep a list of all the inventory items.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Tad Jensen
Script Junkie
Join date: 29 May 2004
Posts: 24
|
11-22-2004 07:42
From: billy Madison open your inventory click sort and then sort by date.. newest should be on top. rofl billy... this is in the scripting forum... doh! like Strife said... when you initialize your script make a list of items in your inventory... whenever that event is called that detects a change in inventory, go out and compare the list and be sure to move the contents of the new inventory over into the oldinventorvariable at the end of processing so you will have it avail to you the next time (obviously a global variable) this will give you most recently added inventory ITEMS ... (what if they add multiple at the same time,, is that ok?) anyone know the behavior of the changed_inventory when you drag a category of items into the objects inventory? does it spawn the changed event for each item dropped or does it only spawn once?
|
Dan Medici
Registered User
Join date: 25 Jan 2004
Posts: 132
|
11-22-2004 12:46
Oooh, good idea, Strife and Tad. I remembered asking Strife this a while back but I forgot the technique, heh, sorry. That's a good question tad! I'm not sure. Another question: Do I really have to save the "most recent" to a global variable? Once I have the list of the items in order, can't I just do... integer x = llGetListLength(listofitems); // the list that we are keeping track of string mostrecentitemname = llList2String(listofitems,x) - 1;
?
|
Tad Jensen
Script Junkie
Join date: 29 May 2004
Posts: 24
|
11-23-2004 07:41
i was referring to the two list variables needed to do the compare... list origList; // initially set to contents of object then reset each time the compare process is finished
list newList; // holds current contents when addition of inventory item already has started
list workingList; // list you maintain and add the new items as you get them so that the last list item is always your newest comparefunction() { origList = ["a","c","b"]; newList = ["a","d","b","c"];
//then you would have some compare logic right here to find out that "d" is the item added...
workingList = origList + newListItem; // each time this process is run you always need a snapshot of what the inventory looks like prior to adding an inventory item // this is what i was talking about before needing the global variable for origList = newList; }
comparefunction();
integer x = llGetListLength(workingList ); // the list that we are keeping track of string mostrecentitemname = llList2String(workingList ,x) - 1; obviously the above is just quick and dirty pseudo code... what you listed will grab the mostrecent value assuming you have already run your compare and populated the list with the new item at the END of the list you are looking at hope that makes sense... hehe
|