| 1 | #bMotion core |
|---|
| 2 | # |
|---|
| 3 | # $Id$ |
|---|
| 4 | # |
|---|
| 5 | |
|---|
| 6 | # |
|---|
| 7 | # #5270 +(28)- [X] |
|---|
| 8 | # |
|---|
| 9 | # <Procyan> is there like 1 person on earth that knows tcl/tk and is writing all of the apps? |
|---|
| 10 | # <unSlider> procyan: no, there are a bunch of people who dont know tcl/tk but are writing apps for it anyway |
|---|
| 11 | # (www.bash.org) |
|---|
| 12 | |
|---|
| 13 | set bMotionRoot "scripts/bmotion" |
|---|
| 14 | set bMotionModules "$bMotionRoot/modules" |
|---|
| 15 | set bMotionPlugins "$bMotionRoot/plugins" |
|---|
| 16 | |
|---|
| 17 | if {![info exists bMotion_testing]} { |
|---|
| 18 | putloglev d * "bMotion: bMotion_testing is not defined, setting to 0." |
|---|
| 19 | set bMotion_testing 0 |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | source "$bMotionRoot/VERSION" |
|---|
| 23 | if {$bMotion_testing == 0} { |
|---|
| 24 | putlog "bMotion $bMotionVersion starting up..." |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | if {$bMotion_testing == 1} { |
|---|
| 28 | putlog "bMotion: INFO: Code loading in testing mode" |
|---|
| 29 | } else { |
|---|
| 30 | putloglev 1 * "bMotion: INFO: Code loading in running mode" |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | proc bMotion_putloglev { level star text } { |
|---|
| 34 | global bMotion_testing |
|---|
| 35 | if {![string match -nocase "bMotion: *" $text]} { |
|---|
| 36 | set text "bMotion: $text" |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | if {$bMotion_testing == 0} { |
|---|
| 40 | putloglev $level $star "($level)$text" |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | # init default variables |
|---|
| 45 | if {$bMotion_testing == 1} { |
|---|
| 46 | putlog "... loading variables" |
|---|
| 47 | } |
|---|
| 48 | source "$bMotionModules/variables.tcl" |
|---|
| 49 | |
|---|
| 50 | # load abstracts file (formerly randoms) |
|---|
| 51 | if {$bMotion_testing == 1} { |
|---|
| 52 | putlog "... loading abstracts" |
|---|
| 53 | } |
|---|
| 54 | source "$bMotionModules/abstracts.tcl" |
|---|
| 55 | #try to load a file for this bot |
|---|
| 56 | catch { |
|---|
| 57 | if {${botnet-nick} != ""} { |
|---|
| 58 | source "$bMotionModules/abstracts_${botnet-nick}.tcl" |
|---|
| 59 | bMotion_putloglev d * "loaded abstracts for this bot from abstracts_${botnet-nick}.tcl" |
|---|
| 60 | } |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | # load settings |
|---|
| 64 | if {$bMotion_testing == 1} { |
|---|
| 65 | putlog "... loading settings" |
|---|
| 66 | } |
|---|
| 67 | source "$bMotionModules/settings.tcl" |
|---|
| 68 | #try to load a file for this bot |
|---|
| 69 | catch { |
|---|
| 70 | if {${botnet-nick} != ""} { |
|---|
| 71 | source "$bMotionModules/settings_${botnet-nick}.tcl" |
|---|
| 72 | bMotion_putloglev d * "loaded settings for this bot from settings_${botnet-nick}.tcl" |
|---|
| 73 | } |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | #load system functions |
|---|
| 77 | if {$bMotion_testing == 1} { |
|---|
| 78 | putlog "... loading system" |
|---|
| 79 | } |
|---|
| 80 | source "$bMotionModules/system.tcl" |
|---|
| 81 | |
|---|
| 82 | # load output functions |
|---|
| 83 | if {$bMotion_testing == 1} { |
|---|
| 84 | putlog "... loading output" |
|---|
| 85 | } |
|---|
| 86 | source "$bMotionModules/output.tcl" |
|---|
| 87 | |
|---|
| 88 | # load mood functions |
|---|
| 89 | if {$bMotion_testing == 1} { |
|---|
| 90 | putlog "... loading mood" |
|---|
| 91 | } |
|---|
| 92 | source "$bMotionModules/mood.tcl" |
|---|
| 93 | |
|---|
| 94 | # load event functions |
|---|
| 95 | if {$bMotion_testing == 1} { |
|---|
| 96 | putlog "... loading events" |
|---|
| 97 | } |
|---|
| 98 | source "$bMotionModules/events.tcl" |
|---|
| 99 | |
|---|
| 100 | if {$bMotion_testing == 1} { |
|---|
| 101 | putlog "... loading events support" |
|---|
| 102 | } |
|---|
| 103 | source "$bMotionModules/events_support.tcl" |
|---|
| 104 | |
|---|
| 105 | # load interbot bits |
|---|
| 106 | if {$bMotion_testing == 1} { |
|---|
| 107 | putlog "... loading interbot" |
|---|
| 108 | } |
|---|
| 109 | source "$bMotionModules/interbot.tcl" |
|---|
| 110 | |
|---|
| 111 | # load friendship code |
|---|
| 112 | if {$bMotion_testing == 1} { |
|---|
| 113 | putlog "... loading friendship" |
|---|
| 114 | } |
|---|
| 115 | source "$bMotionModules/friendship.tcl" |
|---|
| 116 | |
|---|
| 117 | # load plugins |
|---|
| 118 | if {$bMotion_testing == 1} { |
|---|
| 119 | putlog "... loading plugins" |
|---|
| 120 | } |
|---|
| 121 | source "$bMotionModules/plugins.tcl" |
|---|
| 122 | |
|---|
| 123 | if {$bMotion_testing == 1} { |
|---|
| 124 | putlog "... loading plugin settings" |
|---|
| 125 | } |
|---|
| 126 | source "$bMotionModules/plugins_settings.tcl" |
|---|
| 127 | |
|---|
| 128 | # load anti-flood code |
|---|
| 129 | if {$bMotion_testing == 1} { |
|---|
| 130 | putlog "... loading flood" |
|---|
| 131 | } |
|---|
| 132 | source "$bMotionModules/flood.tcl" |
|---|
| 133 | |
|---|
| 134 | # load other bits |
|---|
| 135 | if {$bMotion_testing == 1} { |
|---|
| 136 | putlog "... loading leet" |
|---|
| 137 | } |
|---|
| 138 | source "$bMotionModules/leet.tcl" |
|---|
| 139 | |
|---|
| 140 | # Ignition! |
|---|
| 141 | bMotion_startTimers |
|---|
| 142 | if {$bMotion_testing == 0} { |
|---|
| 143 | set bMotionCache(rehash) "" |
|---|
| 144 | putlog "\002bMotion $bMotionVersion AI online\002 :D" |
|---|
| 145 | } |
|---|
| 146 | |
|---|
| 147 | # set this to 0 to stop showing the copyright |
|---|
| 148 | # DO NOT DISTRIBUTE THIS FILE IF THE VARIABLE IS SET TO 0 |
|---|
| 149 | set bMotion_show_copyright 1 |
|---|
| 150 | |
|---|
| 151 | if {$bMotion_show_copyright == 1} { |
|---|
| 152 | putlog "bMotion is Copyright (C) 2002 James Seward. bMotion comes with ABSOLUTELY NO WARRANTY;" |
|---|
| 153 | putlog "This is free software, and you are welcome to redistribute it under certain conditions." |
|---|
| 154 | putlog "See the COPYRIGHT file for details. You can edit bMotion.tcl to hide this message once you have read it." |
|---|
| 155 | } |
|---|