ID:261894
 
When I use this:

if(!src.contents.Find(/obj/item/equipable/weapon/dagger))
src << "You don't have the item to use this tech."
return
else
src << "You use the tech"


It only shows "You don't have the item to use this tech."

What's wrong?

I think it has to do something with new lists and the type, but I'm not sure.

Unknown Person <<
I'm assuming that what you have in your list are actual, existing, created, objs. You can't search a list using a typepath if you're looking for an actual atom. What you can do however is if(!locate(/obj/item/equipable/weapon/dagger) in src.contents)

Or possibly in src.
for(var/obj/item/equipable/weapon/dagger in [usr or src without brackets)
UsrOrSrc<<"You use the tech!"
break
if(!locate(/obj/item/equipable/weapon/dagger) in UsrOrsrc)
usr<<"NOOOOOOOOOOOOOOOO!!!11!"
In response to Jon88
Jon88 wrote:
I'm assuming that what you have in your list are actual, existing, created, objs. You can't search a list using a typepath if you're looking for an actual atom. What you can do however is if(!locate(/obj/item/equipable/weapon/dagger) in src.contents)

Minor erratum: You need parentheses around the (locate(...) in ...) part, because the ! operator binds more tightly than "in".

Lummox JR
In response to Lummox JR
Thanks, Jon, Lummox JR, and Airjoe, for your contributions.

Unknown Person <<