ID:154741
 
I have some lists in my game called:

deck1
deck2
deck3
deck4
deck5
deck6
deck7
deck8
deck9
deck10

And an obj:

deck

What I want to do is to associate each list with an obj.

Example:

i have nothing in my inventory(usr.contents) and i receive/create a deck, that deck is associated with list1. But, if i have 3 decks in inventory and I create another one, that new deck will be associated with list4.

I don't know how to explain this exactly, but see what I have:

mob
verb
New_Deck()
if(usr.howmanydecks==10)
usr << "You cannot create a new deck."
return
var/obj/deck/P = new/obj/deck
usr.contents += P
P.name=input("Type a name for the deck.") as text

What it is supposed to be:

obj/var/list/decklist

mob
verb
New_Deck()
if(usr.howmanydecks==10)
usr << "You cannot create a new deck."
return
var/Q=0
for(var/obj/D in usr.contents)
Q+=1
var/obj/deck/P = new/obj/deck
usr.contents += P
P.name=input("Type a name for the deck.") as text
P.decklist+=usr.deck{Q+1} //the problem is here, usr.deck{Q+1}, its a var inside a var and thats is not allowed. how can i do it differently?
usr.howmanydecks+=1


Sorry if my english is not too good.
Ugh.. This *is* possible, but in the example you gave, you really don't want to do it.

P.decklist+=usr.vars["deck[Q+1]"]


But in this case, you should really use a list instead, it does the same thing, and is a lot cleaner and more readable, let alone faster.
In response to CIB
Ok, I did it. Thank you.