Advertisement
westor

Scramble Game (FIX) for ceravea v1.0

Mar 26th, 2022 (edited)
1,445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 4.38 KB | None | 0 0
  1. /*
  2. ###########################################################################################
  3. Commands are:
  4.  
  5. !scramble on - start the game
  6. !scramble off - stop the game
  7. !guess WORD - guess a word
  8. !word - tells you the current scramble word
  9.  
  10. Note: Make sure you have the wordlist you supplied me saved in words.txt in your $mircdir.
  11. File words.txt: https://pastebin.com/SvThZB28
  12.  
  13. Question:
  14. x Way to somehow put some scoring script code like top players for the week then resets after?
  15. x Is it possible to keep it running in the channel when started but if no one's playing anymore after 3
  16. questions it'll stop on its own?
  17. x That the game can be started/stopped only by # @s
  18. x That scores for correct answers are given in random, say between 150-200 points and if you guess wrong total score random minus 10-50 points (for fun)
  19.  
  20. ###########################################################################################
  21. */
  22.  
  23. alias -l scramble {
  24.   var %a,%b $1
  25.   while ($numtok(%a,32) < $len($1)) var %a $addtok(%a,$r(1,$len($1)),32)
  26.   return $regsubex(%a,/(\S+(?: |$))/g,$mid(%b,\1,1))
  27. }
  28. alias -l s_new {
  29.   var -g %s_word $read(words.txt),%s_scramble $scramble(%s_word)
  30.   msg $1 7It's Scramble Time!!! Fastest fingers first! Now, get ready..............
  31.   msg $1 3Type quickly your 4!guess (word) 3to answer. The scrambled word is:4 %s_scramble $+ 3.
  32.   msg $1 3You have 7[120] seconds.
  33.   .timerscramble 1 120 s_fail $1
  34. }
  35. alias -l s_fail {
  36.   msg $1 3No one got it! Are you all dummies???? The word was:4 %s_word
  37.   msg $1 3A new word to solve will appear after 7[60] minutes...
  38.   unset %s_word
  39.   .timerscramble 0 3600 s_new $1
  40. }
  41. alias -l s_cleanup {
  42.   .timerscramble off
  43.   unset %s_word %s_scramble
  44. }
  45. on *:TEXT:!scramble &:#: {
  46.   if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Access denied. | return }
  47.   if ($2 == on) {
  48.     if (%s_scramble) { msg # 3The game is already going... Type 4!word 3to see what the current scrambled word is! | return }
  49.  
  50.     s_new #
  51.   }
  52.   if ($2 == off) {
  53.     if (!%s_scramble) { msg $chan 3Not any game running! | return }
  54.  
  55.     msg # 3Game stopped by 4 $nick $+ .
  56.  
  57.     s_cleanup
  58.   }
  59. }
  60. on *:TEXT:!guess &:#: {
  61.   if (%s_word) {
  62.     if ($2 !== %s_word) { s_take_points $nick | msg # 3Wrong $nick $+ , try again. You have [[ $+ $timer(scramble).secs $+ ]] seconds left. | return }
  63.  
  64.     s_give_points $nick
  65.  
  66.     msg # 3Great work $nick $+ ! You correctly guessed the scrambled word: 4 %s_word
  67.     msg # 3A new word to solve will appear after 7[60] minutes...
  68.  
  69.     unset %s_word
  70.  
  71.     .timerscramble 0 3600 s_new #
  72.   }
  73. }
  74. on *:TEXT:!word:#: {
  75.   if (%s_word) msg # 7The scrambled word is: %s_scramble $+ , you have [[ $+ $timer(scramble).secs $+ ]] seconds left.  
  76. }
  77.  
  78. ON *:TEXT:!mypoints:#: {
  79.   var %f = guess_stats.txt
  80.   var %p = $gettok($read(%f,nw,$nick *),2,32)
  81.  
  82.   msg $chan ( $+ $nick $+ ): You have $iif(%p,$v1,0) points.
  83. }
  84.  
  85. ON *:TEXT:!points *:#: {
  86.   var %f = guess_stats.txt
  87.   var %p = $gettok($read(%f,nw,$2 *),2,32)
  88.  
  89.   msg $chan ( $+ $nick $+ ): $2 have $iif(%p,$v1,0) points.
  90. }
  91.  
  92. ON *:TEXT:!top3:#: { s_top_players $chan 3 }
  93. ON *:TEXT:!top5:#: { s_top_players $chan 5 }
  94. ON *:TEXT:!top10:#: { s_top_players $chan 10 }
  95.  
  96. alias s_give_points {
  97.   ; /s_give_points <nick>
  98.  
  99.   if (!$1) { return }
  100.  
  101.   var %f = guess_stats.txt
  102.   var %p = $gettok($read(%f,nw,$1 *),2,32)
  103.   var %rn = $readn
  104.   var %r = $rands(150,200)
  105.  
  106.   if (%p) && (%rn) { write -dl $+ %rn $qt(%f) }
  107.  
  108.   write $qt(%f) $1 $calc(%p + %r)
  109. }
  110.  
  111. alias s_take_points {
  112.   ; /s_take_points <nick>
  113.  
  114.   if (!$1) { return }
  115.  
  116.   var %f = guess_stats.txt
  117.   var %p = $gettok($read(%f,nw,$1 *),2,32)
  118.   var %rn = $readn
  119.   var %r = $rands(10,50)
  120.  
  121.   if (%p) && (%rn) { write -dl $+ %rn $qt(%f) }
  122.  
  123.   write $qt(%f) $1 $calc(%p - %r)
  124. }
  125.  
  126. alias s_top_players {
  127.   ; /s_top_players <#chan> <number>
  128.  
  129.   if (!$1) && (!$2) && ($2 !isnum) { return }
  130.  
  131.   var %f = guess_stats.txt
  132.  
  133.   if ($window(@top_players)) { window -c $v1 }
  134.  
  135.   if ($file(%f)) {
  136.     window -hj100000000000 @top_players
  137.     loadbuf @top_players $qt(%f)
  138.     filter -ceutww 2 32 @top_players @top_players
  139.   }
  140.  
  141.   var %i = 1
  142.   while (%i <= $2) {
  143.     var %line = $line(@top_players,%i)
  144.     var %nick = $gettok(%line,1,32)
  145.     var %points = $gettok(%line,2,32)
  146.  
  147.     if (%line) { msg $1 ( $+ $chr(35) $+ %i $+ ): %nick - %points }
  148.  
  149.     inc %i
  150.   }
  151.  
  152.   if ($window(@top_players)) { window -c $v1 }
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement