ID:734745
 
(See the best response by LordAndrew.)
Code:
obj
verb
get()
set category=null
set src in oview(1)
src.Move(usr)
drop()
set category=null
set src in usr
src.Move(usr.loc)


Problem description:
I have doors set as objects because later on in my game players will be able to build them. I have a Get verb before all of my objects in my tree code shown above to keep myself from writing the get() verb for every item. But doors have a get verb which I don't want them to. Is there a way to hide that verb for certain objects?
Best response
The problem here is that you're attributing get() and drop() to the top level of objs, which mean all children of /obj will have them.

You'd want to do something like:

obj
item
verb
get()

drop()

door
verb
open()

close()
Thank you LordAndrew
I actually have another question about this. How do I group these other objects to use just the verb get and drop? I ended up just putting the verb back up top and telling door to hide the get verb.


In response to Nickya1
Nickya1 wrote:
I actually have another question about this. How do I group these other objects to use just the verb get and drop? I ended up just putting the verb back up top and telling door to hide the get verb.

LordAndrew means:
obj
item//put all of your object you want to have get() under here
verb
get()

drop()

door//put all of your object you don't want to have get() under here
verb
open()

close()





I was trying that but it kept giving me indent errors can you give me an example with like two items in the item spots?
In response to Nickya1
obj
item
icon = 'items.dmi'

verb
get()

drop()

sword
icon_state = "sword"

shield
icon_state = "shield"
In response to Nickya1
Nickya1 wrote:
I was trying that but it kept giving me indent errors can you give me an example with like two items in the item spots?

Note: Do not copy and paste the code that you get from the forums. When you attempt to make changes to it, it'll give you the indentation error.

I don't copy and paste them at all -.-
obj
pickup // what kind of object to pick up
verb
get()
set src in usr.loc
usr << "You have picked up a [src]"
loc = usr
drop()
set src in usr
if(!suffix) loc = usr.loc


obj
pickup
OldNavyShirt
icon = 'Objects.dmi'
icon_state = "Shirt"


Dont copy codes from sources or demos