Show
Ignore:
Timestamp:
30/06/2008 15:57:51 (5 months ago)
Author:
james
Message:

new stuff from b

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/en/complex_questions.tcl

    r794 r934  
    9494  bMotion_putloglev 3 * "Checking question for 'want'" 
    9595  ## Want question targetted at me 
    96   if { [regexp -nocase "^$botnicks,?:? do you (need|want) (a|these|this|some|the|those|that)" $text] || 
    97         [regexp -nocase "^do you (want|need) (a|these|this|some|the|those|that) .* $botnicks ?\\?" $text] || 
    98         [regexp -nocase "^$botnicks,?:? would you like" $text] || 
    99         [regexp -nocase "^would you like .+ $botnicks" $text] || 
    100         [regexp -nocase "^$botnicks,?:? (do )?((yo)?u )?wanna" $text] || 
    101         [regexp -nocase "^(do )?((yo)?u )?wanna .+ $botnicks" $text] } { 
    102       bMotion_plugin_complex_question_want $nick $channel $host 
     96        set item "" 
     97  if { [regexp -nocase "^$botnicks,?:? do you (need|want) (a|these|this|some|the|those|that) (.+)" $text matches a b c item] || 
     98        [regexp -nocase "^do you (want|need) (a|these|this|some|the|those|that) (.*) $botnicks ?\\?" $text matches a b item] || 
     99        [regexp -nocase "^$botnicks,?:? would you like (.+)" $text matches a item] || 
     100        [regexp -nocase "^(do|would) you like (.+) $botnicks" $text matches item] || 
     101        [regexp -nocase "^$botnicks,?:? (do )?((yo)?u )?wanna (.+)" $text matches item] || 
     102        [regexp -nocase "^(do )?((yo)?u )?wanna (.+) $botnicks" $text matches item] } { 
     103      bMotion_plugin_complex_question_want $nick $channel $host $item 
    103104      return 1 
    104105  } 
     
    357358} 
    358359 
    359 proc bMotion_plugin_complex_question_want { nick channel host } { 
     360proc bMotion_plugin_complex_question_want { nick channel host { item "" } } { 
    360361    bMotion_putloglev 2 * "$nick Want/need question" 
    361     bMotionDoAction $channel [bMotionGetRealName $nick $host] "%VAR{question_want_reply_wrapper}" 
     362 
     363                if {$item != ""} { 
     364                        # let's try to figure out if this is an item proper or something like "to go home" etc 
     365                        if {[regexp -nocase "^(to)" $item]} { 
     366                                # TODO: scope for improvement --^ 
     367                                bMotion_putloglev 3 * "item actually looks like an action, using generic answer for now" 
     368                                bMotionDoAction $channel [bMotionGetRealName $nick $host] "%VAR{question_want_reply_wrapper}" 
     369                                return 1 
     370                        } 
     371 
     372                        # TODO: check if it's a user 
     373                        # TODO: factorise this code? 
     374                        # TODO: other tests? 
     375 
     376                        bMotion_putloglev 3 * "item looks like an item!" 
     377                        set original_item $item 
     378                        set item [string tolower [bMotion_strip_article $item]] 
     379                        regsub {\?} $item "" item 
     380                        regsub "s$" $item "" item 
     381 
     382                        if [bMotion_abstract_contains "_bmotion_like" $item] { 
     383                                bMotionDoAction $channel $original_item "%VAR{want_item_like}" $nick 
     384                                return 1 
     385                        } 
     386 
     387                        if [bMotion_abstract_contains "_bmotion_dislike" $item] { 
     388                                bMotionDoAction $channel $original_item "%VAR{want_item_dislike}" $nick 
     389                                return 1 
     390                        } 
     391                         
     392                        if {[rand 100] > 80} { 
     393                                bMotionDoAction $channel $original_item "%VAR{want_item_dislike}" $nick 
     394                                bMotion_abstract_add "_bmotion_dislike" $item 
     395                        } else { 
     396                                bMotionDoAction $channel $original_item "%VAR{want_item_like}" $nick 
     397                                bMotion_abstract_add "_bmotion_like" $item 
     398                        } 
     399                        return 1 
     400                } 
     401 
     402                if {$item == ""} { 
     403                        bMotion_putloglev 3 * "item is blank, using generic want answer" 
     404                        bMotionDoAction $channel [bMotionGetRealName $nick $host] "%VAR{question_want_reply_wrapper}" 
     405                } 
     406 
    362407    return 1 
    363408} 
     
    439484 
    440485proc bMotion_plugin_complex_question_doyou { nick channel host } { 
    441     bMotion_putloglev 2 * "$nick do you question" 
     486        bMotion_putloglev 2 * "$nick do you question" 
    442487  bMotionDoAction $channel [bMotionGetRealName $nick $host] "%VAR{answerDoyous}" 
    443488  return 1 
     
    516561  "%VAR{colours}" 
    517562} 
     563 
     564bMotion_abstract_register "want_item_like" { 
     565        "ooh yes please" 
     566        "%REPEAT{3:7:m} %%" 
     567        "yes please %2" 
     568        "/<3 %%" 
     569        "yes" 
     570        "affirmative" 
     571        "r" 
     572        "r %VAR{smiles}" 
     573        "wh%REPEAT{4:10:e}%|%% == best" 
     574        "%% <3" 
     575        "%%++" 
     576} 
     577 
     578bMotion_abstract_register "want_item_dislike" { 
     579        "e%REPEAT{2:5:w} no thanks" 
     580        "barf" 
     581        "bleh" 
     582        "nnk" 
     583        "do not want" 
     584        "blah horrible" 
     585        "no" 
     586        "no thanks" 
     587        "negative" 
     588        "god no" 
     589        "not a chance" 
     590}