ID:2248991
 
Code:
fruit_list.Add("Banana" = world.time)


Problem description:For example we have the fruits here in the list, we put them in the list as the player finds them. Some are not ripe though. I want to be able to let them ripen without having to write a long proc for that or anything like that. If I could put the time they are picked up into the list, that would allow me to have them be ripe when a certain amount of time passed. The example I gave above doesnt work. What is the correct way of doing this?

You could keep datums in a list and set a variable in their new call I guess

fruit
var
name
time_picked
New(fruit,time)
name = fruit
time_picked = time

fruit_list.Add(new /Fruit("Banana",world.time))


But I guess you already have some sort of string list worked out? I dunno. You could use an associative list but I don't see when that would be relevant in an... inventory system?
Strictly speaking what you want would be fruit_list["banana"] = world.time. However I agree that you should be storing the information on an object instead of in a random list. What if you also want to store when the banana was originally grown? I suggest adding a var to the banana object like pickup_time and comparing against that.