ID:146692
 
Code:
obj/verb    
get()
set src in oview(0)
if(Getable==1)
set hidden = 0
set category="Social"
src.loc = usr
if(Getable==0)
set hidden = 1
else
return


Problem description:
I'm trying to make it so the verb for get() is hidden if the object is not obtainable, but if it is i want the verb to be displayed. Here the get verb isnt being shown if it is obtainable... meaning its just staying hidden to pick anything up. (i'm doing this because i made my NPC's all objects so the summons list wont be a huge list of every NPC on the map, quite convienent)


any suggestions?



P.S. I dont want somthing like below (i know how to do that) i want to know how to make my orig code work correctly, Thanxs! :D
obj
thing1
icon = ''
icon_state = ""
verb
get()
set src in oview(1)
usr.contents += src


obj
var
gettable = 0
verb
get()
if(src.gettable == 1)
set src in oview(1)
usr.contents += src
else
set hidden = 1
..()

thing1
icon = ''
icon_state = ""
gettable = 1
thing2
icon = ''
icon_state = ""
gettable = 0


Is that more like what you wanted?
In response to tidus123
Thats exactly what i mean, but when i'm on an object that is getable the get verb doesnt appear, it still thinks it should stay hidden. But i want it to appear when its on a gettable object >__<
In response to Newen
Well I just did it, and it worked for me. So I don't know what could be wrong.
In response to tidus123
tidus123 wrote:
verb
get()
if(src.gettable == 1)
set src in oview(1)
usr.contents += src
else
set hidden = 1
..()

A few problems:

  • Never ever ever test a true/false value with if(var==1). Use if(var) instead.
  • set src and set hidden are not conditional; you can't just stick them in parts of the verb and have them behave according to the logic inside. The verb is either hidden or not; its set src line is there or not. You can't make it change depending on conditions in the proc/verb.
  • Calling ..() is pointless when you're working with a new verb or proc. It's used only when you override an existing verb or proc, to call the old version.

    Lummox JR