ID:143235
 
obj

var
tradable=TRUE
price=0
gettable=1
verb
Get_Something()
set category = "Action"
set name="Get"
if(gettable==1)
set src in usr.loc
if(stackable)
var/obj/object = locate(text2path("[src.type]")) in usr.contents
if(object)
object.addAmount(src.amount)
del(src)
else
usr.contents.Add(src)
else
usr.contents.Add(src)
var/mob/P=usr
P.Get(src)
else
..()


So I have it working fine at the moment, just trying to get it so when you walk on an object that isn't supposed to be picked up the Get() verb doesn't even appear, right now using it doesn't do anything when I set an obj/var/gettable to 0 but just for the sake of not letting my players know that an object is an obj I'd like to take away the popup verb in those cases

mike-


Instead of giving that verb to all objs, define a subtype of obj, item, which will have that verb. Then, derive everything you can pick up to be of that subtype.

obj
item
verb
Get_Something()
//etc.

apple
rock
flux_capacitor

etc.

Additionally, a couple mistakes:

all "set src" directives should be before any other code in a verb. Placing them inside an if() statement means nothing.
<code>text2path("[src.type]")</code> is the definition of redundant. You convert it to text only to convert it back to a type. Just write <code>src.type</code>
I'm not sure why you have "P.Get(src)", but there's no reason to have the P variable: usr's type is /mob anyway.
There's no need for the <code>else ..()</code> at the end. ..() only has meaning if you are overriding an already-existing verb or proc.
In response to Garthor
Thanks for the tips. Yeah that makes sense grouping obj further down the tree, redefining all my obj's that are general atm should be fun lol.

I'm still a nub, been at this for a few weeks so far, so a lot of my coding is still from the "hey it works" standpoint.

mike-
In response to Kichimichi
Yeah got it to work, thanks, simple enough should have thought of that myself, things are coming to me a lot faster now though, I've gone from suck to stink in only 3 weeks heh.

mike-