Antique Slot Machine
A slot machine coded to work with a softcoded economy system.
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for Antique Slot Machine
@@ NOTES:
@@
@@ This slot machine was coded to work with the Dark Metal MUSH
@@ economy system.
@@
@@ The DM specific attributes are;
@@
@@ VCOST
@@ AVPAY
@@
@@ AVPAY is a list of commands triggered when someone uses the global
@@ command +pay on the slot machine.
@@ VCOST controls how much money is paid each time +pay is used
@@
@@ FUNC-PAYOFF may have to be changed depending on how +pay is handled
@@ on a particular MUSH.
@@
@@ You can change XS0, XS1, etc. to reflect whatever your slot machine
@@ shows (e.g. fruit, coals, etc.)
@@
@@ If you're interested in calculating the theoretical house edge,
@@ I have a C program that does that, but I refuse to write a MUSH
@@ program for it, so there! With the current settings, the machine
@@ definitely makes money.
@@ ------------------------------------------------------------------
@create slot machine=10
@lock slot machine=me
@set slot machine=COMMANDS
@Desc slot machine=[u(desc-slots)]%r%tThe window currently shows: [u(xstate)].%r%tThe bet is currently set at: [u(vcost)].
@Adesc slot machine=@pemit %#=Type '+pay [name(me)]' to play. Type 'bet <amount>' to change the size of the bet.(Maximum: [v(xmax)])
&DESC-SLOTS slot machine=%tThis is a rusty old antique of a slot machine. Heavy and cumbersome, mostly of metal. Someone has slapped flat-vids onto the outside, like so many oval and rectangular decals. These show scenes from various documentaries and movies of the Titanic. The slot which once took quarters now accepts money cards and nuyen. Still, when you pull the arm, you get a satisfying clanking and feeling of gears cranking and wheels turning.
&XSTATE slot machine=coal biplane ship
&XS0 slot machine=gold
&XS1 slot machine=ship
&XS2 slot machine=orange
&XS3 slot machine=biplane
&XS4 slot machine=coal
&XS5 slot machine=skeleton
&XS6 slot machine=wheel
&XS7 slot machine=clock
&XS8 slot machine=harp
&XS9 slot machine=sickle
&XS10 slot machine=car
&XMAX slot machine=500
&MESS-GO slot machine=[name(%0)] pulls the lever, and the wheels go round and round.
&MESS-STOP slot machine=The wheels stop and the window shows: [u(xstate)].
&MESS-J3 slot machine=[name(%0)] gets lucky at the slot machine!%b* DING DING DING * The bells and flashing lights go off on the slot machine. We have a winner! Jackpot!!!
&MESS-J2 slot machine=[name(%0)] strikes gold at the slot machine.%bYou hear the sound of simulated metal coins rattling into a cheap plastic cup.
&MESS-J1 slot machine=[name(%0)] strikes gold at the slot machine. You hear the sound of a few miserable coins dropping clatter-splat into a cheap plastic cup.
&FUNC-PAYOFF slot machine=th setq(0,u(func-go));&xstate me=[iter(%q0,v(xs##))];setq(1,u(func-result));@pemit %0=[u(mess-go,%0)];@wait 1={@pemit %0=[u(mess-stop)];};@wait 3={@emit [u(mess-j%q1,%0)];+pay %0=[u(func-pamt,%q1,%1)];}
&FUNC-RESULT slot machine=[switch(%q0,0 0 0,3,0 0 *,2,0 * 0,2,* 0 0,2,0 * *,1,* 0 *,1,* * 0,1,0)]
&FUNC-GO slot machine=[rand(9)] [rand(9)] [rand(9)]
&FUNC-PAMT slot machine=switch(%0,0,0,1,mul(%1,2),2,mul(%1,5),3,mul(%1,50),0)
&CMD-SETAMT slot machine=$bet *:@swi [gt(%0,[v(xmax)])]=1,{@pemit %#=The maximum bet is [u(xmax)];},{@pemit %#=You set the amount of the bet to %0. Type +pay [name(me)] to play.;&vcost me=[max(0,%0)];}
&AVPAY slot machine=@trig me/func-payoff=%#,[v(vcost)];;&xcount me=[add(v(xcount),1)];
&VCOST slot machine=20
@tr slot machine/AVPAY
@@
@@ This slot machine was coded to work with the Dark Metal MUSH
@@ economy system.
@@
@@ The DM specific attributes are;
@@
@@ VCOST
@@ AVPAY
@@
@@ AVPAY is a list of commands triggered when someone uses the global
@@ command +pay on the slot machine.
@@ VCOST controls how much money is paid each time +pay is used
@@
@@ FUNC-PAYOFF may have to be changed depending on how +pay is handled
@@ on a particular MUSH.
@@
@@ You can change XS0, XS1, etc. to reflect whatever your slot machine
@@ shows (e.g. fruit, coals, etc.)
@@
@@ If you're interested in calculating the theoretical house edge,
@@ I have a C program that does that, but I refuse to write a MUSH
@@ program for it, so there! With the current settings, the machine
@@ definitely makes money.
@@ ------------------------------------------------------------------
@create slot machine=10
@lock slot machine=me
@set slot machine=COMMANDS
@Desc slot machine=[u(desc-slots)]%r%tThe window currently shows: [u(xstate)].%r%tThe bet is currently set at: [u(vcost)].
@Adesc slot machine=@pemit %#=Type '+pay [name(me)]' to play. Type 'bet <amount>' to change the size of the bet.(Maximum: [v(xmax)])
&DESC-SLOTS slot machine=%tThis is a rusty old antique of a slot machine. Heavy and cumbersome, mostly of metal. Someone has slapped flat-vids onto the outside, like so many oval and rectangular decals. These show scenes from various documentaries and movies of the Titanic. The slot which once took quarters now accepts money cards and nuyen. Still, when you pull the arm, you get a satisfying clanking and feeling of gears cranking and wheels turning.
&XSTATE slot machine=coal biplane ship
&XS0 slot machine=gold
&XS1 slot machine=ship
&XS2 slot machine=orange
&XS3 slot machine=biplane
&XS4 slot machine=coal
&XS5 slot machine=skeleton
&XS6 slot machine=wheel
&XS7 slot machine=clock
&XS8 slot machine=harp
&XS9 slot machine=sickle
&XS10 slot machine=car
&XMAX slot machine=500
&MESS-GO slot machine=[name(%0)] pulls the lever, and the wheels go round and round.
&MESS-STOP slot machine=The wheels stop and the window shows: [u(xstate)].
&MESS-J3 slot machine=[name(%0)] gets lucky at the slot machine!%b* DING DING DING * The bells and flashing lights go off on the slot machine. We have a winner! Jackpot!!!
&MESS-J2 slot machine=[name(%0)] strikes gold at the slot machine.%bYou hear the sound of simulated metal coins rattling into a cheap plastic cup.
&MESS-J1 slot machine=[name(%0)] strikes gold at the slot machine. You hear the sound of a few miserable coins dropping clatter-splat into a cheap plastic cup.
&FUNC-PAYOFF slot machine=th setq(0,u(func-go));&xstate me=[iter(%q0,v(xs##))];setq(1,u(func-result));@pemit %0=[u(mess-go,%0)];@wait 1={@pemit %0=[u(mess-stop)];};@wait 3={@emit [u(mess-j%q1,%0)];+pay %0=[u(func-pamt,%q1,%1)];}
&FUNC-RESULT slot machine=[switch(%q0,0 0 0,3,0 0 *,2,0 * 0,2,* 0 0,2,0 * *,1,* 0 *,1,* * 0,1,0)]
&FUNC-GO slot machine=[rand(9)] [rand(9)] [rand(9)]
&FUNC-PAMT slot machine=switch(%0,0,0,1,mul(%1,2),2,mul(%1,5),3,mul(%1,50),0)
&CMD-SETAMT slot machine=$bet *:@swi [gt(%0,[v(xmax)])]=1,{@pemit %#=The maximum bet is [u(xmax)];},{@pemit %#=You set the amount of the bet to %0. Type +pay [name(me)] to play.;&vcost me=[max(0,%0)];}
&AVPAY slot machine=@trig me/func-payoff=%#,[v(vcost)];;&xcount me=[add(v(xcount),1)];
&VCOST slot machine=20
@tr slot machine/AVPAY