wowDe Kus wrote:you should at least give the specs of such a script. meaning the names of the slot entries, the starting money and winning chance (real slot machines run at about 70%).
Code: Select all
tag when posting logs, code
Code: Select all
on $*:text:/^[!](p(lay)?)?(slot(s)?)/Si:# : {
if (%slots) { msg $chan Please wait a few seconds $nick $+ . }
if (!%slots) {
dec -u5 %slots
$iif(!$hget(Slots), hmake Slots 1000)
if ($2 < 1) { msg $chan Pick a number higher than that $nick $+ . | goto slotend }
if (!$hget(Slots,$nick)) { msg $chan I am sorry $nick $+ , I can not seem to find your account so you can play. Please type !snew to make one. | goto slotend }
if ($left($2,1) == $chr(45)) { msg $chan You can not use negative numbers $nick $+ . | goto slotend }
if ($2 && $2 !isnum) { msg $chan You can only bet numerical values $nick $+ . | goto slotend }
if ($2) {
if (($calc($hget(Slots,$nick) - $round($2,0)) < 1)) { msg $chan You can not wager that much $nick as you only have $+($chr(36),$comma($hget(Slots,$nick)),.) | goto slotend }
}
if (!$2) {
if (($calc($hget(Slots,$nick) - 5) < 1)) { msg $chan You can not wager that much $nick as you only have $+($chr(36),$comma($hget(Slots,$nick)),.) | goto slotend }
}
var %T $r(1,6)
if (%T == 1 || %T == 3 || %T == 6) { var %T $rand(1,9) $rand(1,9) $rand(1,9) }
if (%T == 2 || %T == 4) { var %T $rand(1,9) $rand(1,9) $rand(1,9) $rand(1,9) }
if (%T == 5) { var %T $rand(1,9) $rand(1,9) $rand(1,9) $rand(1,9) $rand(1,9) }
hdec Slots $nick $iif($2,$round($2,0),5)
msg $chan $+($chr(2),Numbers:,$chr(2)) %T $chr(5) $colored($+($nick,:),4) $+($chr(36),$comma($hget(Slots,$nick)))
if ($len(%T) = 5) {
if ($matchtok(%T,1,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 100), 100) | msg $chan Congrats $+($nick,!) You just won 100 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,2,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 125), 125) | msg $chan Congrats $+($nick,!) You just won 125 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,3,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 140), 140) | msg $chan Congrats $+($nick,!) You just won 140 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,4,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 175), 175) | msg $chan Congrats $+($nick,!) You just won 175 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,5,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 185), 185) | msg $chan Congrats $+($nick,!) You just won 185 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,6,3,32)) { hdec Slots $nick 300 | msg $chan Ouch. It looks like you just hit the unlucky number. You lose 300 dollars because of it. $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,7,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 500), 500) | msg $chan JACKPOT!! Congrats $+($nick,!)!! You just hit the jackpot and won 500 dollars!! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,8,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 200), 200) | msg $chan Congrats $+($nick,!) You just won 200 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,9,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 250), 250) | msg $chan Congrats $+($nick,!) You just won 250 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
}
if ($len(%T) = 7) {
if ($matchtok(%T,1,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 200), 200) | msg $chan Congrats $+($nick,!) You just won 200 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,2,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 250), 250) | msg $chan Congrats $+($nick,!) You just won 250 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,3,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 280), 280) | msg $chan Congrats $+($nick,!) You just won 280 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,4,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 350), 350) | msg $chan Congrats $+($nick,!) You just won 350 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,5,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 370), 370) | msg $chan Congrats $+($nick,!) You just won 370 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,6,4,32)) { hdec Slots $nick 400 | msg $chan Ouch. It looks like you just hit the unlucky number. You lose 400 dollars because of it. $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,7,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 1000), 1000) | msg $chan JACKPOT!! Congrats $+($nick,!)!! You just hit the jackpot and won 1000 dollars!! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,8,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 400), 400) | msg $chan Congrats $+($nick,!) You just won 400 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,9,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 500), 500) | msg $chan Congrats $+($nick,!) You just won 500 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,1,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 100), 100) | msg $chan Congrats $+($nick,!) You just won 100 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,2,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 125), 125) | msg $chan Congrats $+($nick,!) You just won 125 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,3,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 140), 140) | msg $chan Congrats $+($nick,!) You just won 140 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,4,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 175), 175) | msg $chan Congrats $+($nick,!) You just won 175 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,5,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 185), 185) | msg $chan Congrats $+($nick,!) You just won 185 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,6,3,32)) { hdec Slots $nick 300 | msg $chan Ouch. It looks like you just hit the unlucky number. You lose 300 dollars because of it. $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,7,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 500), 500) | msg $chan JACKPOT!! Congrats $+($nick,!)!! You just hit the jackpot and won 500 dollars!! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,8,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 200), 200) | msg $chan Congrats $+($nick,!) You just won 200 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,9,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 250), 250) | msg $chan Congrats $+($nick,!) You just won 250 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
}
if ($len(%T) = 9) {
if ($matchtok(%T,1,5,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 300), 300) | msg $chan Congrats $+($nick,!) You just won 300 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,2,5,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 375), 375) | msg $chan Congrats $+($nick,!) You just won 375 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,3,5,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 420), 420) | msg $chan Congrats $+($nick,!) You just won 420 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,4,5,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 525), 525) | msg $chan Congrats $+($nick,!) You just won 525 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,5,5,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 555), 555) | msg $chan Congrats $+($nick,!) You just won 555 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,6,5,32)) { hdec Slots $nick 500 | msg $chan Ouch. It looks like you just hit the unlucky number. You lose 500 dollars because of it. $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,7,5,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 1500), 1500) | msg $chan JACKPOT!! Congrats $+($nick,!)!! You just hit the jackpot and won 1500 dollars!! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,8,5,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 600), 600) | msg $chan Congrats $+($nick,!) You just won 600 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,9,5,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 750), 750) | msg $chan Congrats $+($nick,!) You just won 750 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,1,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 200), 200) | msg $chan Congrats $+($nick,!) You just won 200 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,2,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 250), 250) | msg $chan Congrats $+($nick,!) You just won 250 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,3,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 280), 280) | msg $chan Congrats $+($nick,!) You just won 280 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,4,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 350), 350) | msg $chan Congrats $+($nick,!) You just won 350 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,5,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 370), 370) | msg $chan Congrats $+($nick,!) You just won 370 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,6,4,32)) { hdec Slots $nick 400 | msg $chan Ouch. It looks like you just hit the unlucky number. You lose 400 dollars because of it. $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,7,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 1000), 1000) | msg $chan JACKPOT!! Congrats $+($nick,!)!! You just hit the jackpot and won 1000 dollars!! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,8,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 400), 400) | msg $chan Congrats $+($nick,!) You just won 400 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,9,4,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 500), 500) | msg $chan Congrats $+($nick,!) You just won 500 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,1,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 100), 100) | msg $chan Congrats $+($nick,!) You just won 100 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,2,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 125), 125) | msg $chan Congrats $+($nick,!) You just won 125 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,3,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 140), 140) | msg $chan Congrats $+($nick,!) You just won 140 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,4,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 175), 175) | msg $chan Congrats $+($nick,!) You just won 175 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,5,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 185), 185) | msg $chan Congrats $+($nick,!) You just won 185 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,6,3,32)) { hdec Slots $nick 300 | msg $chan Ouch. It looks like you just hit the unlucky number. You lose 300 dollars because of it. $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,7,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 500), 500) | msg $chan JACKPOT!! Congrats $+($nick,!)!! You just hit the jackpot and won 500 dollars!! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,8,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 200), 200) | msg $chan Congrats $+($nick,!) You just won 200 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
if ($matchtok(%T,9,3,32)) { hinc Slots $nick $iif($2, $calc(($round($2,0) * $rand(1,5)) + 250), 250) | msg $chan Congrats $+($nick,!) You just won 250 dollars! $+([,$colored($+($chr(36),$comma($hget(Slots,$nick))),4),]) | goto slotend }
}
:slotend hsave Slots Slots.dat
}
}
on *:text:!smoney*:#:{
if (!$2) { msg $chan $nick $iif($hget(Slots,$nick), has $+($chr(36),$comma($hget(Slots,$nick))) dollars., is broke.) }
if ($2 == $me) { msg $chan I am rich! Fear me! }
if ($2 != $me) { $iif($2 = top, smoney, $iif(!$hget(Slots,$2), msg $chan Error. There is no $2 in my database., msg $chan $2 has $+($chr(36),$comma($hget(Slots,$2))) dollars.)) }
}
on *:text:!snew:#:{
if (!$hget(Slots,$nick)) {
hadd Slots $nick 1000
.notice $nick A new character has been created. You have $+($chr(36),1000) free dollars to spend.
hsave Slots Slots.dat
}
if ($hget(Slots,$nick)) { .notice $nick You already have an account. }
}
on *:text:!sreset*:#: {
if (!$2) {
if (!$hget(Slots,$nick)) { msg $chan You do not have an account for Slots $+($nick,.) }
if ($hget(Slots,$nick)) {
if ($hget(Slots,$nick) >= 5) { msg $chan You already have $+($chr(36),5) or more dollars so no reset $+($nick,.) $+([,$chr(36),$comma($hget(Slots,$nick)),]) }
if ($hget(Slots,$nick) < 5) {
hadd Slots $nick 1000
msg $chan $+($nick,'s) money has been reset to $+($chr(36),1000.)
hsave Slots Slots.dat
}
}
}
if ($2) {
if (!$hget(Slots,$2)) { msg $chan $2 does not have an account for Slots. }
if ($hget(Slots,$2)) {
if ($hget(Slots,$2) >= 5) { msg $chan $2 already has $+($chr(36),5) or more dollars so no reset. $+([,$chr(36),$comma($hget(Slots,$2)),]) }
if ($hget(Slots,$2) < 5) {
hadd Slots $2 1000
msg $chan $+($2,'s) money has been reset to $+($chr(36),1000.)
hsave Slots Slots.dat
}
}
}
}
on *:text:!shelp:#: {
.timer 1 2 .notice $nick To create a Slots account type !Snew and $1000 dollars will be credited to your Slots account.
.timer 1 3 .notice $nick To begin a game Slots use !Playslots , !Playslot , !Pslots , !Pslot , !Slots or !Slot to wager a default amount of $+($chr(36),5.)
.timer 1 4 .notice $nick To wager more than the default $+($chr(36),5) use !Playslots $chr(35) , !Playslot $chr(35) , !Pslots $chr(35) , !Pslot $chr(35) , !Slots $chr(35) or !Slot $chr(35)
.timer 1 5 .notice $nick To view your money or another's money use !Smoney or !Smoney nick
}
alias smoney {
var %d = 1, %w = @rank, %t = slots
window -hn %w
while $hget(%t,%d).item {
aline %w $v1 $hget(%t,$v1)
inc %d
}
filter -cteuww 2 32 %w %w
set %smoney $line(%w,1)
window -c %w
write -c slots.txt %smoney
tokenize 32 $read(slots.txt)
msg $chan Slots: $colored($1,4) with $+($chr(36),$comma($2)) dollars | unset %smoney | .remove slots.txt
}
;Usage: $comma(number)
alias comma {
var %a, %b = $regsub($ticks,$$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a)
return %a
}
; Usage: $colored(TEXT,N1,N2) or $colored(TEXT,N1,N2).b
; N1 & N2 are both optional.
alias colored { if ($isid) { return $+($iif($prop = b,$chr(2)),$iif($2 isnum 0-15,$+($chr(3),$iif($len($2) == 1,$+($chr(48),$2),$2))),$iif($3 isnum 0-15,$+($chr(44),$iif($len($3) == 1,$+($chr(48),$3),$3))),$1,$chr(15)) } }