ID:146993
 
Ok, I'm basically trying to make a system that filters out objects that I don't want in the inventory stat panel I have out. One of my friends suggested this:

var/new/list=Inventory()
for(var/I in src.contents)
if(!istype(I,/obj/NAME/))
Inventory += I


Well, I put that in but I got 15 errors...shown below:

mobs.dm:1:error:Inventory:undefined proc
mobs.dm:1:error:/list:bad variable definition
mobs.dm:1:error:new :invalid variable name: reserved word
mobs.dm:2:error:I:duplicate definition
mobs.dm:2:error:src.contents:duplicate definition
mobs.dm:2:error:in :instruction not allowed here
mobs.dm:2:error::empty type name (indentation error?)
mobs.dm:3:error:I:duplicate definition
mobs.dm:3:error:/obj/enrage/:duplicate definition
mobs.dm:3:error::empty type name (indentation error?)
mobs.dm:4:error:Inventory:duplicate definition
mobs.dm:4:error:I:duplicate definition
mobs.dm:4:error:+= :instruction not allowed here
mobs.dm:4:error::empty type name (indentation error?)
mobs.dm:3:error::empty type name (indentation error?)

Where should I put this to make it work? Where is there a mistake? I need some help.

~Century0
DBC Coder
Ninja Gaiden Coder
Seven Shards of Time Coder
to make a list:

/var/list/Inventory = list()


I really don't know why you have that though...src.contents is built in and you can just use that I think....
In response to N1ghtW1ng
I know that, but src.contents has objects I don't want to appear in my inventory - things such as Ninpo (sort of like Ki for you DBZ people) which shouldn't be in an inventory. That is why I need to be able to filter this out.
In response to Century0
Well your defining 'I' wrong, but first put the right way in for declaring a list. Tell us what the new errors are.
In response to N1ghtW1ng
/var/list/Inventory = list()
for(var/I in src.contents)
if(!istype(I,/obj/NAME/))
Inventory += I

Errors:
mobs.dm:191:error:I:duplicate definition
mobs.dm:191:error:src.contents:duplicate definition
mobs.dm:191:error:in :instruction not allowed here
mobs.dm:191:error::empty type name (indentation error?)
mobs.dm:192:error:I:duplicate definition
mobs.dm:192:error:/obj/enrage/:duplicate definition
mobs.dm:192:error::empty type name (indentation error?)
mobs.dm:193:error:Inventory:duplicate definition
mobs.dm:193:error:I:duplicate definition
mobs.dm:193:error:+= :instruction not allowed here
mobs.dm:193:error::empty type name (indentation error?)
mobs.dm:192:error::empty type name (indentation error?)

~Century0
In response to Century0
Can I see the whole verb or proc?
In response to N1ghtW1ng
As in the stat() protocol that this is for or what?
In response to Century0
That's what he means (show the whle Stat() proc), and Century,

var/list/Inventory=new()


is a much better way. Nightwing, the way you proposed can be used, but not without some modification; you would still need to initialize the list with new(). Why? Because your way would create a null list, and you can't modify null lists. The new() way, however, would create an empty list which, of course, is modificable. It's the difference between having an empty bad, and having no bag at all.