Advertisement
Logikos

Latest FamilyFeud 2-23-14

Feb 23rd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.01 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. }
  29.  
  30. alias chanff { return #qi_interesting }
  31.  
  32. on $*:TEXT:/^[!]f(f|fstart)(\s|$)/Si:$($chanff):{
  33. if ($nick isop $chanFF) {
  34. if ($2 != $null) { FFstart $nick $chanFF $2 }
  35. else { FFstart $nick $chanFF 1 }
  36. }
  37. else {
  38. msg $chanFF Sorry $caps($nick) $+ , you need to be an op to start Family Feud.
  39. }
  40. }
  41.  
  42. alias FFstart {
  43. if ( %FF.on != 2 ) {
  44. msg $chanFF A game of Family Feud has been started!
  45. describe $chan $chr(40) $+ [ $chr(36) $+ 1000 $chr(43) 3 Points for #1 Answer!] - [ $chr(36) $+ 250 $chr(43) 2 Points for #2 or #3 Answer(s)] - [ $chr(36) $+ 250 $chr(43) 1 Point for all other Answers] $+ $chr(41)
  46. set %FF.answerz 0
  47. set %FF.on 2
  48. set %FF.roundsplayed 1
  49. set %FF.rounds $3
  50. game
  51. }
  52. else { msg $chanFF $1 The game's already going, maybe you should try answering some questions now. }
  53. }
  54. alias question {
  55. set %FF.line $read(FamFeud.txt)
  56. set %FF.num $pos(%FF.line, *, 1)
  57. set %FF.length $len(%FF.line)
  58. set %FF.numA %FF.length - %FF.num
  59. set %FF.numQ %FF.num - 1
  60. set %FF.dashes $count(%FF.line, -)
  61.  
  62. set %FF.answers $right(%FF.line, %FF.numA)
  63. set %FF.question $left(%FF.line, %FF.numQ)
  64.  
  65. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  66. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  67. set %FF.a1 $left(%FF.answers, %FF.numcom)
  68. set %FF.answers $right(%FF.answers, %FF.numcom2)
  69. if ( %FF.dashes > 0 ) {
  70. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  71. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  72. set %FF.a2 $left(%FF.answers, %FF.numcom)
  73. set %FF.answers $right(%FF.answers, %FF.numcom2)
  74. }
  75. if ( %FF.dashes > 1 ) {
  76. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  77. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  78. set %FF.a3 $left(%FF.answers, %FF.numcom)
  79. set %FF.answers $right(%FF.answers, %FF.numcom2)
  80. }
  81. if ( %FF.dashes > 2 ) {
  82. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  83. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  84. set %FF.a4 $left(%FF.answers, %FF.numcom)
  85. set %FF.answers $right(%FF.answers, %FF.numcom2)
  86. }
  87. if ( %FF.dashes > 3 ) {
  88. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  89. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  90. set %FF.a5 $left(%FF.answers, %FF.numcom)
  91. set %FF.answers $right(%FF.answers, %FF.numcom2)
  92. }
  93. if ( %FF.dashes > 4 ) {
  94. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  95. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  96. set %FF.a6 $left(%FF.answers, %FF.numcom)
  97. set %FF.answers $right(%FF.answers, %FF.numcom2)
  98. }
  99. if ( %FF.dashes > 5 ) {
  100. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  101. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  102. set %FF.a7 $left(%FF.answers, %FF.numcom)
  103. set %FF.answers $right(%FF.answers, %FF.numcom2)
  104. }
  105.  
  106. if ( %FF.dashes == 0 ) { set %FF.a1 %FF.answers }
  107. if ( %FF.dashes == 1 ) { set %FF.a2 %FF.answers }
  108. if ( %FF.dashes == 2 ) { set %FF.a3 %FF.answers }
  109. if ( %FF.dashes == 3 ) { set %FF.a4 %FF.answers }
  110. if ( %FF.dashes == 4 ) { set %FF.a5 %FF.answers }
  111. if ( %FF.dashes == 5 ) { set %FF.a6 %FF.answers }
  112. if ( %FF.dashes == 6 ) { set %FF.a7 %FF.answers }
  113. if ( %FF.dashes == 7 ) { set %FF.a8 %FF.answers }
  114. if ( %FF.dashes > 7 ) {
  115. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  116. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  117. set %FF.a8 $left(%FF.answers, %FF.numcom)
  118. set %FF.answers $right(%FF.answers, %FF.numcom2)
  119. }
  120.  
  121. inc %FF.dashes
  122.  
  123. ;I was having issues with my other answer variables and timers so I just made a second set for the check alias.
  124. set %FF.answerz 0
  125. set %FF.a12 %FF.a1
  126. set %FF.a22 %FF.a2
  127. set %FF.a32 %FF.a3
  128. set %FF.a42 %FF.a4
  129. set %FF.a52 %FF.a5
  130. set %FF.a62 %FF.a6
  131. set %FF.a72 %FF.a7
  132. set %FF.a82 %FF.a8
  133. if (%FF.roundsplayed != $null) { msg $chanFF Round %FF.roundsplayed / %FF.rounds $+ $chr(124) $+ $chr(124) Question ( $+ $readn $+ / $+ $lines(FamFeud.txt) $+ ): %FF.question }
  134. else { msg $chanFF Question ( $+ $readn $+ / $+ $lines(FamFeud.txt) $+ ): %FF.question }
  135. msg $chanFF There are %FF.dashes answers!
  136. }
  137.  
  138. alias game {
  139. if (%FF.roundsplayed == $null || %FF.roundsplayed <= %FF.rounds) {
  140. question
  141. .timer1 1 60 game2
  142. .timer3 1 40 remaining
  143. }
  144. else { FFstop }
  145. }
  146.  
  147. alias game2 {
  148. if ( %FF.dashes == 1 ) { msg $chanFF That's it! The answer was: %FF.a12 }
  149. if ( %FF.dashes == 2 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 and %FF.a22 }
  150. if ( %FF.dashes == 3 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , and %FF.a32 }
  151. if ( %FF.dashes == 4 ) { msg $chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , and %FF.a42 }
  152. 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 }
  153. 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 }
  154. 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 }
  155. 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 }
  156. if (%FF.roundsplayed != $null) { inc %FF.roundsplayed }
  157. unset %FF.a*
  158. if (%FF.roundsplayed > %FF.rounds) { FFstop }
  159. if (%FF.on == 2) { msg $chanFF $buildscores }
  160. if (%FF.on == 2) { .timer2 1 10 game }
  161. ;7 second delay between questions.
  162. }
  163.  
  164. alias remaining {
  165. set %FF.remain The remaining answers are:
  166. if ( %FF.a1 != $null ) { set %FF.remain %FF.remain #1 }
  167. if ( %FF.a2 != $null ) { set %FF.remain %FF.remain #2 }
  168. if ( %FF.a3 != $null ) { set %FF.remain %FF.remain #3 }
  169. if ( %FF.a4 != $null ) { set %FF.remain %FF.remain #4 }
  170. if ( %FF.a5 != $null ) { set %FF.remain %FF.remain #5 }
  171. if ( %FF.a6 != $null ) { set %FF.remain %FF.remain #6 }
  172. if ( %FF.a7 != $null ) { set %FF.remain %FF.remain #7 }
  173. if ( %FF.a8 != $null ) { set %FF.remain %FF.remain #8 }
  174. msg $chanFF %FF.remain
  175. }
  176.  
  177. on *:TEXT:!ffstop:$($chanff):{
  178. if ($nick isop $chanFF) {
  179. FFstop $nick $chanFF
  180. ;Adam I added this to hopefully (temporarily) allow this command to eliminate that variable as a way to get Family Feud running again if it bugs out.. Haven't tried this yet though. -- Jared (2/22/14 - Time 6:40pm CST)
  181. unset %FF.on
  182. }
  183. else {
  184. msg $chanFF Sorry $caps($nick) $+ , you need to be a Moderator to Stop Family Feud.
  185. }
  186. }
  187.  
  188. on *:TEXT:!fftop:#:{
  189. msg $chanFF [Family Feud - Top Ten] $fftop
  190. }
  191.  
  192. alias FFstop {
  193. if ( %FF.on == 2 ) {
  194. if ($1 != $null) { msg $chanFF Game stopped by $1 $+ .
  195. buildscores
  196. msg $chanff $buildscores
  197. .timer1 off
  198. .timer2 off
  199. .timer3 off
  200. unset %FF.*
  201. remini feud.ini Current
  202. }
  203. elseif ($1 == $null) { describe $chanFF Game over!
  204. msg $chanFF [Game scores] $buildscores
  205. msg $chanFF [Top Ten] $fftop
  206. .timer1 off
  207. .timer2 off
  208. .timer3 off
  209. unset %FF.*
  210. remini feud.ini Current
  211. }
  212. else { msg $chanFF Family Feud is not currently running. }
  213. }
  214. }
  215.  
  216. on *:TEXT:!ffscore:$($chanff):{
  217. msg $chanFF $caps($nick) $+ , your current score is $iif($readini(feud.ini,n,Current,$nick) == $null,[zero],$v1) $&
  218. - your all time score is $iif($readini(feud.ini,n,Totals,$nick) == $null,[zero],$v1)
  219. }
  220.  
  221. ;Text events for all 8 answers
  222.  
  223. on *:TEXT:%FF.a1:$($chanff):{
  224. msg $chanFF Survey says, 3 points! and $chr(36) $+ 1000 $caps($nick) got the #1 answer, %FF.a1 $+ !
  225. inc %FF.score. [ $+ [ $nick ] ] 3
  226. /set %moneyfff $calc( $readini( C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini, $nick, Money ) + 1000 )
  227. /writeini C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini $nick Money %moneyfff
  228. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 3)
  229. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 3)
  230. unset %FF.a1
  231. unset %moneyfff
  232. set %FF.answerz %FF.answerz + 1
  233. check %FF.answerz
  234. }
  235.  
  236. on *:TEXT:%FF.a2:$($chanff):{
  237. msg $chanFF Survey says, 2 points! and $chr(36) $+ 250 $caps($nick) got the #2 answer, %FF.a2 $+ !
  238. inc %FF.score. [ $+ [ $nick ] ] 2
  239. /set %moneyff $calc( $readini( C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini, $nick, Money ) + 250 )
  240. /writeini C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini $nick Money %moneyff
  241. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 2)
  242. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 2)
  243. unset %FF.a2
  244. unset %moneyff
  245. set %FF.answerz %FF.answerz + 1
  246. check %FF.answerz
  247. }
  248.  
  249. on *:TEXT:%FF.a3:$($chanff):{
  250. msg $chanFF Survey says, 2 points! and $chr(36) $+ 250 $caps($nick) got the #3 answer, %FF.a3 $+ !
  251. inc %FF.score. [ $+ [ $nick ] ] 2
  252. /set %moneyff $calc( $readini( C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini, $nick, Money ) + 250 )
  253. /writeini C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini $nick Money %moneyff
  254. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 2)
  255. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 2)
  256. unset %FF.a3
  257. unset %moneyff
  258. set %FF.answerz %FF.answerz + 1
  259. check %FF.answerz
  260. }
  261.  
  262. on *:TEXT:%FF.a4:$($chanff):{
  263. msg $chanFF Survey says, 1 points! and $chr(36) $+ 250 $caps($nick) got the #4 answer, %FF.a4 $+ !
  264. inc %FF.score. [ $+ [ $nick ] ] 1
  265. /set %moneyff $calc( $readini( C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini, $nick, Money ) + 250 )
  266. /writeini C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini $nick Money %moneyff
  267. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  268. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  269. unset %FF.a4
  270. unset %moneyff
  271. set %FF.answerz %FF.answerz + 1
  272. check %FF.answerz
  273. }
  274.  
  275. on *:TEXT:%FF.a5:$($chanff):{
  276. msg $chanFF Survey says, 1 points! and $chr(36) $+ 250 $caps($nick) got the #5 answer, %FF.a5 $+ !
  277. inc %FF.score. [ $+ [ $nick ] ] 1
  278. /set %moneyff $calc( $readini( C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini, $nick, Money ) + 250 )
  279. /writeini C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini $nick Money %moneyff
  280. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  281. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  282. unset %FF.a5
  283. unset %moneyff
  284. set %FF.answerz %FF.answerz + 1
  285. check %FF.answerz
  286. }
  287.  
  288. on *:TEXT:%FF.a6:$($chanff):{
  289. msg $chanFF Survey says, 1 points! and $chr(36) $+ 250 $caps($nick) got the #6 answer, %FF.a6 $+ !
  290. inc %FF.score. [ $+ [ $nick ] ] 1
  291. /set %moneyff $calc( $readini( C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini, $nick, Money ) + 250 )
  292. /writeini C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini $nick Money %moneyff
  293. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  294. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  295. unset %FF.a6
  296. unset %moneyff
  297. set %FF.answerz %FF.answerz + 1
  298. check %FF.answerz
  299. }
  300.  
  301. on *:TEXT:%FF.a7:$($chanff):{
  302. msg $chanFF Survey says, 1 points! and $chr(36) $+ 250 $caps($nick) got the #7 answer, %FF.a7 $+ !
  303. inc %FF.score. [ $+ [ $nick ] ] 1
  304. /set %money.ff $calc( $readini( C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini, $nick, Money ) + 250 )
  305. /writeini C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini $nick Money %moneyff
  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.a7
  309. unset %moneyff
  310. set %FF.answerz %FF.answerz + 1
  311. check %FF.answerz
  312. }
  313.  
  314. on *:TEXT:%FF.a8:$($chanff):{
  315. msg $chanFF Survey says, 1 points! and $chr(36) $+ 250 $caps($nick) got the #8 answer, %FF.a8 $+ !
  316. inc %FF.score. [ $+ [ $nick ] ] 1
  317. /set %moneyff $calc( $readini( C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini, $nick, Money ) + 250 )
  318. /writeini C:\Users\Jared\AppData\Roaming\mIRCBOT\casino.ini $nick Money %moneyff
  319. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  320. writeini -n feud.ini Totals $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  321. unset %FF.a8
  322. unset %moneyff
  323. set %FF.answerz %FF.answerz + 1
  324. check %FF.answerz
  325.  
  326. }
  327.  
  328.  
  329. alias buildscores {
  330. var %x 1
  331. while (%x <= $ini(feud.ini,Current,0)) {
  332. var %nick $ini(feud.ini,Current,%x)
  333. var %scores %scores $+(%nick,:) $readini(feud.ini,Current,%nick)
  334. inc %x
  335. }
  336. return %scores
  337. }
  338.  
  339. alias fftop {
  340. var %x 1
  341. while (%x <= $ini(feud.ini,Totals,0)) {
  342. var %nick $ini(feud.ini,Totals,%x)
  343. var %scores $addtok(%scores,$+($readini(feud.ini,Totals,%nick),.,%nick),32)
  344. inc %x
  345. }
  346. var %scores $sorttok(%scores,32,nr)
  347. var %scores $gettok(%scores,1-10,32)
  348. var %scores $mid($regsubex(%scores,/(\d+)\.(\S+)/g,\2: \1$chr(44)),1,-1)
  349. return %scores
  350. }
  351.  
  352. ;Checks to see if all answers have been said before time limit is up
  353. alias check {
  354. if ( $1 == %FF.dashes ) {
  355. .timer1 off
  356. .timer3 off
  357. game2
  358. }
  359. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement