diff --git a/game/gamesrc/events/example.py b/game/gamesrc/events/example.py index dc0cb249c4..87a1230a34 100644 --- a/game/gamesrc/events/example.py +++ b/game/gamesrc/events/example.py @@ -8,6 +8,7 @@ objects inheriting to a particular script parent and calls one of its functions at a regular interval. """ +import sys from src.events import IntervalEvent from src.scheduler import add_event from src.objects.models import Object @@ -48,7 +49,16 @@ class EventBlinkButton(IntervalEvent): #log_infomsg("buttons found: %s" % buttons) for b in buttons: - b.scriptlink.blink() + try: + b.scriptlink.blink() + except AttributeError: + #button has no blink() method. Just ignore. + pass + except: + #show other tracebacks to owner of object. + #this is important, we must handle this exception + #gracefully! + b.get_owner().emit_to(sys.exc_info()[1]) #create and add the event to the global handler blink_event = EventBlinkButton() diff --git a/game/gamesrc/parents/examples/red_button.py b/game/gamesrc/parents/examples/red_button.py index c161351242..9f66038912 100644 --- a/game/gamesrc/parents/examples/red_button.py +++ b/game/gamesrc/parents/examples/red_button.py @@ -15,9 +15,11 @@ test button you must drop it before you will see its messages! from game.gamesrc.parents.base.basicobject import BasicObject #you have to import the event definition(s) from somewhere covered by @reload, -# - this is as good a place as any. Uncomment to turn off event system. +# - this is as good a place as any. import game.gamesrc.events.example +import game.gamesrc.events.eventSystem + # #commands on the button object # @@ -98,6 +100,10 @@ class RedButton(BasicObject): count += 1 obj.set_attribute("count",count) obj.get_location().emit_to_contents(s) + + def update_tick(self): + self.blink() + def class_factory(source_obj): """ diff --git a/src/objects/managers/object.py b/src/objects/managers/object.py index 9c3f66d48c..6e8dbaeeb8 100644 --- a/src/objects/managers/object.py +++ b/src/objects/managers/object.py @@ -84,8 +84,7 @@ class ObjectManager(models.Manager): """ o_query = self.filter(script_parent__exact=script_parent) return o_query.exclude(type__in=[defines_global.OTYPE_GARBAGE, - defines_global.OTYPE_GOING]) - + defines_global.OTYPE_GOING]) def list_search_object_namestr(self, searchlist, ostring, dbref_only=False, limit_types=False, match_type="fuzzy"): diff --git a/src/scheduler.py b/src/scheduler.py index bcba681be3..65fc8c12af 100644 --- a/src/scheduler.py +++ b/src/scheduler.py @@ -24,8 +24,6 @@ def add_event(event): #don't add multiple instances of the same event if event in schedule: return - #i = schedule.index(event) - #schedule[i] = event else: schedule.append(event) event.start_event_loop() diff --git a/src/session.py b/src/session.py index 0c83dd7ec0..8de79622ba 100755 --- a/src/session.py +++ b/src/session.py @@ -173,7 +173,7 @@ class SessionProtocol(StatefulTelnetProtocol): self.pobject.scriptlink.at_pre_login(self) self.pobject.scriptlink.at_post_login(self) - logger.log_infomsg("Loged in: %s" % self) + logger.log_infomsg("Logged in: %s" % self) self.cemit_info('Logged in: %s' % self) # Update their account's last login time.