ID:139909
 
Code:
obj
cfb
icon='ICONS.dmi'
icon_state="CFB"
name="Chocolate Frog Box"
verb/Open()
pick()
prob(10)
var/obj/T=new/obj/WC(usr)
T.name="Morganna"
usr<<"You open the box and find the Morganna card!"
prob(20)
var/obj/T=new/obj/WC(usr)
T.name="Dumbledore"
usr<<"You open the box and find the Dumbledore card!"


Problem description:I don't know how to make this work randomly. It says proc definition not allowed inside another proc every time I compile it.
obj
cfb
icon='ICONS.dmi'
icon_state="CFB"
name="Chocolate Frog Box"
verb/Open()
pick( // expand the parentheses to cover everything related to pick()
prob(10)
var/obj/T=new/obj/WC(usr)
T.name="Morganna"
usr<<"You open the box and find the Morganna card!"
prob(20)
var/obj/T=new/obj/WC(usr)
T.name="Dumbledore"
usr<<"You open the box and find the Dumbledore card!"
) // This is where it would end.
In response to Duelmaster409
obj
cfb
icon='ICONS.dmi'
icon_state="CFB"
name="Chocolate Frog Box"
verb/Open()
pick( // expand the parentheses to cover everything related to pick()
prob(10)
var/obj/T=new/obj/WC(usr)
T.name="Morganna"
usr<<"You open the box and find the Morganna card!"
prob(20)
var/obj/T=new/obj/WC(usr)
T.name="Dumbledore"
usr<<"You open the box and find the Dumbledore card!"
) // This is where it would end.

Errors:Decorations.dm:1055:error: T: missing comma ',' or right-paren ')'
Decorations.dm:1055:error: T: expected end of statement
Decorations.dm:1061:error: ): expected }
Decorations.dm:1052:error: location of top-most unmatched {
In response to Colin1011
You can't use pick() for code blocks. If you look in the DM reference(F1 in Dream Maker), pick() returns a value. If you look for prob() in the reference, it tells you that it also returns a value.
What you want is for certain events to act different. In your case, you can have it like so:
var/obj/WC/T = new(usr)
T.name = pick(10;"Morganna", 20;"Dumbledore") // Who knows what will happen with the other 70% chance..?
usr << "You open the box and find the [name] card!"
In response to Kaiochao
Thanks, dude =D You're awesome.