ID:142072
 
Code:
LandedOn()  //if you stop on this tile, it will run the following proc
var/q = rand("You inherit $100!","Doctor's Fee. Pay $50.","Pay Hospital $100","Go to jail!","Pay School tax of $150."/*,"Christmas fund matures. Collect $100","Income tax refund. Collect $20","Life insurance matures. Collect $100."*/)
if(q=="You inherit $100!")
usr << "You inherit $100!"
usr.money += 100
(returnPlayers()-usr) << "[usr] inheritted $100!"
return
if(q=="Doctor's Fee. Pay $50.")
usr << "Doctor's Fee. Pay $50."
usr.money -= 50
(returnPlayers()-usr) << "[usr] had to pay $50 for the doctor!"
return
if(q=="Pay Hospital $100")
usr << "You pay the hopsital $100!"
usr.money -= 100
(returnPlayers()-usr) << "[usr] pays the hospital $100!"
return
if(q=="Go to jail!")
usr.jail = 1
usr.loc = locate(1,1,1)
(returnPlayers()-usr) << "[usr] was sent to jail by the Community Chest!"
usr << "You get sent to jail after drawing the card!"
return
if(q=="Pay School tax of $150.")
usr << "You pay a school tax of $150."
usr.money -= 150
(returnPlayers()-usr) << "[usr] payed a school tax of $150."
return


I get the following error codes when compiling, and I'm pretty sure it's a complete noobs mistake...

turfs.dm:53:error:rand:undefined proc
turfs.dm:54:error::invalid expression
turfs.dm:53:q :warning: variable defined but not used


I think you were thinking of pick(), not rand():

http://www.byond.com/docs/ref/info.html#/proc/pick
In response to Stephen001
Eh.. I tried using pick instead and it still told me it was an undefined proc..
LandedOn()
var/q = rand(1,5)
switch(q)
if(1)
usr << "You inherit $100!"
usr.money += 100
oview() << "[usr] inheritted $100!"
if(2)
usr << "Doctor's Fee. Pay $50."
usr.money -= 50
oview() << "[usr] had to pay $50 for the doctor!"
if(3)
usr << "You pay the hopsital $100!"
usr.money -= 100
oview() << "[usr] pays the hospital $100!"
if(4)
usr.jail = 1
usr.loc = locate(1,1,1)
oview() << "[usr] was sent to jail by the Community Chest!"
usr << "You get sent to jail after drawing the card!"
if(5)
usr << "You pay a school tax of $150."
usr.money -= 150
oview() << "[usr] payed a school tax of $150."


You can do it like that. I'm assuming that's a verb, because if it isn't change every usr in there, to src. Including the oview() calls which default to usr.
In response to Andre-g1
That looks like it should work. And LOL, it isn't a verb. I'm such a moron... I told you it was a noob mistake..
In response to SHSPlyr03
What is an undefined proc? pick?

Because this worked for me, excepting obviously the problems with usr:

proc
LandedOn() //if you stop on this tile, it will run the following proc
var/q = pick("You inherit $100!","Doctor's Fee. Pay $50.","Pay Hospital $100","Go to jail!","Pay School tax of $150."/*,"Christmas fund matures. Collect $100","Income tax refund. Collect $20","Life insurance matures. Collect $100."*/)
if(q=="You inherit $100!")
usr << "You inherit $100!"
usr.money += 100
(returnPlayers()-usr) << "[usr] inheritted $100!"
return
if(q=="Doctor's Fee. Pay $50.")
usr << "Doctor's Fee. Pay $50."
usr.money -= 50
(returnPlayers()-usr) << "[usr] had to pay $50 for the doctor!"
return
if(q=="Pay Hospital $100")
usr << "You pay the hopsital $100!"
usr.money -= 100
(returnPlayers()-usr) << "[usr] pays the hospital $100!"
return
if(q=="Go to jail!")
usr.jail = 1
usr.loc = locate(1,1,1)
(returnPlayers()-usr) << "[usr] was sent to jail by the Community Chest!"
usr << "You get sent to jail after drawing the card!"
return
if(q=="Pay School tax of $150.")
usr << "You pay a school tax of $150."
usr.money -= 150
(returnPlayers()-usr) << "[usr] payed a school tax of $150."
return


usr in a proc (which is I guess what LandedOn is meant to be) is considered a no-no, this article goes a little way to explain why, and how you can tell if usr is appropriate:
http://www.byond.com/members/ DreamMakers?command=view_post&post=35932

This article might cover some things of interest to you in a more general sense:
http://www.byond.com/members/ DreamMakers?command=view_post&post=37940
simply an indentation error. any
if(q==
has to be aligned with
var/q

and I'd use
var/q=rand(1,5)
if(q==1)

It would shorten the code. Spelling it all out is unnecessary since they wont see that text.
In response to Quiet Screams
Quiet Screams wrote:
and I'd use
> var/q=rand(1,5)
> if(q==1)
>

It would shorten the code. Spelling it all out is unnecessary since they wont see that text.

^ Instead of "if(q==1); if(q==2); etc", use switch(q).