ID:155766
 
Hi all, I have a problem with a "begging" verb. What I am trying to do is create a verb, "beg", where I can go up to a merchant and beg for gold. Then the decision will be 50% chance. Please take a look at my code and let me know how I can make it work. I posted the errors in the bottom of the code too.

    verb
beg(mob/merchant as mob in oview(1))
var/T = rand(1,2)
if(T == 1)
usr.wealth += 50
else
return

//Player.dm:34:error: rand: undefined proc
//Player.dm:35:error: : invalid expression
//Player.dm:34:warning: T: variable defined but not used


Here are all of the minor problems I can see:

1) You haven't declared a variable for the merchant
2) The else{return} is unneeded
3) The if/else statements are indented once too much.
4) Use 0 and 1 instead of 1 and 2, so you can get rid of T completely and just put it in the if().

Try this, see if it works:
    verb
beg(var/mob/merchant/M as mob in oview(1))
if(rand(0,1))
usr.wealth += 50
... ...
else
... ...