Casino Script

By Stewie1k94 on Oct 30, 2011

Casino script by Stewie!

I have updated this slightly, please inform me of any bugs.

Commands: > !slots, !balance, !add/!del chips amount

All comments are welcome.

[8:49pm] <~Stewie> !add chips 100
[8:49pm] <&ThunderBolt> This is the correct format: !add chips .
[8:49pm] <~Stewie> !add chips Stewie 100
[8:49pm] <&ThunderBolt> Stewie has added 100 chips to Stewie's fund! Total: 100
[8:49pm] <~Stewie> -
[8:49pm] <~Stewie> !del chips
[8:49pm] <&ThunderBolt> This is the correct format: !del chips .
[8:49pm] <~Stewie> !del chips Stewie 50
[8:49pm] <&ThunderBolt> Stewie has removed 50 chips from Stewie's fund! Total: 50
[8:49pm] <~Stewie> -
[8:49pm] <~Stewie> !slots
[8:49pm] <&ThunderBolt> Stewie, Please use the correct syntax: !slots .
[8:50pm] <~Stewie> !slots 1
[8:50pm] <&ThunderBolt> The winning slots were: ( % )( $ )( $ )
[8:50pm] <&ThunderBolt> Sorry, you lose 1 chip/s
[8:50pm] <&ThunderBolt> Stewie, your new balance is 49
[8:50pm] ThunderBolt Please Wait 10 seconds if you want to play again.
[8:50pm] ThunderBolt You can now play again!
[8:50pm] <~Stewie> -
[8:50pm] <~Stewie> !balance
[8:50pm] <&ThunderBolt> Stewie currently has 49 chips.

Comma alias was made by Fibre0ptics

;;;;;;;;;;;;;;;;;;;;;;;;;;

;Please changed the number to suit your prefrence
;auto credits a user once they have reached 0 chip/s
;The default is currently set at 100

alias -l autoCredit return 100

