I'm haveing trouble getting this verb to work, any help is appreciated.
mob
verb
Use()
var/list/owitems = new()
var/tempval
var/useitem
for(var/x in usr.contents)
owitems += x
owitems += "Cancel"
if (owitems.len == 1)
usr << "You don't have any items"
else
useitem = input("Which item would you like to use?") in owitems
usr << "[useitem]"
switch(useitem)
if("Cancel")
return ..()
if("Herb")
tempval = usr.maxhp - usr.hp
if(tempval >= 20)
usr.hp += 20
tempval = 20
else
usr.hp += tempval
usr << "You were healed for [tempval] HP."
else
usr<<"[useitem]"
usr << "This item has no effect"
-----
useitem comes up as 'Herb', but it goes right to no effect.
Thanks
ID:178650
Apr 21 2002, 7:27 am
|
|
That is one way of doing it. There is, however, a much more efficient way of doing that. This is the way I would code your verb.
Hope that helped.