mIRC Home    About    Download    Register    News    Help

Print Thread
#272204 20/11/23 04:26 PM
Joined: May 2022
Posts: 64
F
Fernet Offline OP
Babel fish
OP Offline
Babel fish
F
Joined: May 2022
Posts: 64
I'm trying to make an addon game ROULETTE.
I have this problem: I wish to have an alert is the number cosen by user is higher of 36 , or in any case not in the 0-36 range
This is what I did:
Code
on *:text:!play*:#: {  
  if ($3 !isnum) { msg $chan You can only bet numerical values. | Halt }
  if ($left($3,1) == $chr(45)) { msg $chan You can not use negative numbers $nick | halt }
  if ($3 <= 0) && ($2 < 36) { msg $chan Please use a positive number. | halt }
  if ($3 > 36) { msg $chan ALERT | halt }


What is wrong?
Thanks

Fernet #272205 20/11/23 09:20 PM
Joined: Jul 2006
Posts: 4,151
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,151
Write down the syntax that you wish to use for !play and compare the Nth word being spoken with the Nth word that you're checking inside the on text.
Without knowing your syntax it's impossible to help you correctly, some might take a guess but wouldn't be doing you a solid.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Fernet #272206 20/11/23 10:35 PM
Joined: Jan 2012
Posts: 302
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 302
Try using this code:
Code
on *:TEXT:!play*:#:{
  if ($2 == $null) { notice $nick You must provide a numeric value:12 !play <number> | halt }
  if (($2 !isnum) || ($2 > 36)) { notice $nick You can only bet numerical values:12 0-36 | halt }
  if ($2 < 0) { notice $nick You can not use negative numbers. | halt }
  msg $chan All checks have been passed. Let's start spinning the roulette wheel.
}

Command syntax: !play <0-36>


🌐 http://forum.epicnet.ru πŸ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Epic #272209 21/11/23 02:50 PM
Joined: May 2022
Posts: 64
F
Fernet Offline OP
Babel fish
OP Offline
Babel fish
F
Joined: May 2022
Posts: 64
Originally Posted by Epic
Try using this code:
Code
on *:TEXT:!play*:#:{
  if ($2 == $null) { notice $nick You must provide a numeric value:12 !play <number> | halt }
  if (($2 !isnum) || ($2 > 36)) { notice $nick You can only bet numerical values:12 0-36 | halt }
  if ($2 < 0) { notice $nick You can not use negative numbers. | halt }
  msg $chan All checks have been passed. Let's start spinning the roulette wheel.
}

Command syntax: !play <0-36>

It almost work. The problem is that if I bet for example BLACK or RED I have notice error. Same if I bet column,row,even,odd

Fernet #272211 21/11/23 07:30 PM
Joined: Jan 2012
Posts: 302
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 302
Originally Posted by Fernet
It almost work. The problem is that if I bet for example BLACK or RED I have notice error. Same if I bet column,row,even,odd
Your question didn't say anything about this initially. You just asked for help with checking, so that the user is prohibited from specifying any other numbers in the command except from 0 to 36 inclusive. You also did not provide the full syntax of what your command looks like, which can be written by a user-player.

Probably, the command syntax looks like this: !play <black|red|column|row|even|odd> <0-36>

But I don’t know that, so I made a piece of code based on minimal information, in the hope that you can complete the rest yourself.

If you need to do more than this, then provide as much information as possible, and also include an example of complete gameplay between a player and a bot, as you imagine it. Every step of what the Player writes, and every step of what the Bot writes.

In addition, since perhaps not everyone has played real roulette, you need to provide a complete list of the rules of this game, what the bets can be, etc., if you want one of the mIRC scripts developers present to write for you a full-fledged working code for playing roulette (in free time from work).


🌐 http://forum.epicnet.ru πŸ“œ irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Fernet #272212 22/11/23 06:23 AM
Joined: Oct 2023
Posts: 16
Pikka bird
Offline
Pikka bird
Joined: Oct 2023
Posts: 16
Code
ON *:TEXT:!play*:#:{
  if ((!$strip($isnumeric($2,1,36))) || ($strip($2) != red) || ($strip($2) != black) || ($strip($2) != row) || ($strip($2) != even) || ($strip($2) != odd)) {
    msg $chan ALERT ! Wrong Syntax for !play
    msg $chan Please use !play <1 to 36> or !play <red|black|row|even|odd>
  }
  else {
    msg $chan < $+ $nick $+ > bet: $2 in this Round
  }
}



Best Regards from Germany
-=[atomic10]=-
Wims #272213 22/11/23 08:26 AM
Joined: May 2022
Posts: 64
F
Fernet Offline OP
Babel fish
OP Offline
Babel fish
F
Joined: May 2022
Posts: 64
Originally Posted by Wims
Write down the syntax that you wish to use for !play and compare the Nth word being spoken with the Nth word that you're checking inside the on text.
Without knowing your syntax it's impossible to help you correctly, some might take a guess but wouldn't be doing you a solid.

