Changeset 884

Show
Ignore:
Timestamp:
02/13/08 17:42:39 (11 months ago)
Author:
znx
Message:

Starting to get rid of bMotionCache, see #13

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/bMotion.tcl

    r846 r884  
    6666} 
    6767 
     68# needed for variables 
     69if {$bMotion_testing == 1} { 
     70  putlog "... loading plugin settings" 
     71} 
     72source "$bMotionModules/plugins_settings.tcl" 
     73 
    6874# init default variables 
    6975if {$bMotion_testing == 1} { 
     
    175181source "$bMotionModules/mood.tcl" 
    176182 
    177 if {$bMotion_testing == 1} { 
    178   putlog "... loading plugin settings" 
    179 } 
    180 source "$bMotionModules/plugins_settings.tcl" 
    181183 
    182184### That's everything but the plugins stuff loaded. Now load extra modules 
  • trunk/modules/plugins.tcl

    r797 r884  
    8181proc bMotion_plugin_find_simple { text lang } { 
    8282  bMotion_putloglev 3 * "bMotion_plugin_find_simple: text = $text, lang = $lang" 
    83   global bMotion_plugins_simple botnicks bMotionCache 
     83  global bMotion_plugins_simple botnicks 
    8484  set s [lsort [array names bMotion_plugins_simple]] 
    8585 
     
    9797        set c [rand 100] 
    9898        bMotion_putloglev 4 * "simple plugin $key matches" 
    99         if {$bMotionCache(last_simple) == $key} { 
     99        if {[bMotion_plugins_settings_get "system" "last_simple" "" ""] == $key} { 
    100100          bMotion_putloglev 3 * "trying to trigger same simple plugin twice in a row, aborting" 
    101101          return "" 
    102102        } 
    103               set bMotionCache(last_simple) $key 
     103            bMotion_plugins_settings_set "system" "last_simple" "" "" $key 
    104104        if {$chance > $c} { 
    105105          bMotion_putloglev 4 * "  `- firing" 
  • trunk/modules/variables.tcl

    r810 r884  
    6666  set bMotionCache(remoteBot) "" 
    6767  set bMotionCache(randomUser) "" 
    68   set bMotionCache(lastPlugin) "" 
    6968 
    70   set bMotionCache(last_simple) "" 
     69  bMotion_plugins_settings_set "system" "lastPlugin" "" "" "" 
     70  bMotion_plugins_settings_set "system" "last_simple" "" "" "" 
    7171 
    7272#this is set later 
  • trunk/plugins/en/complex_shocked.tcl

    r662 r884  
    1313 
    1414proc bMotion_plugin_complex_shock { nick host handle channel text } { 
     15        #if we spoke last, it's probable this is a reaction to us being 
     16        # surprised at yourself is lame 
     17        if {$channel == [bMotion_plugins_settings_get "complex:shock" "last" $channel ""]} { 
     18                return 0 
     19        } 
    1520 
    16   global bMotionCache 
    17   #if we spoke last, it's probable this is a reaction to us 
    18   #being surprised at yourself is lame 
    19   if {$bMotionCache($channel,last)} { 
    20     return 0 
    21   } 
    22  
    23   bMotionDoAction $channel $nick "%VAR{shocked}" 
    24   return 1 
     21        # set channel to stop use being suprised at ourselves! 
     22        bMotion_plugins_settings_set "complex:shock" "last" $channel "" "" 
     23         
     24        bMotionDoAction $channel $nick "%VAR{shocked}" 
     25        return 1 
    2526} 
    2627 
    2728bMotion_plugin_add_complex "shocked" "^((((=|:|;)-?(o|0))|(!+))|blimey|crumbs|i say)$" 40 bMotion_plugin_complex_shock "en" 
    28  
  • trunk/plugins/en/complex_smiley.tcl

    r662 r884  
    2222proc bMotion_plugin_complex_smiley { nick host handle channel text } { 
    2323  global mood 
    24   global bMotionCache 
    2524 
    2625  if {![bMotion_interbot_me_next $channel]} { return 0 } 
    2726 
    28   if {$bMotionCache(lastPlugin) == "bMotion_plugin_complex_smiley"} { 
    29     return 0 
     27  foreach i {"smiley" "smiley2" "smiley3" "smiley4" "smiley5"} { 
     28        bMotion_putloglev 2 * "checking $i" 
     29         
     30    if {[bMotion_plugin_history_check $channel "complex" $i]} { 
     31          return 0 
     32        } 
    3033  } 
    3134