ID:1819164
 
Code:
    for(var/obj/cards/monster/C in usr.Hand)
if((C.level < PL_2 && C.level > PL_1)||(C.level > PL_2 && C.level < PL_1))
monsters += C
sortmons += "[C.name] ([C.CrdLoc])"
for(var/obj/cards/monster/C in usr.PPile) if(!isnull(C.pendulum))
if((C.level < PL_2 && C.level > PL_1)||(C.level > PL_2 && C.level < PL_1)||(C.rank < PL_2 && C.rank > PL_1)||(C.rank > PL_2 && C.rank < PL_1))
monsters += C
sortmons += "[C.name] ([C.CrdLoc])"

    while(monsters.len)
var/sel = input("Choose monsters to Pendulum Summon.\n(hit cancel when done)","[summons.len] so far ([z-summons.len] empty Zones)") in sortmons

if(!sel) break
var/n = sortmons.Find(sel)
var/T = monsters[n]

summons += T
monsters -= T
sortmons -= sel

if(summons.len >= z) break

Problem description:

So I'm having a bit of an issue here.

Im making a list of obj in 2 other lists that meet certain criteria.
Im also making a second list that contains the names and what the original list was for those objs.

I'm running that second list through an input because it is important that the input selection options not combine the entries from the 2 different original lists.

I then find the index number of the selection the list that contains the names/locations, match it to the index in the list containing the objects themselves.

I remove the entry from both of these lists and add it to a final list that will store up to 5 of the selected objects.


My issue is that my 2 lists seem to be going out of sync and I'm not entirely sure why. It seems to go out of sync when the input selects a second copy of an obj in a row.

Anyone know a way to fix this? Or a way to do what I'm trying to do here in a simpler way?
So the issue seems to be that is still combining like entries. If I have 2 of the same object in the same original list.

I changed the original list creations to...

sortmons += "[sortmons.len + 1]. [C.name] ([C.CrdLoc])"

That seems to have fixed it but it's not pretty.