Changeset 1123


Ignore:
Timestamp:
12/15/11 10:01:57 (5 months ago)
Author:
james
Message:

Count hats

Location:
trunk/plugins/en
Files:
2 edited

Legend:

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

    r1105 r1123  
    2424 
    2525        bMotionDoAction $channel $nick "%VAR{cracker_boom}" 
     26        set hats [bMotion_plugins_settings_get "cracker" "hats" $channel ""] 
     27        if {$hats == ""} { 
     28                set hats 0 
     29        } 
    2630 
    2731        if [rand 2] { 
     
    3034                if [rand 2] { 
    3135                        bMotionDoAction $channel $nick "%VAR{cracker_win_hat}" 
     36                        incr hats 
     37                        bMotion_plugins_settings_set "cracker" "hats" $channel "" $hats 
     38                        if [rand 4] { 
     39                                if {$hats > 1} { 
     40                                        bMotionDoAction $channel $nick "%VAR{cracker_hats}" $hats 
     41                                } 
     42                        } 
    3243                } 
    3344                return 1 
     
    3748                if [rand 2] { 
    3849                        bMotionDoAction $channel $nick "%VAR{cracker_lose_hat}" 
     50                        if {$handle != "*"} { 
     51                                set hats [bMotion_plugins_settings_get "cracker" "hats" $channel $handle] 
     52                                if {$hats == ""} { 
     53                                        set hats 0 
     54                                } 
     55                                incr hats 
     56                                bMotion_plugins_settings_set "cracker" "hats" $channel $handle $hats 
     57                                if [rand 4] { 
     58                                        if {$hats > 1} { 
     59                                                bMotionDoAction $channel $nick "%VAR{cracker_your_hats}" $hats 
     60                                        } 
     61                                } 
     62                        } 
    3963                } 
    4064                return 1 
     
    93117        "a %VAR{scrap_silly_qualities} %VAR{scrap_silly_adjectives} %VAR{scrap_silly_construction}" 
    94118} 
     119 
     120bMotion_abstract_register "cracker_hats" { 
     121        "/is now wearing %2 hats" 
     122        "/has %s hats on" 
     123} 
     124bMotion_abstract_add_filter "cracker_hats" "SETTING" 
     125 
     126bMotion_abstract_register "cracker_your_hats" { 
     127        "You're now wearing %2 hats." 
     128        "Woo, %2 hats for you %SMILEY{smile}" 
     129} 
     130 
     131bMotion_abstract_register "cracker_hats_current" { 
     132        "/is wearing %2 hats" 
     133        "/has %2 hats on" 
     134} 
     135 
     136bMotion_abstract_register "cracker_your_hats_current" { 
     137        "You've got %2 hats on!" 
     138        "%2, silly" 
     139        "%2, silly%|can't you tell?" 
     140        "%2 hats and %VAR{sillyThings}" 
     141} 
     142 
     143bMotion_abstract_register "cracker_hats_current" { 
     144        "%% has %2 hats on" 
     145        "%2 hats" 
     146} 
  • trunk/plugins/en/complex_questions.tcl

    r1108 r1123  
    136136  if { [regexp -nocase "^$botnicks,?:? how ?many" $text] || 
    137137       [regexp -nocase "^how ?many .* $botnicks ?\\?" $text] } { 
    138     bMotion_plugin_complex_question_many $nick $channel $host 
     138    bMotion_plugin_complex_question_many $nick $channel $host $text 
    139139    return 1 
    140140  } 
     
    432432# } 
    433433 
    434 proc bMotion_plugin_complex_question_many { nick channel host } { 
     434proc bMotion_plugin_complex_question_many { nick channel host line } { 
    435435    bMotion_putloglev 2 * "$nick how many question" 
     436                set handle [nick2hand $nick] 
     437                if [regexp -nocase "how many (xmas |cracker |christmas )?hats (am|are|do|is) (.+) " $line matches 1 2 3] { 
     438                        if {$3 == "you"} { 
     439                                set hats [bMotion_plugins_settings_get "cracker" "hats" $channel ""] 
     440                                if {($hats == "") || ($hats == 0)} { 
     441                                        bMotionDoAction $channel "" "No hats for me %SMILEY{sad}" 
     442                                        return 1 
     443                                } 
     444                                if {$hats == 1} { 
     445                                        bMotionDoAction $channel "" "One hat only" 
     446                                        return 1 
     447                                } 
     448                                bMotionDoAction $channel "" "%VAR{cracker_hats_current}" $hats 
     449                                return 1 
     450                        } 
     451 
     452                        if {$3 == "i"} { 
     453                                set hats [bMotion_plugins_settings_get "cracker" "hats" $channel $handle] 
     454                                if {($hats == "") || ($hats == 0)} { 
     455                                        bMotionDoAction $channel "" "No hats for you %SMILEY{sad}" 
     456                                        return 1 
     457                                } 
     458                                if {$hats == 1} { 
     459                                        bMotionDoAction $channel "" "One hat only" 
     460                                        return 1 
     461                                } 
     462                                bMotionDoAction $channel "" "%VAR{cracker_your_hats_current}"  
     463                                return 1 
     464                        } 
     465 
     466                        set handle [nick2hand $3] 
     467                        if {$handle == "*"} { 
     468                                bMotionDoAction $channel "" "No idea" 
     469                                return 1 
     470                        } 
     471                                set hats [bMotion_plugins_settings_get "cracker" "hats" $channel $handle] 
     472                                if {($hats == "") || ($hats == 0)} { 
     473                                        bMotionDoAction $channel $handle "No hats for %% %SMILEY{sad}" 
     474                                        return 1 
     475                                } 
     476                                if {$hats == 1} { 
     477                                        bMotionDoAction $channel "" "One hat only" 
     478                                        return 1 
     479                                } 
     480                                bMotionDoAction $channel $handle "%VAR{cracker_handle_hats_current}"  
     481                                return 1 
     482 
     483                } 
    436484  bMotionDoAction $channel [bMotionGetRealName $nick $host] "%VAR{answerHowmanys}" 
    437485  return 1 
Note: See TracChangeset for help on using the changeset viewer.