ok this is most likely the final update for this script. as far as i know there is no more stuff i can add to it. i hope you love this script. it is very fun to play. most of the credit goes to napa182 for this update.
*** Features!
play counter
win counter
chips
bets
reset all
start with 200 chips
note the betting is pretty useless at the probability of winning. if you want to use the betting i would change the rand from (1,10) to (1,3)
alias sm { dialog -m slots slots }
menu status,channel {
slots:/sm
}
dialog Slots {
title "Slot Machine Game"
size -1 -1 87 87
option dbu
box "Outcome", 5, 2 2 83 30
edit "", 6, 6 11 16 10, read center
edit "", 7, 35 11 17 10, read center
edit "", 8, 64 11 17 10, read center
text "", 9, 6 22 75 8, center
button "——=Spin=——", 10, 2 33 83 10, flat
box "Betting", 11, 30 65 56 20
button "Bet", 12, 32 73 27 10, flat
edit "", 13, 61 73 23 10, autohs center
box "Plays", 14, 2 45 27 19
text "", 15, 3 53 25 8, center
box "Chip's", 16, 30 45 27 19
text "", 17, 31 53 25 8, center
box "Win's", 18, 58 45 27 19
text "", 19, 59 53 25 8, center
box "ReSet", 20, 2 65 27 20
button "ReSet", 21, 4 73 23 10, flat
menu "&tools", 1
item "&help", 2, 1
menu "&close", 3
item "&exit", 4, 3, cancel
}
on *:dialog:slots:init:0:{
did -a $dname 15 %splays
did -a $dname 17 %schips
did -a $dname 19 %wins
}
on *:dialog:Slots:menu:2:{
noop $input(This is a great game to play at anytime. $crlf your bet will reset every round. $crlf you will always win 5 chips for a win even if you don't bet. $crlf i hope you enjoy this dialog that i made. have fun $crlf Made By Pwnisher3,odi,Help)
}
on *:DIALOG:slots:sclick:*:{
if ($did == 21) { set %wins 0 | set %splays 0 | set %schips 0 | did -r $dname 15,17,19 | did -a $dname 15 %splays | did -a $dname 17 %schips | did -a $dname 19 %wins }
if ($did == 12) {
if ($did(13).text !isnum $+(1-,%schips) || $did(13).text !isnum) {
noop $iif($did(13).text !isnum,$input(You Must Bet $+(1-,%schips) Amount Of Chips,odh,Error),$iif($did(13).text !isnum $+(1-,%schips),$input(Sorry You Dont Have That Many Chip's,odh,Error))) | did -r $dname 13 }
else { set %sbet $did(13).text }
}
if ($did == 10) {
var %^ = $r(1,10), %$ = $r(1,10), %@ = $r(1,10)
inc %splays 1
did -r $dname 6-9,15,13
did -a $dname 15 %splays
did -a $dname 6 %^
did -a $dname 7 %$
did -a $dname 8 %@
did -a $dname 9 $iif($did(6) = $did(7) && $did(7) = $did(8),You win!,You lose!)
if ($did(9).text == You win! && !%sbet) { inc %wins 1 | inc %schips 5 | did -ra $dname 17 %schips | did -ra $dname 19 %wins }
elseif (%sbet) {
$iif($did(9).text == You win!,inc %schips %sbet,dec %schips %sbet)
$iif($did(9).text == You win!,inc %wins 1)
did -ra $dname 19 %wins
did -ra $dname 17 %schips
unset %sbet
}
}
}
Fixed your code a bit for you. When using the menu and item options you need to use a & before it as shown in the fixed version below.
alias sm { dialog -m slots slots }
menu status,channel {
slots:/sm
}
dialog slots {
Title "Slot Machine Game"
size -1 -1 100 45
option dbu
menu "&tools", 5
item "&help", 6, 5
menu "&close", 7
item "&exit", 8, 7
button "Spin!",1, 30 18 40 15
edit "", 2, 5 5 20 10
edit "", 3, 40 5 20 10
edit "", 4, 75 5 20 10
edit "", 9, 30 33 40 10
}
on *:DIALOG:slots:*:*:{
if ($devent = sclick) {
if ($did == 1) {
did -r slots 2-4,9
did -a slots 2 $rand(1,10)
did -a slots 3 $rand(1,10)
did -a slots 4 $rand(1,10)
did -a slots 9 $iif($did(2) = $did(3) && $did(3) = $did(4),You win!,You lose!)
}
}
if ($devent == menu) {
if ($did == 6) { dialog -m Help-slots Help-slots }
if ($did == 8) { dialog -x slots slots }
}
}
dialog Help-slots {
title "Slots Game Help"
size -1 -1 150 100
option pixels
box "help", 1, 1 1 148 98
}