Fortune Wheel

A large fortune wheel that players can spin to try to win the jackpot.

Author: Sean@SluggyMUX
Category: Games
Functions: add(), get(), rand(), setunion(), v().
Features: color substitutions.
Compatibility: TinyMUX.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Fortune Wheel

@create %xh%xrF%xgo%xyr%xbt%xmu%xcn%xre %xgW%xyh%xbe%xme%xcl=10
@lock Fortune Wheel==me
@Pay Fortune Wheel=You put a 10 in the slot.
@Apay Fortune Wheel=@emit The large wheel on the contraption begins to spin.;&user me=%n;@trigger me/adduser;@trigger me/spin;&collect me=[add(get(me/collect),10)];&jackpot me=[add(get(me/jackpot),1)]
@Cost Fortune Wheel=10
&SPIN Fortune Wheel=@switch rand(10)=0, {:stops on the %ch%crred%cn area with the word 'zappo' on it. I wonder what that means...%ch%r%crZ%cgA%cyP%cbP%cmO%cc!%cn%r[get(me/user)] falls over, schorched. So *thats* what that means...},1, {:lands on the %ch%cggreen%cn. It bleeps: "Sorry, try again!"},2, {:lands on the %ch%cggreen%cn. It bleeps: "Sorry, try again!"},3, {:lands on the %ch%cggreen%cn. It bleeps: "Sorry, try again!"},4, {:lands on the %ch%cggreen%cn. It bleeps: "Sorry, try again!"},5, {:lands on the %ch%cyorange%cn. It bleeps: "Spin again!";@emit The large wheel on the contraption begins to spin.;@trigger me/spin},6, {:lands on the %ch%cyorange%cn. It bleeps: "Spin again!";@emit The large wheel on the contraption begins to spin.;@trigger me/spin},7, {:lands on the %ch%cyorange%cn. It bleeps: "Spin again!";@emit The large wheel on the contraption begins to spin.;@trigger me/spin},8, {:lands on the %ch%cwsilver%cn. It bleeps: "[get(me/user)] wins $20!";give [get(me/user)]=20;&payoff me=[add(get(me/payoff),20)]},9, {:lands on the %ch%crm%cgu%cyl%cbt%cmi%ccc%cro%cgl%cyo%cbr%cme%ccd%cn area. It bleeps: "[get(me/user)] wins the %ch%crj%cga%cyc%cbk%cmp%cco%crt%cg!%cb!%cm!%cn";give [get(me/user)]=[get(me/jackpot)];&payoff me=[add(get(me/payoff),get(me/jackpot))];&jackpot me=40}
@Desc Fortune Wheel=Its a wheel of fortune! Pay it 10 dollars and win, win, win! It has a circle divided into 10 sections:1 %crred%cn, 4 %cggreen%cn, 3 %cyorange%cn, 1 %cwsilver%cn, and 1 %crm%cgu%cyl%cbt%cmi%ccc%cro%cgl%cyo%cbr%cme%ccd%cn.%r(give wheel=10)%rCurrent Jackpot:$[get(me/jackpot)]%rTotal users:[get(me/users)]%rLast user:[get(me/user)]%rTotal money collected:$[get(me/collect)]%tTotal payoff:$[get(me/payoff)]
&ADDUSER Fortune Wheel=&users me=setunion(v(users),v(user))
@Adesc Fortune Wheel=@emit %n studies the fortune wheel, wondering if %s'll hit the jackpot.
&USER Fortune Wheel=Sean
&COLLECT Fortune Wheel=20
&JACKPOT Fortune Wheel=2
&USERS Fortune Wheel= Sean
&PAYOFF Fortune Wheel=20