root/tags/release-0-0-7/bMotion.tcl

Revision 116, 4.2 KB (checked in by jamesoff, 6 years ago)

Moved local abstract loading to after plugins, to allow overloading

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
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
13set bMotionRoot "scripts/bmotion"
14set bMotionModules "$bMotionRoot/modules"
15set bMotionPlugins "$bMotionRoot/plugins"
16
17if {![info exists bMotion_testing]} {
18  putloglev d * "bMotion: bMotion_testing is not defined, setting to 0."
19  set bMotion_testing 0
20}
21
22source "$bMotionRoot/VERSION"
23if {$bMotion_testing == 0} {
24  putlog "bMotion $bMotionVersion starting up..."
25}
26
27if {$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
33proc 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
45if {$bMotion_testing == 1} {
46  putlog "... loading variables"
47}
48source "$bMotionModules/variables.tcl"
49
50# load abstracts file (formerly randoms)
51if {$bMotion_testing == 1} {
52  putlog "... loading abstracts"
53}
54source "$bMotionModules/abstracts.tcl"
55
56# load settings
57if {$bMotion_testing == 1} {
58  putlog "... loading settings"
59}
60source "$bMotionModules/settings.tcl"
61#try to load a file for this bot
62catch {
63  if {${botnet-nick} != ""} {
64    source "$bMotionModules/settings_${botnet-nick}.tcl"
65    bMotion_putloglev d * "loaded settings for this bot from settings_${botnet-nick}.tcl"
66  }
67}
68
69#load system functions
70if {$bMotion_testing == 1} {
71  putlog "... loading system"
72}
73source "$bMotionModules/system.tcl"
74
75# load output functions
76if {$bMotion_testing == 1} {
77  putlog "... loading output"
78}
79source "$bMotionModules/output.tcl"
80
81# load mood functions
82if {$bMotion_testing == 1} {
83  putlog "... loading mood"
84}
85source "$bMotionModules/mood.tcl"
86
87# load event functions
88if {$bMotion_testing == 1} {
89  putlog "... loading events"
90}
91source "$bMotionModules/events.tcl"
92
93if {$bMotion_testing == 1} {
94  putlog "... loading events support"
95}
96source "$bMotionModules/events_support.tcl"
97
98# load interbot bits
99if {$bMotion_testing == 1} {
100  putlog "... loading interbot"
101}
102source "$bMotionModules/interbot.tcl"
103
104# load friendship code
105if {$bMotion_testing == 1} {
106  putlog "... loading friendship"
107}
108source "$bMotionModules/friendship.tcl"
109
110# load anti-flood code
111if {$bMotion_testing == 1} {
112  putlog "... loading flood"
113}
114source "$bMotionModules/flood.tcl"
115
116### That's everything but the plugins stuff loaded. Now load extra modules
117
118bMotion_putloglev d * "looking for 3rd party modules..."
119set files [lsort [glob -nocomplain "$bMotionModules/extra/*.tcl"]]
120foreach f $files {
121  bMotion_putloglev 1 * "loading module: $f"
122  catch {
123    source $f
124  }
125}
126
127### Done, load the plugins:
128
129# load plugins
130if {$bMotion_testing == 1} {
131  putlog "... loading plugins"
132}
133source "$bMotionModules/plugins.tcl"
134
135if {$bMotion_testing == 1} {
136  putlog "... loading plugin settings"
137}
138source "$bMotionModules/plugins_settings.tcl"
139
140#load local abstracts
141catch {
142  if {${botnet-nick} != ""} {
143    source "$bMotionModules/abstracts_${botnet-nick}.tcl"
144    bMotion_putloglev d * "loaded abstracts for this bot from abstracts_${botnet-nick}.tcl"
145  }
146}
147
148# load other bits
149if {$bMotion_testing == 1} {
150  putlog "... loading leet"
151}
152source "$bMotionModules/leet.tcl"
153
154# load diagnostics
155catch {
156  if {$bMotion_testing == 1} {
157    putlog "... loading self-diagnostics"
158  }
159  source "$bMotionModules/diagnostics.tcl"
160}
161
162# Ignition!
163bMotion_startTimers
164if {$bMotion_testing == 0} {
165  set bMotionCache(rehash) ""
166  putlog "\002bMotion $bMotionVersion AI online\002 :D"
167}
168
169# set this to 0 to stop showing the copyright
170# DO NOT DISTRIBUTE THIS FILE IF THE VARIABLE IS SET TO 0
171set bMotion_show_copyright 1
172
173if {$bMotion_show_copyright == 1} {
174  putlog "bMotion is Copyright (C) 2002 James Seward. bMotion comes with ABSOLUTELY NO WARRANTY;"
175  putlog "This is free software, and you are welcome to redistribute it under certain conditions."
176  putlog "See the COPYRIGHT file for details. You can edit bMotion.tcl to hide this message once you have read it."
177}
Note: See TracBrowser for help on using the browser.