Advertisement
Logikos

family feud 2/17

Feb 17th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.78 KB | None | 0 0
  1. /*
  2. Commands:
  3. !ff number
  4. -------------
  5. Starts the game
  6. "!ff 1" starts a 1 round game, "!ff unlimited or !ff" starts an unlimited game
  7. -------------
  8. !ffstop
  9. -------------
  10. Stops the game
  11. -------------
  12. !ffscore
  13. -------------
  14. Notices a user his/her score
  15. -------------
  16. !ffscores
  17. -------------
  18. Messages the scores to the channel (Also messaged at the end of each round)
  19. */
  20.  
  21. ;Reads from a text file and grabs a random line's Question and answers in the format: Question*Answer1-Answer2-Answer3-Answer4-Answer5-Answer6-Answer7-Answer8
  22. on *:LOAD:/FFsetchan $?="Type the name of the channel you would like Family Feud to be active in (Including #)"
  23.  
  24. menu nicklist,channel,status,menubar,query {
  25. Family Feud
  26. .$iif(%FF.on != 2,Start):/FFStart $me $chanFF $?="How many rounds? For unlimited rounds say unlimited."
  27. .$iif(%FF.on == 2,Stop):/FFStop $me $chanFF
  28. .Set Family Feud Channel:/FFsetchan $?="Type the name of the channel you would like Family Feud to be active in (Including #)"
  29. }
  30.  
  31. alias FFsetchan { set $chanFF $1
  32. set $chanFF $chanFF
  33. }
  34. on $*:TEXT:/^[!]f(f|fstart)(\s|$)/Si:#:{
  35. if ($nick isop $chanFF) {
  36. if ($2 != $null) { FFstart $nick $chanFF $2 }
  37. else { FFstart $nick $chanFF 1 }
  38. }
  39. else {
  40. msg $chanFF Sorry $nick $+ , you need to be an op to start Family Feud.
  41. }
  42. }
  43.  
  44. alias FFstart {
  45. if ( %FF.on != 2 ) {
  46. msg $chanFF A game of Family Feud has been started!
  47. set %FF.answerz 0
  48. set %FF.on 2
  49. set %FF.roundsplayed 1
  50. set %FF.rounds $3
  51. game
  52. }
  53. else { msg $chanFF $1 The game's already going, maybe you should try answering some questions now. }
  54. }
  55. alias question {
  56. set %FF.line $read(FamFeud.txt)
  57. set %FF.num $pos(%FF.line, *, 1)
  58. set %FF.length $len(%FF.line)
  59. set %FF.numA %FF.length - %FF.num
  60. set %FF.numQ %FF.num - 1
  61. set %FF.dashes $count(%FF.line, -)
  62.  
  63. set %FF.answers $right(%FF.line, %FF.numA)
  64. set %FF.question $left(%FF.line, %FF.numQ)
  65.  
  66. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  67. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  68. set %FF.a1 $left(%FF.answers, %FF.numcom)
  69. set %FF.answers $right(%FF.answers, %FF.numcom2)
  70. if ( %FF.dashes > 0 ) {
  71. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  72. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  73. set %FF.a2 $left(%FF.answers, %FF.numcom)
  74. set %FF.answers $right(%FF.answers, %FF.numcom2)
  75. }
  76. if ( %FF.dashes > 1 ) {
  77. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  78. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  79. set %FF.a3 $left(%FF.answers, %FF.numcom)
  80. set %FF.answers $right(%FF.answers, %FF.numcom2)
  81. }
  82. if ( %FF.dashes > 2 ) {
  83. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  84. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  85. set %FF.a4 $left(%FF.answers, %FF.numcom)
  86. set %FF.answers $right(%FF.answers, %FF.numcom2)
  87. }
  88. if ( %FF.dashes > 3 ) {
  89. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  90. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  91. set %FF.a5 $left(%FF.answers, %FF.numcom)
  92. set %FF.answers $right(%FF.answers, %FF.numcom2)
  93. }
  94. if ( %FF.dashes > 4 ) {
  95. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  96. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  97. set %FF.a6 $left(%FF.answers, %FF.numcom)
  98. set %FF.answers $right(%FF.answers, %FF.numcom2)
  99. }
  100. if ( %FF.dashes > 5 ) {
  101. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  102. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  103. set %FF.a7 $left(%FF.answers, %FF.numcom)
  104. set %FF.answers $right(%FF.answers, %FF.numcom2)
  105. }
  106.  
  107. if ( %FF.dashes == 0 ) { set %FF.a1 %FF.answers }
  108. if ( %FF.dashes == 1 ) { set %FF.a2 %FF.answers }
  109. if ( %FF.dashes == 2 ) { set %FF.a3 %FF.answers }
  110. if ( %FF.dashes == 3 ) { set %FF.a4 %FF.answers }
  111. if ( %FF.dashes == 4 ) { set %FF.a5 %FF.answers }
  112. if ( %FF.dashes == 5 ) { set %FF.a6 %FF.answers }
  113. if ( %FF.dashes == 6 ) { set %FF.a7 %FF.answers }
  114. if ( %FF.dashes == 7 ) { set %FF.a8 %FF.answers }
  115. if ( %FF.dashes > 7 ) {
  116. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  117. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  118. set %FF.a8 $left(%FF.answers, %FF.numcom)
  119. set %FF.answers $right(%FF.answers, %FF.numcom2)
  120. }
  121.  
  122. inc %FF.dashes
  123.  
  124. ;I was having issues with my other answer variables and timers so I just made a second set for the check alias.
  125. set %FF.answerz 0
  126. set %FF.a12 %FF.a1
  127. set %FF.a22 %FF.a2
  128. set %FF.a32 %FF.a3
  129. set %FF.a42 %FF.a4
  130. set %FF.a52 %FF.a5
  131. set %FF.a62 %FF.a6
  132. set %FF.a72 %FF.a7
  133. set %FF.a82 %FF.a8
  134. if (%FF.roundsplayed != $null) { msg $chanFF Round %FF.roundsplayed / %FF.rounds $+ $chr(124) $+ $chr(124) Question ( $+ $readn $+ / $+ $lines(FamFeud.txt) $+ ): %FF.question }
  135. else { msg $chanFF Question ( $+ $readn $+ / $+ $lines(FamFeud.txt) $+ ): %FF.question }
  136. msg $chanFF There are %FF.dashes answers!
  137. }
  138.  
  139. alias game {
  140. if (%FF.roundsplayed == $null || %FF.roundsplayed <= %FF.rounds) {
  141. question
  142. .timer1 1 60 game2
  143. .timer3 1 40 remaining
  144. }
  145. else { FFstop }
  146. }
  147.  
  148. alias game2 {
  149. if ( %FF.dashes == 1 ) { msg $chanFF That's it! The answer was: %FF.a12 }
  150. if ( %FF.dashes == 2 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 and %FF.a22 }
  151. if ( %FF.dashes == 3 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , and %FF.a32 }
  152. if ( %FF.dashes == 4 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , and %FF.a42 }
  153. if ( %FF.dashes == 5 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , %FF.a42 $+ , and %FF.a52 }
  154. if ( %FF.dashes == 6 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , %FF.a42 $+ , %FF.a52 $+ , and %FF.a62 }
  155. if ( %FF.dashes == 7 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , %FF.a42 $+ , %FF.a52 $+ , %FF.a62 $+ , and %FF.a72 }
  156. if ( %FF.dashes == 8 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , %FF.a42 $+ , %FF.a52 $+ , %FF.a62 $+ , %FF.a72 $+ , and %FF.a82 }
  157. if (%FF.roundsplayed != $null) { inc %FF.roundsplayed }
  158. unset %FF.a*
  159. if (%FF.roundsplayed > %FF.rounds) { FFstop }
  160. if (%FF.on == 2) { msg $chanFF $buildscores }
  161. if (%FF.on == 2) { .timer2 1 10 game }
  162. ;7 second delay between questions.
  163. }
  164.  
  165. alias remaining {
  166. set %FF.remain The remaining answers are:
  167. if ( %FF.a1 != $null ) { set %FF.remain %FF.remain #1 }
  168. if ( %FF.a2 != $null ) { set %FF.remain %FF.remain #2 }
  169. if ( %FF.a3 != $null ) { set %FF.remain %FF.remain #3 }
  170. if ( %FF.a4 != $null ) { set %FF.remain %FF.remain #4 }
  171. if ( %FF.a5 != $null ) { set %FF.remain %FF.remain #5 }
  172. if ( %FF.a6 != $null ) { set %FF.remain %FF.remain #6 }
  173. if ( %FF.a7 != $null ) { set %FF.remain %FF.remain #7 }
  174. if ( %FF.a8 != $null ) { set %FF.remain %FF.remain #8 }
  175. msg $chanFF %FF.remain
  176. }
  177.  
  178. on *:TEXT:!ffstop:#:{
  179. if ($nick isop $chanFF) {
  180. FFstop $nick $chanFF
  181. }
  182. else {
  183. msg $chanFF Sorry $nick $+ , you need to be a Moderator to Stop Family Feud.
  184. }
  185. }
  186. alias fftop {
  187. var %x 1
  188. while (%x <= $ini(feud.ini,Totals,0)) {
  189. var %nick $ini(feud.ini,Totals,%x)
  190. var %scores $addtok(%scores,$+($readini(feud.ini,Totals,%nick),.,%nick),32)
  191. inc %x
  192. }
  193. var %scores $sorttok(%scores,32,nr)
  194. var %scores $gettok(%scores,1-10,32)
  195. var %scores $mid($regsubex(%scores,/(\d+)\.(\S+)/g,\2: \1$chr(44)),1,-1)
  196. return %scores
  197. }
  198. on *:TEXT:!fftop:#:{
  199. msg $chanFF [Family Feud - Top Ten] $fftop
  200. }
  201.  
  202. alias FFstop {
  203. if ( %FF.on == 2 ) {
  204. if ($1 != $null) { msg $chanFF Game stopped by $1 $+ .
  205. buildscores
  206. msg #qi_interesting $buildscores
  207. .timer1 off
  208. .timer2 off
  209. .timer3 off
  210. unset %FF.*
  211. remini feud.ini Current
  212. }
  213. elseif ($1 == $null) { msg $chanFF Game over!
  214. msg $chanFF [Game scores] $buildscores
  215. msg $chanFF [Top Ten] $fftop
  216. .timer1 off
  217. .timer2 off
  218. .timer3 off
  219. unset %FF.*
  220. remini feud.ini Current
  221. }
  222. else { msg $chanFF Family Feud is not currently running. }
  223. }
  224. }
  225.  
  226. on *:TEXT:!ffscore:#:{
  227. msg $chanFF $nick $+ , your current score is $iif($readini(feud.ini,n,Current,$nick) == $null,[zero],$v1) $&
  228. - your all time score is $iif($readini(feud.ini,n,Totals,$nick) == $null,[zero],$v1)
  229. }
  230.  
  231. ;Text events for all 8 answers
  232.  
  233. on *:TEXT:%FF.a1:$chanFF:{
  234. msg $chanFF Survey says, 3 points! $nick got the #1 answer, %FF.a1 $+ !
  235. inc %FF.score. [ $+ [ $nick ] ] 3
  236. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 3)
  237. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 3)
  238. unset %FF.a1
  239. set %FF.answerz %FF.answerz + 1
  240. check %FF.answerz
  241. }
  242.  
  243. on *:TEXT:%FF.a2:$chanFF:{
  244. msg $chanFF Survey says, 2 points! $nick got the #2 answer, %FF.a2 $+ !
  245. inc %FF.score. [ $+ [ $nick ] ] 2
  246. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 2)
  247. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 2)
  248. unset %FF.a2
  249. set %FF.answerz %FF.answerz + 1
  250. check %FF.answerz
  251. }
  252.  
  253. on *:TEXT:%FF.a3:$chanFF:{
  254. msg $chanFF Survey says, 2 points! $nick got the #3 answer, %FF.a3 $+ !
  255. inc %FF.score. [ $+ [ $nick ] ] 2
  256. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 2)
  257. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 2)
  258. unset %FF.a3
  259. set %FF.answerz %FF.answerz + 1
  260. check %FF.answerz
  261. }
  262.  
  263. on *:TEXT:%FF.a4:$chanFF:{
  264. msg $chanFF Survey says, 1 points! $nick got the #4 answer, %FF.a4 $+ !
  265. inc %FF.score. [ $+ [ $nick ] ] 1
  266. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  267. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  268. unset %FF.a4
  269. set %FF.answerz %FF.answerz + 1
  270. check %FF.answerz
  271. }
  272.  
  273. on *:TEXT:%FF.a5:$chanFF:{
  274. msg $chanFF Survey says, 1 points! $nick got the #5 answer, %FF.a5 $+ !
  275. inc %FF.score. [ $+ [ $nick ] ] 1
  276. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  277. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  278. /unset %FF.a5
  279. set %FF.answerz %FF.answerz + 1
  280. check %FF.answerz
  281. }
  282.  
  283. on *:TEXT:%FF.a6:$chanFF:{
  284. msg $chanFF Survey says, 1 points! $nick got the #6 answer, %FF.a6 $+ !
  285. inc %FF.score. [ $+ [ $nick ] ] 1
  286. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  287. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  288. unset %FF.a6
  289. set %FF.answerz %FF.answerz + 1
  290. check %FF.answerz
  291. }
  292.  
  293. on *:TEXT:%FF.a7:$chanFF:{
  294. msg $chanFF Survey says, 1 points! $nick got the #7 answer, %FF.a7 $+ !
  295. inc %FF.score. [ $+ [ $nick ] ] 1
  296. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  297. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  298. unset %FF.a7
  299. set %FF.answerz %FF.answerz + 1
  300. check %FF.answerz
  301. }
  302.  
  303. on *:TEXT:%FF.a8:$chanFF:{
  304. msg $chanFF Survey says, 1 points! $nick got the #8 answer, %FF.a8 $+ !
  305. inc %FF.score. [ $+ [ $nick ] ] 1
  306. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  307. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  308. unset %FF.a8
  309. set %FF.answerz %FF.answerz + 1
  310. check %FF.answerz
  311. }
  312.  
  313.  
  314. alias buildscores {
  315. var %x 1
  316. while (%x <= $ini(feud.ini,Current,0)) {
  317. var %nick $ini(feud.ini,Current,%x)
  318. var %scores %scores $+(%nick,:) $readini(feud.ini,Current,%nick)
  319. inc %x
  320. }
  321. return %scores
  322. }
  323.  
  324. ;Checks to see if all answers have been said before time limit is up
  325. alias check {
  326. if ( $1 == %FF.dashes ) {
  327. .timer1 off
  328. .timer3 off
  329. game2
  330. }
  331. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement