ID:519746
 
(See the best response by Stephen001.)
Code:
obj
verb
Get()
set src in oview(1) //You have to be standing on it.
usr << "You get [src]"
Move(usr)



obj
Table
icon = 'table.dmi'
density = 1


Wood
name = "Wooden Table"
icon_state = "wooden"


Problem description:

Basically, how would I go about not allowing objects that have an active "anchor" variable to not be able to be picked up?
Best response
This is pretty much the more basic of the basics. You'll simply want to return out of the verb before you've moved the object into your contents.

Assuming an anchor variable, like so:

obj
var
isAnchored = FALSE

verb
Get()
set src in oview(1) //You have to be standing on it.
if (src.isAnchored)
usr << "[src] is fixed to the ground, you can't pick it up!"
return
usr << "You get [src]"
Move(usr)


return basically stops execution of the verb at that point, instead of carrying on down to the bottom of the verb.
Thank you very much. This is the exact kind of simple answer I never get. :)
Also, it works perfectly. But then some of the code I already put has indention errors. Don't know how.
You've probably been using Tab to indent,
if you just copy and pasted what Stephen posted it's using spaces.

So delete all the spaces and tab it out.
Anyone care to explain as to how one would make it not even appear to be able to be picked up at all? It'd be simplest if the option wasn't there, so like one exception to all objects verbs.
Make a sub-type of objects so:
obj
items

and have the verb under that so only objs with the type /obj/items have the verb attached.
Oh. Yes. This makes lots of sense. Thanks.