;;;;;;;;;;;;;;;;;;;;;;;;;;
on $*:TEXT:/^!(add|del) chips( |$)/Si:#:{
  var %cmd = $regml(1)
  if (!$4) || ($4 !isnum)  { 
    msg $chan This is the correct format: $iif(%cmd == add,!add,!del) chips <nick> <amount of chips>.
    return
  }
  var %chips = $calc($read(CasinoChips.txt, s, $3) $iif(%cmd == add,+,-) $4)
  write -ds $+ $3 CasinoChips.txt 
  write CasinoChips.txt $3 %chips 
  msg $chan $read(CasinoChips.txt, s, $3)
  if (%cmd == add) msg $chan $nick has added $comma($4) chips to $3 $+ 's fund! Total: $comma(%chips)
  else { 
    msg $chan $nick has removed $comma($4) chips from $3 $+ 's fund! Total: $comma(%chips) 
  }
}
on $*:TEXT:/^!balance( |$)/Si:#:{
  var %f = $iif(!$2,$nick,$2), %balance = $read(CasinoChips.txt, s, %f)
  if (!$read(CasinoChips.txt, s, %f)) { msg $chan $nick $+ , %f currently has no chips. | return }
  msg $chan %f currently has $comma(%balance) chips. 
}
on $*:TEXT:/^!slots( |$)/Si:#:{
  var %cbalance = $read(CasinoChips.txt, s, $nick)
  if (%cbalance < $2) msg $chan $nick $+ , you only have %cbalance chips
  elseif (!$read(CasinoChips.txt, s, $nick)) msg $chan $nick $+ , You do not have anymore Chips to bet with.
  elseif ($2 == $null) || ($2 !isnum) msg $chan $nick $+ , Please use the correct syntax: !slots <bet here>.
  elseif ($2 < 0) msg $chan $nick $+ , Please use a positive number to bet with.
  else {
    set %prand $rand(1,175)
    set %srand1 $rand(1,5)
    set %srand2 $rand(1,5)
    set %srand3 $rand(1,5)
    while (%srand1 == %srand2) {
      set %srand2 $rand(1,5)
    }
    if (%prand < 5) {
      set %srand1 3
      set %srand2 3
      set %srand3 3
    }
    elseif (%prand < 15) {
      set %srand1 2
      set %srand2 2
      set %srand3 2
    }
    elseif (%prand < 30) {
      set %srand1 1
      set %srand2 1
      set %srand3 1
    }
    if (%srand1 == 1) set %srand1 @ 
    if (%srand1 == 2) set %srand1 % 
    if (%srand1 == 3) set %srand1 $ 
    if (%srand1 == 4) set %srand1 & 
    if (%srand1 == 5) set %srand1 ! 
    if (%srand2 == 1) set %srand2 @ 
    if (%srand2 == 2) set %srand2 % 
    if (%srand2 == 3) set %srand2 $ 
    if (%srand2 == 4) set %srand2 & 
    if (%srand2 == 5) set %srand2 ! 
    if (%srand3 == 1) set %srand3 @ 
    if (%srand3 == 2) set %srand3 % 
    if (%srand3 == 3) set %srand3 $ 
    if (%srand3 == 4) set %srand3 & 
    if (%srand3 == 5) set %srand3 ! 
    set %win1 $2
    set %win2 $calc( $2 * 5 )
    set %win3 $calc( $2 * 10 )
    set %awins 0
    msg $chan The winning slots were: ( %srand1 )( %srand2 )( %srand3 )
    if (%srand1 == @) if (%srand2 == @) if (%srand3 == @) {
      if (%srand1 == %srand2 && %srand2 == %srand3) {
        if ($calc( %win1 * 2 ) > %awins) set %awins $calc( %win1 * 2 )
      }
    }
    if (%srand1 == % || %srand2 == % || %srand3 == %) {
      if (%srand1 == %srand2 && %srand2 == %srand3) {
        if (%win2 > %awins) set %awins %win2
      }
    }
    if (%srand1 == $ || %srand2 == $ || %srand3 == $) {
      if (%srand1 == %srand2 && %srand2 == %srand3) {
        if (%win3 > %awins) set %awins %win3
      }
    }
    if (%awins == 0) {
      msg # Sorry, you lose $comma($2) chip/s
      write -ds $+ $nick CasinoChips.txt
      set %outval $calc( %cbalance - $2 )
      write CasinoChips.txt $nick %outval
    }
    else {
      msg # Well done! You win $comma(%awins) chips!
      write -ds $+ $nick CasinoChips.txt
      set %outval $calc(( %cbalance - $2 ) + %awins ))
      write CasinoChips.txt $nick %outval
    }
    msg # $nick $+ , your new balance is $comma($read(CasinoChips.txt, s, $nick))
    if ($read(CasinoChips.txt, s, $nick) == 0) { 
      write -ds $+ $nick CasinoChips.txt 
      write CasinoChips.txt $nick $autoCredit
      .notice $nick You reached 0 chips, and have been auto-credited with $autoCredit chip
    }
    notice $nick Please Wait 10 seconds if you want to play again.
    ignore -cu10 $nick
    $+(.timer,.,$nick,.slots) 1 10 notice $nick You can now play again!
  }
}
;Comma alias made by Fibre0ptics
alias -l comma {
  var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a)
  return %a
}

Comments

Sign in to comment.
cptpan   -  Aug 03, 2017

Anyone can give anyone chips with the !add command. WTF?

 Respond  
dma   -  Dec 15, 2015

nice still working in my #casino on irc.axon.pw

 Respond  
lking1231   -  Sep 29, 2013

i didnt understand where to put it on my scripts and how to use please help me

Kaj  -  Sep 29, 2013

Just open ur script editor in mIRC (alt+r or tools->script editor) then file->new, paste the script click OK and it'll work :>

lking1231  -  Sep 30, 2013

where i need to put it in remote in alliases in popus? and how to add money to ppls or del or check the balance?

Kaj  -  Sep 30, 2013

You have to put it in remote :)
I don't know about how to add money, but check the explenation of the script above, it's all explained there.
Note that the ! commands won't work from within your mIRC where you put the script in, you've to open a second client and execute the commands

Sign in to comment

Stewie1k94   -  Feb 11, 2012

Was there any need to post that?

vorvoros  -  May 25, 2015

i would like for a specific account to be able to add coins is this possible?

Stewie1k94  -  Jul 30, 2015

You mean a specific person, or?

dma  -  Jan 08, 2016

in your remotes come one dont you know that (:D)-----------<----------<

Sign in to comment

cptpan   -  Feb 10, 2012

where is a fucken decent casino bot

 Respond  
Stewie1k94   -  Nov 02, 2011

Acctualy responding is talking to me :P

 Respond  
_Dean_   -  Nov 02, 2011

i dont talk with animals, im not dr. dolittle

 Respond  
Stewie1k94   -  Nov 02, 2011

If you want a/an argument, tell me, we can have it here if you like?

 Respond  
Stewie1k94   -  Nov 02, 2011

IllogicTC wrote:

Nice start. I would like to see more added in the future, at least simplistic games. Maybe Blackjack? If you're not looking for tons of interaction with the bot before getting to the part where you win or lose, make it like "Streamlined Blackjack", where you and the dealer are given a number $rand(4,21) and whoever is higher wins. There's lots of gambling games to choose from. Good luck in your endeavours if you decide to expand this script. And i will see what i can do :)

 Respond  
Jethro   -  Nov 01, 2011

If you want to talk about being lame, your regsubex construction is as lame as it gets. You already indicatate $chr(32) as the token separator. Why would you bother adding the $chr(124) for no good reason but redundancy?

 Respond  
IllogicTC   -  Nov 01, 2011

Nice start. I would like to see more added in the future, at least simplistic games. Maybe Blackjack? If you're not looking for tons of interaction with the bot before getting to the part where you win or lose, make it like "Streamlined Blackjack", where you and the dealer are given a number $rand(4,21) and whoever is higher wins. There's lots of gambling games to choose from. Good luck in your endeavours if you decide to expand this script.

 Respond  
Stewie1k94   -  Nov 01, 2011

Acctualy, i feel like a/an argument, want one?

 Respond  
Stewie1k94   -  Nov 01, 2011

Yep, he has it saved in a text file, LMAO

 Respond  
Stewie1k94   -  Nov 01, 2011

Lol, now waits for Dean to add his comments again.

 Respond  
Jethro   -  Nov 01, 2011

And yet he calls everybody a troll. I won't use regsubex because it's not much different from the while loop version you showed, consumes more bytes than my tokenize method, and not backward compatible to any version below 6.17. Besides regsubex and while loop, you got any novel idea in mind? I suppose not.

 Respond  
Stewie1k94   -  Nov 01, 2011

Dean wrote:

how idiot, i bet you did it using noop Do you really expect to be respected with remarks like that? Until you can respect me and others, you will be getting none from me

 Respond  
Jethro   -  Nov 01, 2011

He thinks this is some sort of a contest. Furthermore, his regsubex demonstration is a big failure. It doesn't work. lol

 Respond  
Stewie1k94   -  Nov 01, 2011

I bet he has this saved in a text file, so he don't have to type it all out again xD

 Respond  
Stewie1k94   -  Nov 01, 2011

Add them again, if you like, i can remove them again.

 Respond  
Jethro   -  Nov 01, 2011

Dean wrote:> feel free to delete this commentWhy can't you be nice and say, "Please don't delete my comment. I beg of you. Allow me to have my voice heard?" What you wrote basically asked tocflane1 to do it so you could have another chance to resume the vicious ordeal.

 Respond  
Stewie1k94   -  Oct 31, 2011

Rofl

 Respond  
Jethro   -  Oct 31, 2011

I'm just gonna post this to wear off Dean's ignorance:

//tokenize 32 1 2 3 | scon -r set $!+(%,srand, $* ) $!replace($(,$+(%,srand, $* )),1,@,2,%,3,$,4,&,5,!)
 Respond  
Stewie1k94   -  Oct 31, 2011

Comment removed again, wait's for Dean to add it again. :P

 Respond  
Stewie1k94   -  Oct 31, 2011

Dean I forgot to put any comments welcome (Except Dean's) LOL, and you carry on, i am not bothered to be honest, if you want keep your arguments going on this thread right here, i don't mind.

 Respond  
Stewie1k94   -  Oct 31, 2011

And goodbye to Dean's comment :D

 Respond  
Jethro   -  Oct 31, 2011

fraguk, this is not some sort of a family fugue. What's the point of your comment but an added incitement?

 Respond  
fraguk   -  Oct 31, 2011

And her we go again, now now girls play fair.

 Respond  
Jethro   -  Oct 31, 2011

Dean you can disrespect people all you want, and they shouldn't do jack to you? What kind of a selfish human being are you?

Keep up the good work, toclafane1. You don't have to take his insulting teaching crap.

P.S. You may delete his comment for disrespecting you.

 Respond  
Stewie1k94   -  Oct 30, 2011

Thanks for your kind comment, much appreciated.

And:

Dean wrote: > 5 - i can enumerate a lot of problems in this code, for someone who called me a noob, you need to revise your codes

now, Jethro posting below Your not going to keep this argument going are you?

dma  -  Nov 09, 2015

I got a question, i have this bot in two channels how can not play it on one of my channel?

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.