Changeset 961
- Timestamp:
- 27/09/2008 18:31:43 (2 months ago)
- Location:
- trunk
- Files:
-
- 9 added
- 25 modified
-
modules/abstracts/en/abstracts.tcl (modified) (5 diffs)
-
modules/abstracts/en/randomstuff.tcl (modified) (2 diffs)
-
modules/events.tcl (modified) (1 diff)
-
modules/output.tcl (modified) (6 diffs)
-
modules/plugins.tcl (modified) (3 diffs)
-
modules/system.tcl (modified) (1 diff)
-
plugins/admin_plugin.tcl (modified) (1 diff)
-
plugins/en/action_complex_failsafe.tcl (modified) (1 diff)
-
plugins/en/action_complex_smacks.tcl (modified) (2 diffs)
-
plugins/en/complex_fuckoff.tcl (modified) (1 diff)
-
plugins/en/complex_hello.tcl (modified) (1 diff)
-
plugins/en/irc_join.tcl (modified) (2 diffs)
-
plugins/en/output_NUMBER.tcl (added)
-
plugins/en/output_OWNER.tcl (added)
-
plugins/en/output_PLURAL.tcl (added)
-
plugins/en/output_REPEAT.tcl (added)
-
plugins/en/output_SETTING.tcl (added)
-
plugins/en/output_TIME.tcl (added)
-
plugins/en/output_VAR.tcl (added)
-
plugins/en/output_VERB.tcl (added)
-
plugins/en/output_append.tcl (modified) (1 diff)
-
plugins/en/output_colloquial.tcl (modified) (1 diff)
-
plugins/en/output_demon.tcl (modified) (1 diff)
-
plugins/en/output_diddlydots.tcl (modified) (1 diff)
-
plugins/en/output_ebonics.tcl (modified) (1 diff)
-
plugins/en/output_english.tcl (modified) (1 diff)
-
plugins/en/output_fix.tcl (modified) (1 diff)
-
plugins/en/output_general.tcl (modified) (1 diff)
-
plugins/en/output_jeffk.tcl (modified) (1 diff)
-
plugins/en/output_preprocess.tcl (added)
-
plugins/en/output_scots.tcl (modified) (1 diff)
-
plugins/en/output_synonym.tcl (modified) (1 diff)
-
plugins/en/output_typos.tcl (modified) (1 diff)
-
plugins/en/output_welsh.tcl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/abstracts/en/abstracts.tcl
r953 r961 3263 3263 "middle earth" 3264 3264 "the heart of the world" 3265 "bree" 3265 "behind the fridge" 3266 "down the back of the sofa" 3267 "up my cavernous arse" 3268 "up your cavernous arse" 3269 "up %OWNER{%ruser} cavernous arse" 3266 3270 } 3267 3271 … … 3292 3296 "\[%%\] I love %ruser%|%VAR{wrong_infoline}" 3293 3297 "\[%%\] Just call me %VAR{sillyThings}%|%VAR{wrong_infoline}" 3298 } 3299 3300 # someone we don't know joins the channel 3301 bMotion_abstract_register "unknown_joins" { 3302 "%VAR{ranjoins}" 3294 3303 } 3295 3304 … … 4068 4077 "Day %NUMBER{500} %VAR{bb_time}: %ruser is in the diary room, talking to Big Brother about %VAR{bb_diary}" 4069 4078 "Day %NUMBER{500} %VAR{bb_time}: %ruser has hidden %OWNER{%ruser} %VAR{bb_posession} in %VAR{bb_hide}" 4070 } 4079 "Day %NUMBER{500} %VAR{bb_time}: %ruser has been crying in the %VAR{bb_room} for %NUMBER{100} minutes" 4080 "Day %NUMBER{500} %VAR{bb_time}: %ruser had a dream about %VAR{nightmare}. %ruser hides in the %VAR{bb_room}" 4081 } 4082 4083 bMotion_abstract_register "bb_room" { 4084 "diary room" 4085 "kitchen" 4086 "dining area" 4087 "lounge" 4088 "garden" 4089 "roof" 4090 } 4091 4071 4092 bMotion_abstract_register "bb_time" { 4072 4093 "%TIME{now}" … … 4241 4262 "%daytime!%|%VAR{todays_episode}" 4242 4263 "%daytime%|%VAR{todays_episode}" 4264 "%VAR{bb_stuff}" 4243 4265 } 4244 4266 … … 4346 4368 } 4347 4369 4370 bMotion_abstract_register "noun_prefix" { 4371 "space" 4372 "surprise" 4373 "lovely" 4374 "minging" 4375 "nice" 4376 "horrible" 4377 } 4378 4348 4379 source "$bMotionModules/abstracts/en/randomstuff.tcl" -
trunk/modules/abstracts/en/randomstuff.tcl
r959 r961 6 6 ### Used when the channel is not 'active' (default > 300s since last line) 7 7 bMotion_abstract_register "randomStuff" { 8 "/washes %hisher %VAR{bodypart}" 8 9 "%BOT\[<%me> good news everyone, I'm a horse's butt!\]%|i am? that doesn't sound like good news at all %VAR{unsmiles}" 9 10 "too bad %ruser's not around... i'll have to eat this raw dripping ham by myself" … … 454 455 ### Used when the channel is 'active' (default < 300 sec since last line) 455 456 bMotion_abstract_register "activeRandomStuff" { 457 "that's nice dear" 456 458 "very good, give me surprised and pleased" 457 459 "impossible%|you are already at full cock now" -
trunk/modules/events.tcl
r954 r961 348 348 set bMotion_testing 0 349 349 if {[matchattr $handle m]} { 350 putchan $channel [bMotion DoInterpolation "%VAR{rehashes}" "" ""]350 putchan $channel [bMotion_abstract_get "rehashes"] 351 351 rehash 352 352 return 0 -
trunk/modules/output.tcl
r954 r961 163 163 } 164 164 165 #do this first now 165 166 # Run the plugins :D 167 168 # First run the core plugins 169 set plugins [bMotion_plugin_find_output $bMotionInfo(language) $channel 0 10] 170 if {[llength $plugins] > 0} { 171 foreach callback $plugins { 172 bMotion_putloglev 1 * "bMotion: output plugin: $callback..." 173 set result "" 174 catch { 175 set result [$callback $channel $text] 176 } err 177 bMotion_putloglev 3 * "bMotion: returned from output $callback ($result)" 178 # TODO: Still used? 179 if {$result == ""} { 180 return 0 181 } 182 set text $result 183 } 184 } 185 166 186 set text [bMotionDoInterpolation $text $nick $moreText $channel] 167 187 168 set multiPart 0 169 if [string match "*%|*" $text] { 170 set multiPart 1 171 # we have many things to do 172 set thingsToSay "" 173 set loopCount 0 174 set blah 0 175 176 #make sure we get the last section 177 set text "$text%|" 178 179 while {[string match "*%|*" $text]} { 180 set origtext $text 181 set sentence [string range $text 0 [expr [string first "%|" $text] -1]] 182 if {$sentence != ""} { 183 if {$blah == 0} { 184 set thingsToSay [list $sentence] 185 set blah 1 186 } else { 187 lappend thingsToSay $sentence 188 # now the rest 189 if {$noTypo == 0} { 190 set plugins [bMotion_plugin_find_output $bMotionInfo(language) $channel 11] 191 if {[llength $plugins] > 0} { 192 foreach callback $plugins { 193 bMotion_putloglev 1 * "bMotion: output plugin: $callback..." 194 set result "" 195 catch { 196 set result [$callback $channel $text] 197 } err 198 bMotion_putloglev 3 * "bMotion: returned from output $callback ($result)" 199 if {$result == ""} { 200 return 0 188 201 } 189 } 190 set text [string range $text [expr [string first "%|" $text] + 2] end] 191 if {$text == $origtext} { 192 putlog "bMotion ALERT! Bailed in bMotionDoAction with $text. Lost output." 193 return 0 194 } 195 } 196 } 197 198 if {$multiPart == 1} { 199 foreach lineIn $thingsToSay { 200 set temp [bMotionSayLine $channel $nick $lineIn $moreText $noTypo $urgent] 201 if {$temp == 1} { 202 bMotion_putloglev 1 * "bMotion: bMotionSayLine returned 1, skipping rest of output" 203 #1 stops continuation after a failed %bot[n,] 204 break 205 } 206 set typosDone [bMotion_plugins_settings_get "output:typos" "typosDone" "" ""] 207 bMotion_putloglev 2 * "bMotion: typosDone (multipart) is !$typosDone!" 208 if {$typosDone != ""} { 209 bMotion_plugins_settings_set "output:typos" "typosDone" "" "" "" 210 if [rand 2] { 211 bMotionDoAction $channel "" "%VAR{typoFix}" "" 1 212 } 213 bMotion_plugins_settings_set "output:typos" "typos" "" "" "" 214 } 215 } 202 set text $result 203 } 204 } 205 } 206 207 #make sure the line wasn't set to blank by a plugin (may be trying to block output) 208 set line [string trim $text] 209 if {$line == ""} { 216 210 return 0 217 211 } 218 212 219 bMotionSayLine $channel $nick $text $moreText $noTypo $urgent 220 set typosDone [bMotion_plugins_settings_get "output:typos" "typosDone" "" ""] 221 bMotion_putloglev 2 * "bMotion: typosDone is !$typosDone!" 222 if {$typosDone != ""} { 223 bMotion_plugins_settings_set "output:typos" "typosDone" "" "" "" 224 if [rand 2] { 225 bMotionDoAction $channel "" "%VAR{typoFix}" "" 1 226 } 227 bMotion_plugins_settings_set "output:typos" "typos" "" "" "" 228 } 229 213 # Explode line into lines 214 # We map %| to NUL and split on that, since [split] can't 215 # handle multichar boundaries 216 set lines [split [string map [list "%|" \x00] $line] \x00] 217 218 foreach lineIn $lines { 219 set temp [bMotionSayLine $channel $nick $lineIn $moreText $noTypo $urgent] 220 if {$temp == 1} { 221 bMotion_putloglev 1 * "bMotion: bMotionSayLine returned 1, skipping rest of output" 222 #1 stops continuation after a failed %bot[n,] 223 break 224 } 225 #set typosDone [bMotion_plugins_settings_get "output:typos" "typosDone" "" ""] 226 #bMotion_putloglev 2 * "bMotion: typosDone is !$typosDone!" 227 ## TODO: fix this 228 #if {$typosDone != ""} { 229 # bMotion_plugins_settings_set "output:typos" "typosDone" "" "" "" 230 # if [rand 2] { 231 # bMotionDoAction $channel "" "%VAR{typoFix}" "" 1 232 # } 233 # bMotion_plugins_settings_set "output:typos" "typos" "" "" "" 234 #} 235 } 230 236 return 0 231 237 } … … 238 244 global botnick bMotionCache 239 245 240 if [string match "*%noun*" $line] {241 set line [bMotionInsertString $line "%noun" "%VAR{sillyThings}"]242 }243 244 #set loops 0245 bMotion_putloglev 4 * "doing VAR processing"246 set lastloop ""247 while {[regexp -nocase {%VAR\{([^\}]+)\}(\{strip\})?} $line matches BOOM clean]} {248 global $BOOM249 #see if we have a new-style abstract available250 set newText [bMotion_abstract_get $BOOM]251 set replacement ""252 if {$newText == ""} {253 bMotion_putloglev d * "abstract '$BOOM' doesn't exist in new abstracts system!"254 #insert old style255 set var [subst $$BOOM]256 set replacement [pickRandom $var]257 } else {258 set replacement $newText259 }260 if {$clean != ""} {261 set replacement [bMotion_strip_article $replacement]262 }263 regsub -nocase "%VAR\{$BOOM\}$clean" $line $replacement line264 if [string match "*%noun*" $line] {265 set line [bMotionInsertString $line "%noun" "%VAR{sillyThings}"]266 }267 if {$lastloop == $line} {268 putlog "bMotion: ALERT! looping too much in %VAR code with $line (no change since last parse)"269 set line "/has a tremendous error while trying to sort something out :("270 break271 }272 set lastloop $line273 }274 275 set loops 0276 bMotion_putloglev 4 * "doing SETTING processing"277 while {[regexp "%SETTING\{(.+?)\}" $line matches settingString]} {278 set var ""279 if [regexp {([^:]+:[^:]+):([^:]+):([^:]+):([^:]+)} $settingString matches plugin setting ch ni] {280 set var [bMotion_plugins_settings_get $plugin $setting $ch $ni]281 }282 incr loops283 if {$loops > 10} {284 putlog "bMotion: ALERT! looping too much in %SETTING code with $line"285 set line "/has a tremendous error while trying to infer the meaning of life :("286 }287 if {$var == ""} {288 putlog "bMotion: ALERT! couldn't find setting $settingString (dropping output)"289 return ""290 }291 set line [bMotionInsertString $line "%SETTING{$settingString}" $var]292 }293 294 set loops 0295 bMotion_putloglev 4 * "doing NUMBER processing"296 set padding 0297 while {[regexp "%NUMBER\{(\[0-9\]+)\}(\{(\[0-9\]+)\})?" $line matches numberString paddingOpt padding]} {298 set var [bMotion_get_number [bMotion_rand_nonzero $numberString]]299 if {$padding > 0} {300 set fmt "%0$padding"301 append fmt "u"302 set var [format $fmt $var]303 }304 incr loops305 if {$loops > 10} {306 putlog "bMotion: ALERT! looping too much in %NUMBER code with $line"307 set line "/has a tremendous error while trying to think of a number :("308 }309 set line [bMotionInsertString $line "%NUMBER\\{$numberString\\}(\\{\[0-9\]+\\})?" $var]310 set padding 0311 }312 313 set loops 0314 bMotion_putloglev 4 * "doing TIME processing"315 while {[regexp "%TIME\{(\[a-zA-Z0-9 -\]+)\}" $line matches timeString]} {316 bMotion_putloglev 2 * "found timestring $timeString"317 set origtime $timeString318 regsub -nocase {^-([0-9]) minutes?$} $timeString "\\1 minutes ago" timeString319 set var [clock scan $timeString]320 set var [clock format $var -format "%I:%M %p"]321 bMotion_putloglev 2 * "using time $var"322 incr loops323 if {$loops > 10} {324 putlog "bMotion: ALERT! looping too much in %TIME code with %line"325 set line "/has a tremendous error while trying to do complex time mathematics :("326 }327 set line [bMotionInsertString $line "%TIME\\{$origtime\\}" $var]328 }329 330 246 bMotion_putloglev 4 * "doing misc interpolation processing for $line" 331 247 set line [bMotionInsertString $line "%%" $nick] 332 set line [bMotionInsertString $line "%pronoun" [getPronoun]]333 set line [bMotionInsertString $line "%himherself" [getPronoun]]334 set line [bMotionInsertString $line "%me" $botnick]335 set line [bMotionInsertString $line "%colen" [bMotionGetColenChars]]336 set line [bMotionInsertString $line "%hishers" [getHisHers]]337 set line [bMotionInsertString $line "%heshe" [getHeShe]]338 set line [bMotionInsertString $line "%hisher" [getHisHer]]339 248 set line [bMotionInsertString $line "%2" $moreText] 340 249 set line [bMotionInsertString $line "%percent" "%"] 341 set line [bMotionInsertString $line "%daytime" [bMotion_get_daytime]]342 343 250 344 251 bMotion_putloglev 4 * "done misc" … … 387 294 proc bMotionInterpolation2 { line } { 388 295 bMotion_putloglev 5 * "bMotionInterpolation2 ($line)" 389 #owners390 set loops 0391 392 while {[regexp -nocase "%OWNER\{(.*?)\}" $line matches BOOM]} {393 set BOOM [string map {\\ \\\\ [ \\\[ ] \\\] \{ \\\{ \} \\\} $ \\\$ \" \\\" | \\\|} $BOOM]394 395 incr loops396 if {$loops > 10} {397 putlog "bMotion: ALERT! looping too much in %OWNER code with $line"398 set line "/has a tremendous error while trying to sort something out :("399 }400 # set line [bMotionInsertString $line "%OWNER\{$BOOM\}" [bMotionMakePossessive $BOOM]]401 regsub -nocase "%OWNER\{$BOOM\}" $line [bMotionMakePossessive $BOOM] line402 regsub -all "\\\\" $line "" line403 }404 405 set loops 0406 while {[regexp -nocase "%VERB\{(.*?)\}" $line matches BOOM]} {407 incr loops408 if {$loops > 10} {409 putlog "bMotion: ALERT! looping too much in %VERB code with $line"410 set line "/has a tremendous error while trying to sort something out :("411 }412 # set line [bMotionInsertString $line "%VERB\{$BOOM\}" [bMotionMakeVerb $BOOM]]413 regsub -nocase "%VERB\{$BOOM\}" $line [bMotionMakeVerb $BOOM] line414 }415 416 set loops 0417 while {[regexp -nocase "%PLURAL\{(.*?)\}" $line matches BOOM]} {418 incr loops419 if {$loops > 10} {420 putlog "bMotion: ALERT! looping too much in %PLURAL code with $line"421 set line "/has a tremendous error while trying to sort something out :("422 }423 # set line [bMotionInsertString $line "%PLURAL\{$BOOM\}" [bMotionMakePlural $BOOM]]424 regsub -nocase "%PLURAL\{$BOOM\}" $line [bMotionMakePlural $BOOM] line425 }426 427 set loops 0428 while {[regexp -nocase "%REPEAT\{(.+?)\}" $line matches BOOM]} {429 incr loops430 if {$loops > 10} {431 putlog "bMotion: ALERT! looping too much in %REPEAT code with $line"432 set line "/has a tremendous error while trying to sort something out :("433 }434 set replacement [bMotionMakeRepeat $BOOM]435 regsub -nocase "%REPEAT\\{$BOOM\\}" $line $replacement line436 }437 296 438 297 return $line … … 446 305 global mood botnick bMotionInfo bMotionCache bMotionOriginalInput 447 306 global bMotion_output_delay 448 449 set line [bMotionInterpolation2 $line]450 307 451 308 #TODO: Put %ruser and %rbot back in here … … 470 327 } else { 471 328 #non-random 472 regexp {%BOT\[(@[^,]+,)?(.+)\]} $line matches condition cmd329 regexp {%BOT\[(@[^,]+,)?(.+)\]} $line matches condition cmd 473 330 } 474 331 … … 514 371 } 515 372 } 516 }517 518 # Run the plugins :D519 520 if {$noTypo == 0} {521 set plugins [bMotion_plugin_find_output $bMotionInfo(language) $channel]522 if {[llength $plugins] > 0} {523 foreach callback $plugins {524 bMotion_putloglev 1 * "bMotion: output plugin: $callback..."525 set result ""526 catch {527 set result [$callback $channel $line]528 } err529 bMotion_putloglev 3 * "bMotion: returned from output $callback ($result)"530 if [regexp "1Š(.+)" $result matches line] {531 break532 }533 if {$result == ""} {534 return 0535 }536 set line $result537 }538 }539 }540 541 #make sure the line wasn't set to blank by a plugin (may be trying to block output)542 if {($line == "") || [regexp "^ +$" $line]} {543 return 0544 373 } 545 374 -
trunk/modules/plugins.tcl
r958 r961 258 258 # 259 259 # Load an output plugin 260 proc bMotion_plugin_add_output { id callback enabled language { priority 2} } {260 proc bMotion_plugin_add_output { id callback enabled language { priority 11 } } { 261 261 global bMotion_plugins_output plugins bMotion_testing bMotion_noplugins 262 262 … … 283 283 # Sorted by priority then name 284 284 # Includes plugins only enabled for the given channel 285 proc bMotion_plugin_find_output { lang { channel "" } } {285 proc bMotion_plugin_find_output { lang { channel "" } { min_priority 0} { max_priority 100 } } { 286 286 global bMotion_plugins_output botnicks 287 287 global bMotion_plugins_output_perchan … … 295 295 set language [lindex $val $BMOTION_PLUGIN_OUTPUT_LANGUAGE] 296 296 set priority [lindex $val $BMOTION_PLUGIN_OUTPUT_PRIORITY] 297 if {[string match $lang $language] || ($language == "any")|| ($language == "all")} { 298 if {$enabled == 1} { 299 lappend result [list $callback $priority] 300 } else { 301 bMotion_putloglev 1 * "Searching $key for channel $channel" 302 if {$channel != ""} { 303 catch { 304 set chanlist $bMotion_plugins_output_perchan($key) 305 if {[lsearch $chanlist $channel] > -1} { 306 lappend result [list $callback $priority] 307 bMotion_putloglev d * "Plugin $key is enabled for $channel" 297 if {($priority >= $min_priority) && ($priority <= $max_priority)} { 298 if {[string match $lang $language] || ($language == "any")|| ($language == "all")} { 299 if {$enabled == 1} { 300 lappend result [list $callback $priority] 301 } else { 302 bMotion_putloglev 1 * "Searching $key for channel $channel" 303 if {$channel != ""} { 304 catch { 305 set chanlist $bMotion_plugins_output_perchan($key) 306 if {[lsearch $chanlist $channel] > -1} { 307 lappend result [list $callback $priority] 308 bMotion_putloglev d * "Plugin $key is enabled for $channel" 309 } 308 310 } 309 311 } -
trunk/modules/system.tcl
r958 r961 239 239 if [bMotion_is_active_enough $channel $active_idle_sec] { 240 240 #channel is fairly busy 241 if [bMotionSaySomethingRandom $channel 1] {242 lappend saidChannels "$channel/active"243 } else {244 lappend silentChannels $channel245 }241 if [bMotionSaySomethingRandom $channel 1] { 242 lappend saidChannels "$channel/active" 243 } else { 244 lappend silentChannels $channel 245 } 246 246 } else { 247 247 #use a more idle randomstuff 248 if [bMotionSaySomethingRandom $channel 0] {249 lappend saidChannels $channel250 } else {251 lappend silentChannels $channel252 }248 if [bMotionSaySomethingRandom $channel 0] { 249 lappend saidChannels $channel 250 } else { 251 lappend silentChannels $channel 252 } 253 253 } 254 254 } else { -
trunk/plugins/admin_plugin.tcl
r958 r961 54 54 if [regexp -nocase {disable ([^ ]+) (.+?)( .+)?} $arg matches t id channel] { 55 55 if {$t == "output"} { 56 bMotion_putadmin "Disabling output plugin $id..."57 56 if {$channel != ""} { 58 57 set channel [string trim $channel] -
trunk/plugins/en/action_complex_failsafe.tcl