This is the code:

Code
on *:text:!play*:#: {  
  if (!$hget(Roully, $address($nick,2))) { msg $chan $nick you don't have an account, type !new | halt }
  if ($3 !isnum) { msg $chan You can only bet numerical values. | Halt }
  if ($left($3,1) == $chr(45)) { msg $chan You can not use negative numbers $nick | halt }
  if ($3 <= 0) { msg $chan Please use a positive number. | halt }
  if ($3) && ($hget(Roully, $address($nick,2)) < $3) { msg $chan You can not wager that much $nick as you only have $chr(36) $+ $hget(Roully, $address($nick,2)) $+ . | halt }
  if ($2 == Red || $2 == Black || $2 == Odd || $2 == Even || $2 == Row1 || $2 == Row2 || $2 == Row3 || $2 == Column1 || $2 == Column2 || $2 == Column3 || $2 isnum) {
    if ($2 != num || $2 < 27 && $2 >= 0) {
      if (%rltimer != on) { 
        set %rltimer on 
        msg $chan You now have 60 seconds to place your bets 
        timer 1 60 msg $chan Betting is now off 
        timer 1 60 unset %rltimer
        timer 1 60 /spin $chan
      }
      msg $chan Your bet has been added to the table!
      write bets.txt $address($nick, 2) $nick $2 $3
      hdec Roully $address($nick, 2) $3
    }
  }
  else { msg $chan That is not a valid bet, try !play red 1000 }
}
alias spin { 
  var %num = $rand(0,36)
  msg $1 The Roulette spins and lands on %num
  if (%num == 0) { var %bets = 0 }
  if (%num == 1) { var %bets = 1 red odd row1 column1 }
  if (%num == 2) { var %bets = 2 black even row2 column1 }
  if (%num == 3) { var %bets = 3 red odd row3 column1 }
  if (%num == 4) { var %bets = 4 black even row1 column1 }
  if (%num == 5) { var %bets = 5 red odd row2 column1 }
  if (%num == 6) { var %bets = 6 black even row3 column1 }
  if (%num == 7) { var %bets = 7 red odd row1 column1 }
  if (%num == 8) { var %bets = 8 black even row2 column1 }
  if (%num == 9) { var %bets = 9 red odd row3 column1 }
  if (%num == 10) { var %bets = 10 black even row1 column1 }
  if (%num == 11) { var %bets = 11 black odd row2 column1 }
  if (%num == 12) { var %bets = 12 red even row3 column1 }
  if (%num == 13) { var %bets = 13 black odd row1 column2 }
  if (%num == 14) { var %bets = 14 red even row2 column2 }
  if (%num == 15) { var %bets = 15 black odd row3 column2 }
  if (%num == 16) { var %bets = 16 red even row1 column2 }
  if (%num == 17) { var %bets = 17 black odd row2 column2 }
  if (%num == 18) { var %bets = 18 red even row3 column2 }
  if (%num == 19) { var %bets = 19 red odd row1 column2 }
  if (%num == 20) { var %bets = 20 black even row2 column2 }
  if (%num == 21) { var %bets = 21 red odd row3 column2 }
  if (%num == 22) { var %bets = 22 black even row1 column2 }
  if (%num == 23) { var %bets = 23 red odd row2 column2 }
  if (%num == 24) { var %bets = 24 black even row3 column2 }
  if (%num == 25) { var %bets = 25 red odd row1 column3 }
  if (%num == 26) { var %bets = 26 black even row2 column3 }
  if (%num == 27) { var %bets = 27 red odd row3 column3 }
  if (%num == 28) { var %bets = 28 black even row1 column3 }
  if (%num == 29) { var %bets = 29 black odd row2 column3 }
  if (%num == 30) { var %bets = 30 red even row3 column3 }
  if (%num == 31) { var %bets = 31 black odd row1 column3 }
  if (%num == 32) { var %bets = 32 red even row2 column3 }
  if (%num == 33) { var %bets = 33 black odd row3 column3 }
  if (%num == 34) { var %bets = 34 red even row1 column3 }
  if (%num == 35) { var %bets = 35 black odd row2 column3 }
  if (%num == 36) { var %bets = 36 red even row3 column3 }
  var %count = 1
  while ($read(bets.txt, %count) != $null) {
    var %add = $wildtok($read(bets.txt, %count), *, 1, 32)
    var %nick = $wildtok($read(bets.txt, %count), *, 2, 32)
    var %bet = $wildtok($read(bets.txt, %count), *, 3, 32)
    var %ammount = $wildtok($read(bets.txt, %count), *, 4, 32)
    if (%bet isin %bets) {
      if (%bet == Red || %bet == Black || %bet == Odd || %bet == Even) {
        hinc Roully %add $calc(%ammount * 2) 
        msg $1 %nick has won %ammount with their bet on %bet
      }
      if (%bet == Row1 || %bet == Row2 || %bet == Row3 || %bet == Column1 || %bet == Column2 || %bet == Column3) { 
        hinc Roully %add $calc(%ammount * 3)
        msg $1 %nick has won $calc(%ammount * 2) with their bet on %bet 
      }
      if (%bet == 0 || %bet == 1 || %bet == 2 || %bet == 3 || %bet == 4 || %bet == 5 || %bet == 6 || %bet == 7 || %bet == 8 || %bet == 9 || %bet == 10 || %bet == 11 || %bet == 12 || %bet == 13 || %bet == 14 || %bet == 15 || %bet == 16 || %bet == 17 || %bet == 18 || %bet == 19 || %bet == 20 || %bet == 21 || %bet == 22 || %bet == 23 || %bet == 24 || %bet == 25 || %bet == 26 || %bet == 27 || %bet == 28 || %bet == 29 || %bet == 30 || %bet == 31 || %bet == 32 || %bet == 33 || %bet == 34 || %bet == 35 || %bet == 36) { 
        hinc Roully %add $calc(%ammount * 37)
        msg $1 %nick has won $calc(%ammount * 36) with their bet on %bet  
      }
    }
    inc %count
  }
  msg $1 All other bets were lost, better luck next time!
  remove bets.txt
}
on *:text:!new:#:{ 
  if ($hget(Roully, $address($nick,2)) < 0 || $hget(Roully, $address($nick,2))) { msg $chan $nick You already have an account. | halt }
  if (!$hget(Roully, $address($nick,2)) || $hget(Roully, $address($nick,2)) >= 0) {
    hadd -m Roully $address($nick,2) 100000 
    msg $chan A new account has been created. $nick has $chr(36) $+ 100000 to gamble.
  }
}
on *:text:!money*:#:{ 
  if (!$2) {
    if ($hget(Roully, $address($nick,2)) > 0) { msg $chan $nick has $chr(36) $+ $hget(Roully, $address($nick,2)) dollars. }
    else { msg $chan $nick is broke. | halt } 
  }
  else if ($2 == $me) { msg $chan I am rich! Fear me! | halt } 
  else if ($2 != $me) { 
    if ($hget(Roully, $address($2,2)) > 0) { msg $chan $2 has $chr(36) $+ $hget(Roully, $address($2,2)) dollars. }
    else { msg $chan $2 is broke. | halt }
  }
}
on *:text:!reset*:#: { 
  if (!$2) { 
    if ($hget(Roully, $address($nick,2)) < 0 || !$hget(Roully, $address($nick,2))) { msg $chan You do not have an account. | halt }
    if ($hget(Roully, $address($nick,2)) || $hget(Roully, $address($nick,2)) >= 0) {
      hadd Roully $address($nick,2) 100000 
      msg $chan $nick $+ 's money has been reset to $chr(36) $+ 100000.
    }
  }
}
on *:text:!give*:#: { 
  if ($2) { 
    if (!$hget(Roully, $address($nick, 2))) { msg $chan You do not have an account. | halt }
    if (!$hget(Roully, $address($2, 2))) { msg $chan This person does not have an account. | halt }
    if ($hget(Roully, $address($nick,2)) > $3) {
      hdec Roully $address($nick,2) $3
      hinc Roully $address($2,2) $3
      msg $chan $nick gave $2 $ $+ $3 $+ .
    }
    else { msg $chan You do not have that much money to give }
  }
}
on *:text:!rlycommands*:#: { 
  msg $chan !New, !Reset, !Money/!Money (Nick), !Give (Nick), !Play (Bet) (Ammount)
  msg $chan Bets are Red, Black, Odd, Even, Row1 - Row3, Column1 - Column3, 0 - 36
}

Epic #272214 22/11/23 11:46 AM
Joined: May 2022
Posts: 64
F
Fernet Offline OP
Babel fish
OP Offline
Babel fish
F
Joined: May 2022
Posts: 64
Rules are that You can bet using syntax:

!Play <bet> <ammount>

%bet can be: red/black , even/odd , row1/2/3 , column 1/2/3 , numbers 0-36 (You can bet multiple choices)

%ammount can be: You start with $100000 ammount and You can bet any ammount until You have money

You have 60 seconds to place bets

After 60 seconds the wheel stop on a %num (number) and if You catch one of the variables that You bet, You win

Last edited by Fernet; 22/11/23 12:39 PM.

Link Copied to Clipboard