Code:
get()
set src in usr.loc
var
obj/group/O = locate(src.type) in usr.contents
obj/group/P
if(!O)
src.Move(usr)
src.NumUpdate()
else
for(O)
if(!O.num >= O.max_num)
P = O
if(!P)
src.Move(usr)
src.NumUpdate()
else
P.NumAdd(src.num)
P.NumUpdate()
del src
Problem description:
I pick up 50 of an item.
I pick up 1 of an item and it move it to my inventory.
I pick up 4 more and it moves them to my inventory instead of grouping them.
I'm trying to do an item grouping snippet but it doesn't find 'P' and therefore won't group anything. I know it's probably an easy solution but I can't get it to work...