Advertisement
manish

Hi-Lo Cards Game by manish

Mar 17th, 2017
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 5.14 KB | None | 0 0
  1. ############################################################
  2. ##       Hi-Lo Script           ##
  3. ##       Version: 1.0              ##
  4. ##       By: manish               ##
  5. ##       irc.lunarirc.net   #LunarIRC     Talk with me : User - manish  
  6. ## COMMANDS - !hilo , !high , !low . ##
  7.   Follow my blog : https://manishsnippets.blogspot.com ##
  8. ############################################################
  9.  
  10.  
  11. on *:TEXT:!hilo*:#: {
  12.   if ( %hilo != on ) {
  13.     set %hilo on
  14.     set %o 0
  15.     msg $chan 3 Hi-Lo game has been started. 13 cards are taken, and a random card is drawn and removed every time. You need to guess whether the next card is higher or lower than the previous card.
  16.     if ( %champ == $null ) { msg $chan 9 Nobody has ever won this game yet. Win this game to become the first champion! }
  17.     else { msg $chan 3 The current champion is 9 %champ 3 . Win this game to become the new champion! }
  18.     msg $chan 9 Type !start to start the game.  
  19.   }
  20. }
  21.  
  22. on *:TEXT:!start*:#: {
  23.   if ( %hilo == on ) && ( %o == 0 ) {
  24.     inc %o
  25.     set %nick $nick
  26.     set %chan $chan
  27.     msg $chan 6 Game of High-Low has been started by $nick .
  28.     start
  29.     msg $chan 4,0♥ $+ %oldcard 4,010 has been chosen! 12 cards remaining in the deck.
  30.     msg $chan 6 $nick may choose to go !high or go !low
  31.     timer 1 30 timeout
  32.   }
  33.   elseif ( %o == 1 ) {
  34.     msg $chan 7 A game of High-Low is already in progress in this channel.
  35.   }
  36.   else {
  37.   msg $chan 6 Please start a game of High-Low by typing !hilo . }
  38. }
  39. alias start {
  40.   set %score 0
  41.   set %cards 2.3.4.5.6.7.8.9.10.J.Q.K.A
  42.   set %total $numtok(%cards,46)
  43.   set %x $rand(1,%total)
  44.   set %oldcard $gettok(%cards,%x,46)
  45.   %cards = $deltok(%cards,%x,46)
  46. }
  47. on *:TEXT:!high*:#: {
  48.   timers off
  49.   if ( $nick == %nick) {  
  50.     timer 1 1 msg $chan 10 $nick goes for high.
  51.     set %total $numtok(%cards,46)
  52.     set %x $rand(1,%total)
  53.     set %newcard $gettok(%cards,%x,46)
  54.     %cards = $deltok(%cards,%x,46)
  55.     set %oldval $value(%oldcard)
  56.     set %newval $value(%newcard)
  57.     if ( %newval > %oldval ) {
  58.       inc %score
  59.       timer 1 5 msg $chan 14  The next card is 4,0♥ $+ %newcard 4,0 .
  60.       timer 1 5 msg $chan 6 $numtok(%cards,46) cards remaining in the deck.
  61.       timer 1 5 msg $chan 6 $nick makes a correct choice and is still in the game.
  62.       timer 1 7 msg $chan 10 Current score of $nick : %score
  63.       timer 1 37 timeout
  64.       if ( %score == 12 ) {
  65.         timer 1 8 msg $chan 9 $nick has won the game of High-Low with a top-class score of 12, and is the new champion!
  66.         set %champ $nick
  67.         unset %o
  68.         timer 1 9 notice $nick Please Wait 60 seconds if you want to play again.
  69.         timer 1 9 ignore -cu60 $nick
  70.         set %hilo off
  71.         unset %nick
  72.       }
  73.  
  74.     }
  75.     else {
  76.       timer 1 4 msg $chan 14  The next card is 4,0♥ $+ %newcard 4,0 .
  77.       timer 1 5 msg $chan 4 Game Over! $nick loses the game with a total score of %score . Well played!
  78.       unset %o
  79.       timer 1 6 notice $nick Please Wait 30 seconds if you want to play again.
  80.       timer 1 6 ignore -cu30 $nick
  81.       set %hilo off
  82.       unset %nick
  83.     }
  84.     set %oldcard %newcard
  85.   }
  86. }
  87. on *:TEXT:!low*:#: {
  88.   timers off
  89.   if ( $nick == %nick) {  
  90.     timer 1 1 msg $chan 10 $nick goes for low.
  91.     set %total $numtok(%cards,46)
  92.     set %x $rand(1,%total)
  93.     set %newcard $gettok(%cards,%x,46)
  94.     %cards = $deltok(%cards,%x,46)
  95.     set %oldval $value(%oldcard)
  96.     set %newval $value(%newcard)
  97.     if ( %newval < %oldval ) {
  98.       inc %score
  99.       timer 1 5 msg $chan 14  The next card is 4,0♥ $+ %newcard 4,0 .
  100.       timer 1 5 msg $chan 6 $numtok(%cards,46) cards remaining in the deck.
  101.       timer 1 5 msg $chan 6 $nick makes a correct choice and is still in the game.
  102.       timer 1 7 msg $chan 10 Current score of $nick : %score
  103.       timer 1 37 timeout
  104.       if ( %score == 12) {
  105.         timer 1 8 msg $chan 9 $nick has won the game of High-Low with a top-class score of 12, and is the new champion!
  106.         set %champ $nick
  107.         unset %o
  108.         set %hilo off
  109.         unset %nick
  110.         timer 1 9 notice $nick Please Wait 60 seconds if you want to play again.
  111.         timer 1 9 ignore -cu60 $nick
  112.       }
  113.     }
  114.     else {
  115.       timer 1 4 msg $chan 14  The next card is 4,0♥ $+ %newcard 4,0 .
  116.       timer 1 5 msg $chan 4 Game Over! $nick loses the game with a total score of %score . Well played!
  117.       unset %o
  118.       timer 1 6 notice $nick Please Wait 30 seconds if you want to play again.
  119.       timer 1 7 ignore -cu30 $nick
  120.       set %hilo off
  121.       unset %nick
  122.  
  123.     }
  124.     set %oldcard %newcard
  125.   }
  126. }
  127.  
  128. alias value {  
  129.   if ( $1 == J ) { %value = 11 }
  130.   elseif ( $1 == Q ) { %value = 12 }
  131.   elseif ( $1 == K ) { %value = 13 }
  132.   elseif ( $1 == A ) { %value = 14 }
  133.   else { %value = $1 }
  134.   if ($isid) { return %value }
  135. }
  136. alias timeout {
  137.   msg %chan 4 Sorry %nick , you ran out of the time-limit (30 seconds) and eventually lose the game with the score %score .
  138.   unset %o
  139.   set %hilo off
  140.   notice %nick Please Wait 30 seconds if you want to play again.
  141.   ignore -cu30 %nick
  142.   unset %nick
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement