def run (self):
		# -- add data directory to python search path
		sys.path.insert (0, "data")
		
		# -- load quest tree
		rpg.quest.get_state ()
		
		# -- setup some quest events
		factory = event.factory ()

		# -- one that detects all changes to the children of Quest_1
		capture_all_event = rpg.quest_event ("Quest_1.>")
		listener = factory.add (capture_all_event)
		listener.connect_callback ("quest_events", "event_callbacks", "capture_all")

		# -- one that detects changes of Quest_1
		quest_1_event = rpg.quest_event ("Quest_1")
		listener = factory.add (quest_1_event)
		listener.connect_callback ("quest_events", "event_callbacks", "quest_1")

		# -- start completing quest steps
		rpg.quest.set_completed ("Quest_1.Part_1.Step_3")
		rpg.quest.set_completed ("Quest_1.Step_1")
		
		# -- TODO: save and reload, then continue ...

		# -- complete remaining quest steps		
		rpg.quest.set_completed ("Quest_1.Part_1.Step_5")
		rpg.quest.set_completed ("Quest_1.Step_2")
		rpg.quest.set_completed ("Quest_1.Part_1.Step_4")

		return 0
Exemple #2
0
    def run(self):
        # -- add data directory to python search path
        sys.path.insert(0, "data")

        # -- load quest tree
        rpg.quest.load()

        # -- setup some quest events
        factory = event.factory()

        # -- one that detects all changes to the children of Quest_1
        capture_all_event = rpg.quest_event("Quest_1.>")
        listener = factory.add(capture_all_event)
        listener.connect_callback("quest_events", "event_callbacks",
                                  "capture_all")

        # -- one that detects changes of Quest_1
        quest_1_event = rpg.quest_event("Quest_1")
        listener = factory.add(quest_1_event)
        listener.connect_callback("quest_events", "event_callbacks", "quest_1")

        # -- start completing quest steps
        rpg.quest.set_completed("Quest_1.Part_1.Step_3")
        rpg.quest.set_completed("Quest_1.Step_1")

        # -- TODO: save and reload, then continue ...

        # -- complete remaining quest steps
        rpg.quest.set_completed("Quest_1.Part_1.Step_5")
        rpg.quest.set_completed("Quest_1.Step_2")
        rpg.quest.set_completed("Quest_1.Part_1.Step_4")

        return 0
Exemple #3
0
    def eventtest (self):
        #Add data to the path
        path = "data"
        sys.path.insert (0, path)
        
        self.init_modules (main.app.AUDIO)

        self.sound = audio.sound('at-demo-1.ogg')
        self.sound.play()

        fty = event.factory ()
        svd = 0
        
        music = bgmusic()
  
        # -- first event
        ev1 = event.time_event ("0m30s")
        ev1.set_repeat ("10m00s", -1)
        
        lst = fty.add (ev1)
        if not lst.connect_callback ("audio_events", "event_script", "timer", (music, )):
            event_script_error()
        
        # run for a while
        while True:
            base.Timer.update ()
            event.date.update ()
            audio.update ()
Exemple #4
0
   def __init__(self):
       self.sound = None
       self.sounds = [self.loadfile('at-demo-%x.ogg'%x) for x in range(2,10)]
 
       self.fty = event.factory ()
       for s in self.sounds:
           # -- end of sound event
           ev2 = audio.audio_event (s)
           lst = self.fty.add (ev2)
           if not lst.connect_callback ("audio_events", "event_script", "endsong", (self, )):
               event_script_error()
    def __init__(self, schedule):
        """
         ctor
        """
        # -- the map for this schedule
        self.schedule = schedule
        # -- The NPC map character instance ...
        self.chr = schedule.get_owner()

        self.fty = event.factory()
        lst = self.fty.add(world.move_event(self.chr.map(), "NPC"))
        lst.connect_callback("move_events", "move_test", "moving")
    def __init__(self):
        # -- init base class
        item.item.__init__(self)
        
        # -- we need an event factory for storing time events
        self.Events = event.factory ()

        # -- duration of a charge (as gametime format string)
        self.Duration = "5m"
        
        # -- flag to indicate whether the torch is on or off
        self.IsBurning = 0
    def __init__(self):
        # -- init base class
        item.item.__init__(self)

        # -- we need an event factory for storing time events
        self.Events = event.factory()

        # -- duration of a charge (as gametime format string)
        self.Duration = "5m"

        # -- flag to indicate whether the torch is on or off
        self.IsBurning = 0
Exemple #8
0
    def __init__ (self, schedule):
        """
         ctor
        """
        # -- the map for this schedule
        self.schedule = schedule
        # -- The NPC map character instance ... 
        self.chr = schedule.get_owner()

        self.fty = event.factory()
        lst = self.fty.add (world.move_event (self.chr.map(), "NPC"))
        lst.connect_callback ("move_events", "move_test", "moving")
Exemple #9
0
    def eventtest(self):

        filename = sys.path[0] + "/data/eventtest.data"

        # -- add data directory to python search path
        sys.path.insert(0, "data")

        fty = event.factory()
        svd = 0

        # -- first event
        ev1 = event.time_event("0m30s")
        ev1.set_repeat("30s", 6)

        lst = fty.add(ev1)
        lst.connect_callback("time_events", "event_script", "callback_1",
                             ("#1", 1))

        # -- second event
        ev2 = event.time_event("1m05s")
        ev2.set_repeat("30s", 4)

        lst = fty.add(ev2)
        lst.connect_callback("time_events", "event_script", "callback_2")

        # -- run for 3:20 gametime minutes
        while event.date.time() < 200:
            # -- save factory to disk
            if event.date.time() == 100 and svd == 0:
                print "   Saving state"
                record = base.diskio(base.diskio.GZ_FILE)
                fty.put_state(record)
                record.put_record(filename)
                svd = 1

            base.Timer.update()
            event.date.update()

        # -- resume with saved state
        print "   Returning to previously saved state"
        fty.clear()

        # -- need absolute filename for loading or file has to sit in
        #    Adonthell's search path
        record = base.diskio(base.diskio.GZ_FILE)
        record.get_record(filename)
        success = fty.get_state(record)
        if success == 1: print "OK"
        else:
    def eventtest (self):

        filename = sys.path[0] + "/data/eventtest.data"

        # -- add data directory to python search path
        sys.path.insert (0, "data")

        fty = event.factory ()
        svd = 0
        
        # -- first event
        ev1 = event.time_event ("0m30s")
        ev1.set_repeat ("30s", 6)
        
        lst = fty.add (ev1)
        lst.connect_callback ("time_events", "event_script", "callback_1", ("#1", 1))
        
        # -- second event
        ev2 = event.time_event ("1m05s")
        ev2.set_repeat ("30s", 4)
        
        lst = fty.add (ev2)
        lst.connect_callback ("time_events", "event_script", "callback_2")
        
        # -- run for 3:20 gametime minutes
        while event.date.time () < 200:
            # -- save factory to disk
            if event.date.time () == 100 and svd == 0:
                print "   Saving state"
                record = base.diskio (base.diskio.GZ_FILE)
                fty.put_state (record)
                record.put_record (filename)
                svd = 1
                
            base.Timer.update ()
            event.date.update ()
    
        # -- resume with saved state
        print "   Returning to previously saved state"
        fty.clear ()
       
        # -- need absolute filename for loading or file has to sit in
        #    Adonthell's search path 
        record = base.diskio (base.diskio.GZ_FILE)
        record.get_record (filename)
        success = fty.get_state (record)
        if success == 1: print "OK"
        else:
Exemple #11
0
 def __init__ (self, initiator, other):
     self.factory = event.factory()
     self.initiator = initiator
     self.other = other
Exemple #12
0
 def __init__(self, initiator, other):
     self.factory = event.factory()
     self.initiator = initiator
     self.other = other