ID:150432
 
OK, i need to make my verb only accesible if the usr has a few certain obj's in thier inventory, but it wont let me, when i use usr.contents it tells me iether bad var or if i make a list after it it tells me bad proc, can anyone tell me how to do this?
to tell you the truth, i havent ever had to do this, but there is a clunky way to do this

for each object, make a proc check some variables, those variables will be variables that are equal to 1 when you get the items you need, when the person gets all the objects he or she needs, and that proc is called, and all the variables equal 1, then you can add the verb like this

mob
proc
something()
src << "You got this new verb!"
verb
getnewverb()
src.verbs += /mob/proc/something()

--FIREking
In response to FIREking
Or if you prefer to avoid countless variables in your code, you could search contents after each get operation. This will take a few eaxtra nanoseconds when you get something, but frees up memory and makes smaller save files. It's also not as prone to errors caused by forgetting to flag a variable.
var/list/McBiggun_ingredients = list(/obj/all_beef_patty, /obj/special_sauce, /obj/lettuce, /obj/cheese, /obj/pickle, /obj/onion, /obj/sesame_seed_bun)

obj

verb
get()
set src in oview(1)
src.Move(usr)

// here's the check
var/can_make_McBiggun = 1 // if this makes it through the loop as 1, you have everything
for(var/ingredient in McBiggun_ingredients)
if(!(locate(ingredient) in usr.contents)) //
can_make_McBiggun = 0
break // no need to keep checking
if(can_make_McBiggun)
usr.verbs += /mob/proc/McBiggun


You'll want to make sure to remove the verb if they drop or use up an ingredient. In the McBiggun() proc, you should remove the objects and see if they still have enough for another McBiggun. Also, don't forget to ask if they want fries with that ;)