Advertisement
Logikos

ff - midpoint adding scores, etc...

Feb 12th, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.74 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.  
  23. on *:LOAD:/FFsetchan $?="Type the name of the channel you would like Family Feud to be active in (Including #)"
  24.  
  25. menu nicklist,channel,status,menubar,query {
  26. Family Feud
  27. .$iif(%FF.on != 2,Start):/FFStart $me $chan $?="How many rounds? For unlimited rounds say unlimited."
  28. .$iif(%FF.on == 2,Stop):/FFStop $me $chan
  29. .Set Family Feud Channel:/FFsetchan $?="Type the name of the channel you would like Family Feud to be active in (Including #)"
  30. }
  31.  
  32. alias FFsetchan { set %chanFF $1
  33. set %chanFF $chan
  34. }
  35.  
  36.  
  37.  
  38. alias question {
  39. set %FF.line $read(FamFeud.txt)
  40. set %FF.num $pos(%FF.line, *, 1)
  41. set %FF.length $len(%FF.line)
  42. set %FF.numA %FF.length - %FF.num
  43. set %FF.numQ %FF.num - 1
  44. set %FF.dashes $count(%FF.line, -)
  45.  
  46. set %FF.answers $right(%FF.line, %FF.numA)
  47. set %FF.question $left(%FF.line, %FF.numQ)
  48.  
  49. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  50. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  51. set %FF.a1 $left(%FF.answers, %FF.numcom)
  52. set %FF.answers $right(%FF.answers, %FF.numcom2)
  53. if ( %FF.dashes > 0 ) {
  54. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  55. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  56. set %FF.a2 $left(%FF.answers, %FF.numcom)
  57. set %FF.answers $right(%FF.answers, %FF.numcom2)
  58. }
  59. if ( %FF.dashes > 1 ) {
  60. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  61. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  62. set %FF.a3 $left(%FF.answers, %FF.numcom)
  63. set %FF.answers $right(%FF.answers, %FF.numcom2)
  64. }
  65. if ( %FF.dashes > 2 ) {
  66. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  67. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  68. set %FF.a4 $left(%FF.answers, %FF.numcom)
  69. set %FF.answers $right(%FF.answers, %FF.numcom2)
  70. }
  71. if ( %FF.dashes > 3 ) {
  72. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  73. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  74. set %FF.a5 $left(%FF.answers, %FF.numcom)
  75. set %FF.answers $right(%FF.answers, %FF.numcom2)
  76. }
  77. if ( %FF.dashes > 4 ) {
  78. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  79. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  80. set %FF.a6 $left(%FF.answers, %FF.numcom)
  81. set %FF.answers $right(%FF.answers, %FF.numcom2)
  82. }
  83. if ( %FF.dashes > 5 ) {
  84. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  85. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  86. set %FF.a7 $left(%FF.answers, %FF.numcom)
  87. set %FF.answers $right(%FF.answers, %FF.numcom2)
  88. }
  89.  
  90. if ( %FF.dashes == 0 ) { set %FF.a1 %FF.answers }
  91. if ( %FF.dashes == 1 ) { set %FF.a2 %FF.answers }
  92. if ( %FF.dashes == 2 ) { set %FF.a3 %FF.answers }
  93. if ( %FF.dashes == 3 ) { set %FF.a4 %FF.answers }
  94. if ( %FF.dashes == 4 ) { set %FF.a5 %FF.answers }
  95. if ( %FF.dashes == 5 ) { set %FF.a6 %FF.answers }
  96. if ( %FF.dashes == 6 ) { set %FF.a7 %FF.answers }
  97. if ( %FF.dashes == 7 ) { set %FF.a8 %FF.answers }
  98. if ( %FF.dashes > 7 ) {
  99. set %FF.numcom $pos(%FF.answers, -, 1) - 1
  100. set %FF.numcom2 $len(%FF.answers) - $pos(%FF.answers, -, 1)
  101. set %FF.a8 $left(%FF.answers, %FF.numcom)
  102. set %FF.answers $right(%FF.answers, %FF.numcom2)
  103. }
  104.  
  105.  
  106. inc %FF.dashes
  107.  
  108. ;I was having issues with my other answer variables and timers so I just made a second set for the check alias.
  109. set %FF.answerz 0
  110. set %FF.a12 %FF.a1
  111. set %FF.a22 %FF.a2
  112. set %FF.a32 %FF.a3
  113. set %FF.a42 %FF.a4
  114. set %FF.a52 %FF.a5
  115. set %FF.a62 %FF.a6
  116. set %FF.a72 %FF.a7
  117. set %FF.a82 %FF.a8
  118. if (%FF.roundsplayed != $null) { msg %chanFF Round %FF.roundsplayed / %FF.rounds $+ $chr(124) $+ $chr(124) Question ( $+ $readn $+ / $+ $lines(FamFeud.txt) $+ ): %FF.question }
  119. else { msg %chanFF Question ( $+ $readn $+ / $+ $lines(FamFeud.txt) $+ ): %FF.question }
  120. msg %chanFF There are %FF.dashes answers!
  121. }
  122.  
  123. alias game {
  124. if (%FF.roundsplayed == $null || %FF.roundsplayed <= %FF.rounds) {
  125. question
  126. .timer1 1 60 game2
  127. .timer3 1 40 remaining
  128. }
  129. else { FFstop }
  130. }
  131.  
  132. alias game2 {
  133. if ( %FF.dashes == 1 ) { msg %chanFF That's it! The answer was: %FF.a12 }
  134. if ( %FF.dashes == 2 ) { msg %chanFF That's it! The answers were (in order): %FF.a12 and %FF.a22 }
  135. if ( %FF.dashes == 3 ) { msg %chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , and %FF.a32 }
  136. if ( %FF.dashes == 4 ) { msg %chanFF That's it! The answers were (in order): %FF.a12 $+ , %FF.a22 $+ , %FF.a32 $+ , and %FF.a42 }
  137. 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 }
  138. 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 }
  139. 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 }
  140. 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 }
  141. buildscores
  142. if (%FF.roundsplayed != $null) { inc %FF.roundsplayed }
  143. unset %FF.a*
  144. if (%FF.roundsplayed > %FF.rounds) { FFstop }
  145. if (%FF.on == 2) { msg %chanFF %FF.scoreoutput }
  146. if (%FF.on == 2) { .timer2 1 10 game }
  147. ;7 second delay between questions.
  148. }
  149.  
  150. alias remaining {
  151. set %FF.remain The remaining answers are:
  152. if ( %FF.a1 != $null ) { set %FF.remain %FF.remain #1 }
  153. if ( %FF.a2 != $null ) { set %FF.remain %FF.remain #2 }
  154. if ( %FF.a3 != $null ) { set %FF.remain %FF.remain #3 }
  155. if ( %FF.a4 != $null ) { set %FF.remain %FF.remain #4 }
  156. if ( %FF.a5 != $null ) { set %FF.remain %FF.remain #5 }
  157. if ( %FF.a6 != $null ) { set %FF.remain %FF.remain #6 }
  158. if ( %FF.a7 != $null ) { set %FF.remain %FF.remain #7 }
  159. if ( %FF.a8 != $null ) { set %FF.remain %FF.remain #8 }
  160. msg %chanFF %FF.remain
  161. }
  162.  
  163.  
  164. on *:TEXT:!ffstart:%chanFF:{
  165. echo -a hi
  166. if ($nick isop $chan) {
  167. if ($2 != $null) { FFstart $nick $chan $2 }
  168. else { FFstart $nick $chan 1 }
  169. }
  170. else {
  171. msg $chan Sorry $nick $+ , you need to be an op to start Family Feud.
  172. }
  173. }
  174.  
  175. alias FFstart {
  176. if ( %FF.on != 2 ) {
  177. msg %chanFF A game of Family Feud has been started by $caps($1) !
  178. set %FF.answerz 0
  179. set %FF.on 2
  180. set %FF.roundsplayed 1
  181. set %FF.rounds $3
  182. game
  183. }
  184. else { msg $chan $1 The game's already going, maybe you should try answering some questions now. }
  185. }
  186.  
  187. on *:TEXT:!ffstop:#:{
  188. if ($nick isop $chan) {
  189. FFstop $nick $chan
  190. }
  191. else {
  192. msg $chan Sorry $nick $+ , you need to be a Moderator to Stop Family Feud.
  193. }
  194. }
  195. alias FFstop {
  196. if ( %FF.on == 2 ) {
  197. if ($1 != $null) msg %chanFF Game stopped by $1 $+ .
  198. buildscores
  199. msg %chanFF %FF.scoreoutput
  200. .timer1 off
  201. .timer2 off
  202. .timer3 off
  203. unset %FF.*
  204. /remini feud.ini Current
  205. }
  206. if ($1 == $null) { msg %chanFF Game over!
  207. buildscores
  208. msg %chanFF %FF.scoreoutput
  209. .timer1 off
  210. .timer2 off
  211. .timer3 off
  212. unset %FF.*
  213. /remini feud.ini Current
  214. }
  215. else { msg $chan $caps($1) , Family Feud is not currently running. }
  216. }
  217.  
  218. on *:TEXT:!ffscore:#:{
  219. ;TO DO (add checks for if they don't have scoreI)
  220. ;describe $chan Your score is %FF.score. [ $+ [ $nick ] ] $+ .
  221. msg $chan $nick $+ , your current score is $readini(feud.ini,n,Current,$nick) - your all time score is $readini(feud.ini,n,Totals,$nick)
  222. }
  223.  
  224. ;Text events for all 8 answers
  225.  
  226. on *:TEXT:%FF.a1:%chanFF:{
  227. msg %chanFF Survey says, 3 points! $nick got the #1 answer, %FF.a1 $+ !
  228. inc %FF.score. [ $+ [ $nick ] ] 3
  229. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 3)
  230. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Totals,$nick) + 3)
  231. unset %FF.a1
  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! $nick got the #2 answer, %FF.a2 $+ !
  238. inc %FF.score. [ $+ [ $nick ] ] 2
  239. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 2)
  240. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Totals,$nick) + 2)
  241. unset %FF.a2
  242. set %FF.answerz %FF.answerz + 1
  243. check %FF.answerz
  244. }
  245.  
  246. on *:TEXT:%FF.a3:%chanFF:{
  247. msg %chanFF Survey says, 2 points! $nick got the #3 answer, %FF.a3 $+ !
  248. inc %FF.score. [ $+ [ $nick ] ] 2
  249. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 2)
  250. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Totals,$nick) + 2)
  251. unset %FF.a3
  252. set %FF.answerz %FF.answerz + 1
  253. check %FF.answerz
  254. }
  255.  
  256. on *:TEXT:%FF.a4:%chanFF:{
  257. msg %chanFF Survey says, 1 points! $nick got the #4 answer, %FF.a4 $+ !
  258. inc %FF.score. [ $+ [ $nick ] ] 1
  259. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  260. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  261. unset %FF.a4
  262. set %FF.answerz %FF.answerz + 1
  263. check %FF.answerz
  264. }
  265.  
  266. on *:TEXT:%FF.a5:%chanFF:{
  267. msg %chanFF Survey says, 1 points! $nick got the #5 answer, %FF.a5 $+ !
  268. inc %FF.score. [ $+ [ $nick ] ] 1
  269. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  270. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  271. /unset %FF.a5
  272. set %FF.answerz %FF.answerz + 1
  273. check %FF.answerz
  274. }
  275.  
  276. on *:TEXT:%FF.a6:%chanFF:{
  277. msg %chanFF Survey says, 1 points! $nick got the #6 answer, %FF.a6 $+ !
  278. inc %FF.score. [ $+ [ $nick ] ] 1
  279. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  280. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  281. unset %FF.a6
  282. set %FF.answerz %FF.answerz + 1
  283. check %FF.answerz
  284. }
  285.  
  286. on *:TEXT:%FF.a7:%chanFF:{
  287. msg %chanFF Survey says, 1 points! $nick got the #7 answer, %FF.a7 $+ !
  288. inc %FF.score. [ $+ [ $nick ] ] 1
  289. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  290. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  291. unset %FF.a7
  292. set %FF.answerz %FF.answerz + 1
  293. check %FF.answerz
  294. }
  295.  
  296. on *:TEXT:%FF.a8:%chanFF:{
  297. msg %chanFF Survey says, 1 points! $nick got the #8 answer, %FF.a8 $+ !
  298. inc %FF.score. [ $+ [ $nick ] ] 1
  299. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Current,$nick) + 1)
  300. writeini -n feud.ini Current $nick $calc($readini(feud.ini,n,Totals,$nick) + 1)
  301. unset %FF.a8
  302. set %FF.answerz %FF.answerz + 1
  303. check %FF.answerz
  304. }
  305.  
  306.  
  307. alias buildscores {
  308. var %x 1
  309. while (%x <= $ini(feud.ini,Current,0)) {
  310. var %scores %scores $+($ini(feud.ini,Current,%x),:) $readini(feud.ini,Current,%x)
  311. inc %x
  312. }
  313. describe #qi_interesting Current game scores are: %scores
  314. set %FF.count 0
  315. set %FF.added 0
  316. set %FF.totalnicks $nick(%chanFF,0,a)
  317. set %FF.highest 0
  318. set %FF.highestnick $me
  319. set %FF.x $var(%FF.score.*, 0)
  320. set %FF.scoreoutput Scores:
  321. while (%FF.added < %FF.x) {
  322. while (%FF.count <= %FF.totalnicks) {
  323. set %FF.testnick $nick(%chanFF,%FF.count,a)
  324. if (%FF.score. [ $+ [ %FF.testnick ] ] != $null) && (%FF.score. [ $+ [ %FF.testnick ] ] >= %FF.highest) && (%FF.testnick !isin %FF.scoreoutput) {
  325. set %FF.highest %FF.score. [ $+ [ %FF.testnick ] ]
  326. set %FF.highestnick %FF.testnick
  327. }
  328. inc %FF.count
  329. }
  330. if (%FF.highest != 0) { set %FF.scoreoutput %FF.scoreoutput $+ %FF.highestnick $+ : %FF.highest $+ $chr(124) $+ $chr(32) }
  331. set %FF.highest 0
  332. set %FF.highesttnick $me
  333. inc %FF.added
  334. set %FF.count 0
  335. }
  336. set %FF.chop $calc($len(%FF.scoreoutput) - 1)
  337. set %FF.scoreoutput $left(%FF.scoreoutput,%FF.chop)
  338. if (%FF.scoreoutput == Scores:) set %FF.scoreoutput Nobody has any points!
  339. }
  340.  
  341. ;Checks to see if all answers have been said before time limit is up
  342. alias check {
  343. if ( $1 == %FF.dashes ) {
  344. .timer1 off
  345. .timer3 off
  346. game2
  347. }
  348. }
  349.  
  350.  
  351. ;Accounts for nickname changes mid-game.
  352. on *:NICK:{
  353. if ( %FF.score. [ $+ [ $nick ] ] != $null ) {
  354. set %FF.score. [ $+ [ $newnick ] ] %FF.score. [ $+ [ $nick ] ]
  355. unset %FF.score. [ $+ [ $nick ] ]
  356. }
  357. }
  358.  
  359. ;msgs the scores of players in the channel in order to the person that said !scores
  360. on *:TEXT:!scoreff:#:{
  361. buildscores
  362. msg $chan $caps($nick) %FF.scoreoutput
  363. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement