Gambling script

By Joel-Kun on May 26, 2008

Okay, so I redid the script, after all it kind of sucked from the start. I used the "'" trigger because no one else I know used it. But I changed it up a bit. The new version doesn't have roulette, since that was just a pain, plus there were too many things to idiot proof. New Commands: 'dice (opponents name here), 'self, 'loan and 'stats

Dice: throws dice with an opponent, betting that you'll get a higher number.
Self: allows you to gamble with yourself between either dice or a slot machine.
Loan: sets your money back to 100, and if you don't have money, it does the same.
Stats: allows you to see the amount of money you, or a given nick has left.

So yeah, enjoy :D
Plus I also made a cheat for a master/person you trust very much, so you always win xD
just type /master and enter the person's nick in the box :D
Have fun!
I'll have a 'ghelp command soon, but at the moment I'm a little busy.

 JJJJJJ    OOOO    EEEEEE  LL           KK   KK  UU   UU   N     N  ''   SSSSSS
 JJJJJJ  OO    OO  EE      LL     ____  KK KK    UU   UU   N N   N '  ' S
   JJ    OO    OO  EEEE    LL    |____| KK       UU   UU   N  N  N | /   SSSSSS
JJ JJ    OO    OO  EE      LL           KK KK    UU   UU   N   N N             S
 JJJ       OOOO    EEEEEE  LLLLLL       KK   KK   UUUUU    N     N       SSSSSS

                           ;Gambling Script;

alias master {
set %master $$?="Who's the great master?"
}
alias slot {
  set %slot1 $r(1,4)
  set %slot2 $r(1,4)
  set %slot3 $r(1,4)
  if (%slot1 = 1) { set %slot1 4@ }
  if (%slot1 = 2) { set %slot1 7© }
  if (%slot1 = 3) { set %slot1 12£ }
  if (%slot1 = 4) { set %slot1 7 }
  if (%slot2 = 1) { set %slot2 4@ }
  if (%slot2 = 2) { set %slot2 7© }
  if (%slot2 = 3) { set %slot2 12£ }
  if (%slot2 = 4) { set %slot2 7 }
  if (%slot3 = 1) { set %slot3 4@ }
  if (%slot3 = 2) { set %slot3 7© }
  if (%slot3 = 3) { set %slot3 12£ }
  if (%slot3 = 4) { set %slot3 7 }
}
alias win {
  set %gamoney [ $+ [ %challenge ] ] $calc(%gamoney [ $+ [ %challenge ] ] + %wager)
  set %gamoney [ $+ [ %oppo ] ] $calc(%gamoney [ $+ [ %oppo ] ] - %wager)
}
alias lose {
  set %gamoney [ $+ [ %challenge ] ] $calc(%gamoney [ $+ [ %challenge ] ] - %wager)
  set %gamoney [ $+ [ %oppo ] ] $calc(%gamoney [ $+ [ %oppo ] ] + %wager)
}
on *:text:'dice*:#: {
  if (%gambling == on) { msg $chan There is already a game going on, please be patient. | halt }
  if (!$2) { msg $chan $nick $+ , you need to specify a person to gamble with and a money amount. | halt }
  elseif (!$3) { msg $chan $nick $+ , you need to specify an amount of money. | halt }
  if ($2 == $me) { msg $chan I has no moneys :3 | halt }
  if ($2 == $nick) { msg $chan You can't gamble against yourslef. | halt }
  if ($2 !ison $chan) { msg $chan $2 isn't on the channel | halt }
  if (%gamoney [ $+ [ $nick ] ] == $null) { msg $chan $nick $+ , you have no money, type 'loan to get it | halt }
  if (%gamoney [ $+ [ $nick ] ] != $null) {
    if (%gamoney [ $+ [ $2 ] ] == $null) { msg $chan $2 doesn't even have money :/ | halt }
    if (%gamoney [ $+ [ $nick ] ] < $3) { msg $chan You don't have enough money to play | halt }
    if (%gamoney [ $+ [ $2 ] ] < $3) { msg $chan $2 doesn't have enough money to play | halt }
    set %challenge $nick
    set %wager $3
    set %gambling on
    set %tempoppo $2
    msg $chan %tempoppo $+ , If you except %challenge $+ 's challenge of dice for %wager dollars, type 'go, and if not type 'end
  }
}
on *:text:'end:#: {
  if (%challenge == $nick) { msg $chan You can't negatively turn down your self, it hurts your ego... | halt }
  if ($nick != %tempoppo) { msg $chan %challenge didn't challenge you | halt }
  if (%challenge == $null) && (%tempoppo == $null) { msg $chan No one has challenged you yet... | halt }
  msg $chan Sorry %challenge $+ , $nick turned down your offer.
  unset %challenge
  unset %wager
  unset %tempoppo
  set %gambling off
}
on *:text:'go:#: {
  if ($nick == %challenge) { msg $chan You can't challenge yourslef stupid. | halt }
  if ($nick != %tempoppo) && (%challenge != $null) { msg $chan %challenge didn't challenge you | halt } 
  if (%challenge == $null) && (%tempoppo == $null) { msg $chan There is no one to challenge your gamble. | halt }
  msg $chan So you except %challenge $+ 's challenge? Okay then....
  msg $chan Say 'play to commense.
  unset %tempoppo
  set %oppo $nick
}
on *:text:'play*:#: {
  if (%gambling != on) { msg $chan No one has made a challenge yet | halt }
  if ($nick != %challenge) && ($nick != %oppo) { halt }
  if ($nick == %oppo) && (%chwaiting == on) {
    msg $chan Now we commense %challenge vs %oppo $+ !
    unset %chwaiting
    unset %opwaiting
    goto strt
  }
  if ($nick == %challenge) && (%opwaiting == on) {
    msg $chan Now we commense %challenge vs %oppo $+ !
    unset %opwaiting
    unset %chwaiting
    goto strt 
  }
  if ($nick == %challenge) && (%opwaiting != on) { 
    set %opwaiting on
    set %chwaiting on
    msg $chan Now %oppo $+ , say 'play 
    halt
  }
  if ($nick == %oppo) && (%chwaiting != on) {
    set %chwaiting on
    set %opwaiting on
    msg $chan Now %challenge $+ , say 'play 
    halt
  }
  :strt
  set %roll1 $r(1,6)
  set %roll2 $r(1,6)
  if (%challenge == %master) { set %roll1 999 | goto ultracheap }
if (%challenge == %master) { set %roll2 999 | goto ultracheao }  
:ultracheap
  msg $chan %challenge rolls a [4 $+ %roll1 $+ 1]
  msg $chan %oppo rolls a [4 $+ %roll2 $+ 1]
  if (%roll1 > %roll2) { 
    msg $chan %challenge won against %oppo $+ !
    win
    msg $chan %challenge now has %gamoney [ $+ [ %challenge ] ] dollars and...
    msg $chan %oppo now has %gamoney [ $+ [ %oppo ] ] dollars.
    msg $chan Nice Game!
  }
  if (%roll1 < %roll2) { 
    msg $chan %oppo won against %challenge $+ !
    lose
    msg $chan %challenge now has %gamoney [ $+ [ %challenge ] ] dollars and...
    msg $chan %oppo now has %gamoney [ $+ [ %oppo ] ] dollars.
    msg $chan Nice Game!
  }
  if (%roll1 == %roll2) {
    msg $chan It was a tie between %challenge and %oppo $+ !
    msg $chan %challenge still has %gamoney [ $+ [ %challenge ] ]
    msg $chan And %oppo stll has %gamoney [ $+ [ %oppo ] ]
    msg $chan Good try.
  }
  unset %challenge
  unset %oppo
  unset %roll1
  unset %roll2 
  set %gambling off
}
on *:text:'loan:#: {
  set %gamoney [ $+ [ $nick ] ] 100 
  msg $chan There you go $nick $+ , you know have %gamoney [ $+ [ $nick ] ] dollars... 
}
on *:text:'stats*:#: {
  if ($2 != $null) { msg # $nick $+ , $2 $+ 's money amount is %gamoney [ $+ [ $2 ] ] dollars. }
  else { msg # $nick $+ , you have %gamoney [ $+ [ $nick ] ] dollars left. }
}
on *:text:'self*:#: {
  set %wager $2
  if ($3 == dice) {
    set %selfroll $r(1,6)
    set %myroll $r(1,6)
    if ($nick == %master) { set %selfroll 999 | goto supacheata }
    :supacheata
    msg $chan $nick rolls a [4 $+ %selfroll $+ 1]
    msg $chan $me rolls a [4 $+ %myroll $+ 1]
    if (%myroll > %selfroll) { 
      msg $chan Sorry I win :D
      set %gamoney [ $+ [ $nick ] ] $calc(%gamoney [ $+ [ $nick ] ] - %wager)
      msg $chan You know have %gamoney [ $+ [ $nick ] ] dollars!
      unset %selfroll
      unset %myroll
      halt
    }
    if (%myroll < %selfroll) {
      msg $chan Darn, you win :/
      set %gamoney [ $+ [ $nick ] ] $calc(%gamoney [ $+ [ $nick ] ] + %wager)
      msg $chan You know have %gamoney [ $+ [ $nick ] ] dollars!
      unset %Selfroll
      unset %myroll
      halt
    }
    if (%myroll == %selfroll) { msg $chan Aww man, we tied :p | msg $chan You still have %gamoney [ $+ [ $nick ] ] dollars! }
    unset %selfroll
    unset %myroll
    halt
  }

  if ($3 == slots) {
    if ($nick == %master) { set %slot1 7 | set %slot2 7 | set %slot3 7 | goto mastercheat }
    slot
    :mastercheat
    msg $chan The machine is spinning....
    msg $chan Slot 1 shows the %slot1 symbol...
    msg $chan Slot 2 shows the %slot2 symbol...
    msg $chan Slot 3 shows the %slot3 symbol...
    msg $chan The machine shows %slot1 $+ %slot2 $+ %slot3
    if (%slot1 == %slot2) && (%slot1 == %slot3) && (%slot2 == %slot3) {
      msg $chan YOU WON!
      set %gamoney [ $+ [ $nick ] ] $calc(%gamoney [ $+ [ $nick ] ] + %wager)
      msg $chan You now have %gamoney [ $+ [ $nick ] ] dollars!
      halt
    }
    else {
      msg $chan Ooh, that's to bad....
      set %gamoney [ $+ [ $nick ] ] $calc(%gamoney [ $+ [ $nick ] ] - %wager)
      msg $chan You now have %gamoney [ $+ [ $nick ] ] dollars left
    }
  }
}

Comments

Sign in to comment.
selyos   -  Apr 23, 2009

how do you win this game though

 Respond  
Joel-Kun   -  Jun 02, 2008

Thanks, I think I got it covered.

 Respond  
criminal   -  May 28, 2008

You should silence them all.. It\'s quite big so easy to flood
instead of msg $chan, .msg $chan
And instead of all those different variables like %selfroul, %quickchange, ...
Make them like this: %GAMBLEselfroul, %GAMBLEquickchange, ...
So you don\'t need to type unset %, unset %, unset %, ... Just use unset %GAMBLE*

 Respond  
Zaiba91   -  May 27, 2008

FAIL! FLAME FLAME FLAME
xD

But seriously though, i see alot of places that can be cleaned up like:

if ($2 == $null)

can be replaced with

if (!$2) {

now where was I... oh yeah.
FLAMEFLAMEFLAMEFLAMEFLAMEFLAME...

 Respond  
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.