Ignore:
Timestamp:
11/01/06 18:56:08 (6 years ago)
Author:
james
Message:

interact with new improved trivia handler in bmotion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TriviaEngine/TriviaEngine-sqlite.tcl

    r23 r24  
    8383set trivia_flag T 
    8484set trivia_admin S 
     85 
     86#botnet handle of the bmotion bot we're going to play with (set blank to disable) 
     87set trivia_bmotion_bot "NoTopic" 
    8588# >>> 
     89 
     90# Send a botnet command to the bmotion bot 
     91proc trivia_bmotion_send { command params } { 
     92        global trivia_bmotion_bot 
     93         
     94        if {$trivia_bmotion_bot == ""} { 
     95                return 0 
     96        } 
     97 
     98        if [islinked $trivia_bmotion_bot] { 
     99                putbot $trivia_bmotion_bot "trivia $command :$params" 
     100                putloglev d * "triviaengine: send $command to $trivia_bmotion_bot with params $params" 
     101        } else { 
     102                putlog "triviaengine: trying to communicate with bmotion bot $trivia_bmotion_bot but it's not linked" 
     103        } 
     104} 
     105 
    86106 
    87107 
     
    363383 
    364384        putquick "PRIVMSG $trivia_channel :Congratulations $trivia_c(purple)$nick$trivia_c(off)! The answer was$trivia_c(purple) $answer$trivia_c(off)." 
     385 
     386        trivia_bmotion_send "winner" "$nick $answer" 
    365387        if {$newuser == 1} { 
    366388          putquick "PRIVMSG $trivia_channel :Welcome to our newest player,  $trivia_c(purple)$nick$trivia_c(off) :)" 
     
    879901#<<< 
    880902        global trivia_q_id trivia_q_cat trivia_q_question trivia_q_answer trivia_q_hint trivia_q_attempts trivia_channel trivia_status trivia_last_qid 
    881         global trivia_asking_question 
     903        global trivia_asking_question trivia_delay 
    882904 
    883905        if {$trivia_status != 1} { 
     
    912934        set trivia_asking_question 1 
    913935 
     936        trivia_bmotion_send "start" "$trivia_channel $trivia_delay" 
     937 
    914938        trivia_round 
     939 
    915940} 
    916941#>>> 
     
    938963        #update the hint 
    939964        set trivia_q_hint [trivia_make_hint $trivia_q_hint $trivia_q_answer] 
     965        putlog "hint is $trivia_q_hint" 
    940966 
    941967        #say our stuff 
     
    959985 
    960986        incr trivia_q_attempts 
     987 
     988        trivia_bmotion_send "hint" [string map {_ .} $trivia_q_hint] 
    961989 
    962990        set trivia_last_ts [clock seconds] 
     
    10611089        set trivia_asking_question 0 
    10621090 
     1091        trivia_bmotion_send "winner" "* $trivia_q_answer" 
     1092        trivia_bmotion_send "stop" "" 
     1093 
    10631094        set trivia_q_answer [string toupper $trivia_q_answer] 
    10641095        putquick "PRIVMSG $trivia_channel :Time's up! Nobody got it right. The answer was$trivia_c(purple) $trivia_q_answer" 
     
    11161147        trivia_killtimer 
    11171148 
     1149        trivia_bmotion_send "stop" "" 
     1150 
    11181151        putserv "PRIVMSG $trivia_channel :Skipping this question by $nick's request." 
    11191152        set trivia_timer [utimer $trivia_delay trivia_start_round] 
     
    11851218                putserv "PRIVMSG $trivia_channel :Trivia game stopped." 
    11861219                set trivia_status 0 
     1220                trivia_bmotion_send "stop" "" 
    11871221                trivia_killtimer 
    11881222        } 
Note: See TracChangeset for help on using the changeset viewer.