adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[adonthell-wastesedge-commits] Release_0-3-1 558cf65 088/237: Fixed the


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 558cf65 088/237: Fixed the mess I made yesterday. Sorry.
Date: Mon, 25 Jul 2016 18:14:59 +0000 (UTC)

tag: Release_0-3-1
commit 558cf6518e77cc25b4160e8db264a527e66f8d3f
Author: adondev <adondev>
Commit: adondev <adondev>

    Fixed the mess I made yesterday. Sorry.
---
 scripts/init.py                       |    2 +-
 scripts/schedules/action_talk.py      |   36 +++---
 scripts/schedules/alek.py             |   91 +++++++-------
 scripts/schedules/center_player.py    |    5 +-
 scripts/schedules/erek.py             |  173 ++++++++++++++-------------
 scripts/schedules/frostbloom.py       |   96 ++++++++-------
 scripts/schedules/janesta.py          |   93 ++++++++-------
 scripts/schedules/jelom.py            |   86 +++++++-------
 scripts/schedules/keyboard_control.py |  210 ++++++++++++++++-----------------
 scripts/schedules/oliver.py           |  181 ++++++++++++++--------------
 scripts/schedules/orloth.py           |  188 +++++++++++++++--------------
 scripts/schedules/random_move.py      |   15 ++-
 scripts/schedules/sarin.py            |  175 ++++++++++++++-------------
 scripts/schedules/silverhair.py       |   88 +++++++-------
 scripts/schedules/talan.py            |   86 +++++++-------
 15 files changed, 751 insertions(+), 774 deletions(-)

diff --git a/scripts/init.py b/scripts/init.py
index 290cb2b..66a1be9 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -766,4 +766,4 @@ if retval < 5:
 
     audio_play_background (1)
     gametime_update ()
-    map_engine.run ()
+    map_engine.run()
diff --git a/scripts/schedules/action_talk.py b/scripts/schedules/action_talk.py
index e322c5c..beea28d 100755
--- a/scripts/schedules/action_talk.py
+++ b/scripts/schedules/action_talk.py
@@ -3,27 +3,27 @@ def restore_schedule (retval, args):
     args[0].set_schedule_active (1)
     args[1].set_schedule_active (1)
 
-def run ():
-    if requester.get_name()==the_player.get_name():
-        # -- deactivate the schedule of the characters involved
-        myself.set_schedule_active (0)
-        requester.set_schedule_active (0)
+if requester.get_name()==the_player.get_name():
+    # -- deactivate the schedule of the characters involved
+    myself.set_schedule_active (0)
+    requester.set_schedule_active (0)
 
-        # -- look into the player's face
-        myself.look_invert(requester.currentmove())
+    # -- look into the player's face
+    myself.look_invert(requester.currentmove())
 
-        # -- init the dialogue engine
-        dlg = dialog_engine (myself, myself.get_dialogue (), 0)
+    # -- init the dialogue engine
+    dlg = dialog_engine (myself, myself.get_dialogue (), 0)
+    
+    # -- make sure the engine isn't deleted when we leave the script
+    dlg.thisown = 0
 
-        # -- make sure the engine isn't deleted when we leave the script
-        dlg.thisown = 0
+    # -- attach the callback
+    dlg.py_signal_connect (restore_schedule, win_event_CLOSE, (requester, 
myself))
 
-        # -- attach the callback
-        dlg.py_signal_connect (restore_schedule, win_event_CLOSE, (requester, 
myself))
+    # -- add the dialogue window to the win_manager
+    win_manager_add (dlg)
+    win_manager_set_focus (dlg)
 
-        # -- add the dialogue window to the win_manager
-        win_manager_add (dlg)
-        win_manager_set_focus (dlg)
+    # -- start the dialogue
+    dlg.run ()
 
-        # -- start the dialogue
-        dlg.run ()
diff --git a/scripts/schedules/alek.py b/scripts/schedules/alek.py
index a0a7aa8..7389ecc 100755
--- a/scripts/schedules/alek.py
+++ b/scripts/schedules/alek.py
@@ -15,51 +15,46 @@
 #    He'll walk between his table and the bar
 
 
-def init ():
-    speech = ["More Ale!", \
-              "I'll cut 'em open like ripe fruits.", \
-              "They should sort out this business like real men!"]
-    print "*** locals after init:", locals (), "\n"
-
-def run ():
-    print "*** locals:", locals (), "\n"
-
-    todo = myself.get_val ("todo")
-
-    # -- waiting
-    if todo == 0:
-        delay = myself.get_val ("delay")
-        # If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
-
-    # -- engage a new movement
-    elif todo == 1:
-        # -- walk to table
-        if myself.posx () == 1:
-            myself.set_goal (12, 5, STAND_NORTH)
-        # -- walk to bar
-        else:
-            myself.set_goal (1, 3, STAND_SOUTH)
-
-        myself.set_val ("todo", 2)
-
-    # -- moving
-    elif todo == 2:
-        if myself.follow_path () == 1:
-            # -- the time we stay at the same place
-            delay = randint (60, 150) * 20
-
-            myself.set_val ("delay", delay)
-            myself.set_val ("todo", 0)
-
-
-    # -- utter a random remark
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
-    if tmp == 0:
-        myself.speak (speech[randint (0, 2)])
-        delay = randint (40, 80) * 25
-        myself.set_val ("say_something", delay)
+speech = ["More Ale!", \
+          "I'll cut 'em open like ripe fruits.", \
+          "They should sort out this business like real men!"]
+
+todo = myself.get_val ("todo")
+
+# -- waiting
+if todo == 0:
+    delay = myself.get_val ("delay")
+    # If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
+
+# -- engage a new movement
+elif todo == 1:
+    # -- walk to table
+    if myself.posx () == 1:
+        myself.set_goal (12, 5, STAND_NORTH)
+    # -- walk to bar
+    else:
+        myself.set_goal (1, 3, STAND_SOUTH)
+
+    myself.set_val ("todo", 2)
+
+# -- moving
+elif todo == 2:
+    if myself.follow_path () == 1:
+        # -- the time we stay at the same place
+        delay = randint (60, 150) * 20
+
+        myself.set_val ("delay", delay)
+        myself.set_val ("todo", 0)
+
+
+# -- utter a random remark
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+if tmp == 0:
+    myself.speak (speech[randint (0, 2)])
+    delay = randint (40, 80) * 25
+    myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/center_player.py 
b/scripts/schedules/center_player.py
index 3fe1222..9caf386 100755
--- a/scripts/schedules/center_player.py
+++ b/scripts/schedules/center_player.py
@@ -1,3 +1,2 @@
-def run ():
-    p=the_player
-    myself.center_on(p.submap(),p.posx(),p.posy(),p.offx(),p.offy())
+p=the_player
+myself.center_on(p.submap(),p.posx(),p.posy(),p.offx(),p.offy())
diff --git a/scripts/schedules/erek.py b/scripts/schedules/erek.py
index 129dc7e..17e45ce 100755
--- a/scripts/schedules/erek.py
+++ b/scripts/schedules/erek.py
@@ -15,107 +15,106 @@
 #    Erek will either be in the parlour or the common room.
 #    He'll also help the player to get into Bjarn's room.
 
-def init ():
-    speech = ["How could they do that to the Master?", \
-              "This place is so much different from home.", \
-              "Who could have taken the gems?"]
-
-    coords = [(5, 5, STAND_NORTH), \
-              (10, 6, STAND_WEST), \
-              (5, 3, STAND_NORTH), \
-              (4, 5, STAND_SOUTH)]
-
-
-def run ():
-    # -- lead the player into bjarn's room
-    if quests["demo"].get_val ("bjarn_door_open") == 2:
-        myself.set_schedule_active (0)
-        # -- start Bjanr's conversation with the player and Erek
-        characters["Bjarn Fingolson"].launch_action (the_player)
-
-    # -- leave cellar again
-    elif myself.get_val ("leave_bjarn") == 1:
-        submap = myself.submap ()
-
-        # -- in Bjarn's room
-        if submap == 7:
-            myself.set_goal (0, 7, STAND_WEST)
-            myself.set_val ("leave_bjarn", 2)
-
-        # -- in the Cellar
-        elif submap == 4:
-            myself.set_goal (6, 1, STAND_NORTH)
-            myself.set_val ("leave_bjarn", 2)
-
-        # -- hopefully in the common room
-        else:
-            myself.set_val ("leave_bjarn", 0)
-            x, y, dir = coords[randint (0, 1)]
-            myself.set_goal (x, y, dir)
 
-        myself.set_val ("todo", 2)
+speech = ["How could they do that to the Master?", \
+          "This place is so much different from home.", \
+          "Who could have taken the gems?"]
 
+coords = [(5, 5, STAND_NORTH), \
+          (10, 6, STAND_WEST), \
+          (5, 3, STAND_NORTH), \
+          (4, 5, STAND_SOUTH)]
 
-    # -- "normal" schedule
-    todo = myself.get_val ("todo")
 
-    # -- waiting
-    if todo == 0:
-        delay = myself.get_val ("delay")
+# -- lead the player into bjarn's room
+if quests["demo"].get_val ("bjarn_door_open") == 2:
+    myself.set_schedule_active (0)
+    # -- start Bjanr's conversation with the player and Erek
+    characters["Bjarn Fingolson"].launch_action (the_player)
 
-        # If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
+# -- leave cellar again
+elif myself.get_val ("leave_bjarn") == 1:
+    submap = myself.submap ()
 
-    # -- get movement target
-    elif todo == 1:
-        # -- on our way back from bjarn's room
-        if myself.get_val ("leave_bjarn") == 2:
-            myself.set_val ("leave_bjarn", 1)
+    # -- in Bjarn's room
+    if submap == 7:
+        myself.set_goal (0, 7, STAND_WEST)
+        myself.set_val ("leave_bjarn", 2)
 
-        # -- switch places
-        else:
-            # -- in common room -> goto parlour
-            if myself.submap () == 1:
-                myself.set_goal (14, 4, STAND_EAST)
+    # -- in the Cellar
+    elif submap == 4:
+        myself.set_goal (6, 1, STAND_NORTH)
+        myself.set_val ("leave_bjarn", 2)
+
+    # -- hopefully in the common room
+    else:
+        myself.set_val ("leave_bjarn", 0)
+        x, y, dir = coords[randint (0, 1)]
+        myself.set_goal (x, y, dir)
+
+    myself.set_val ("todo", 2)
+
+
+# -- "normal" schedule
+todo = myself.get_val ("todo")
 
-            # -- in parlour -> goto common room
-            else:
-                myself.set_goal (0, 4, STAND_WEST)
+# -- waiting
+if todo == 0:
+    delay = myself.get_val ("delay")
 
-        myself.set_val ("todo", 2)
+    # If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
 
-    # -- move
-    elif todo == 2:
-        if myself.follow_path () == 1:
-            # -- reached common room
-            if myself.submap () == 1 and myself.posx () == 13:
-                x, y, dir = coords[randint (0, 1)]
-                myself.set_goal (x, y, dir)
+# -- get movement target
+elif todo == 1:
+    # -- on our way back from bjarn's room
+    if myself.get_val ("leave_bjarn") == 2:
+        myself.set_val ("leave_bjarn", 1)
 
-                delay = randint (50, 150) * 20
-                myself.set_val ("delay", delay)
+    # -- switch places
+    else:
+        # -- in common room -> goto parlour
+        if myself.submap () == 1:
+            myself.set_goal (14, 4, STAND_EAST)
 
-            # -- reached parlour
-            elif myself.submap () == 2 and myself.posx () == 1:
-                x, y, dir = coords[randint (2, 3)]
-                myself.set_goal (x, y, dir)
+        # -- in parlour -> goto common room
+        else:
+            myself.set_goal (0, 4, STAND_WEST)
+
+    myself.set_val ("todo", 2)
+
+# -- move
+elif todo == 2:
+    if myself.follow_path () == 1:
+        # -- reached common room
+        if myself.submap () == 1 and myself.posx () == 13:
+            x, y, dir = coords[randint (0, 1)]
+            myself.set_goal (x, y, dir)
 
-                delay = randint (60, 180) * 30
-                myself.set_val ("delay", delay)
+            delay = randint (50, 150) * 20
+            myself.set_val ("delay", delay)
 
-            # -- reached our final destination
-            else:
-                myself.set_val ("todo", 0)
+        # -- reached parlour
+        elif myself.submap () == 2 and myself.posx () == 1:
+            x, y, dir = coords[randint (2, 3)]
+            myself.set_goal (x, y, dir)
+
+            delay = randint (60, 180) * 30
+            myself.set_val ("delay", delay)
+
+        # -- reached our final destination
+        else:
+            myself.set_val ("todo", 0)
 
 
-    # -- do some random babbling
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
+# -- do some random babbling
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
 
-    if tmp == 0:
-        myself.speak (speech[randint (0, 2)])
-        delay = randint (60, 180) * 15
-        myself.set_val ("say_something", delay)
+if tmp == 0:
+    myself.speak (speech[randint (0, 2)])
+    delay = randint (60, 180) * 15
+    myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/frostbloom.py b/scripts/schedules/frostbloom.py
index cec9a73..af9099d 100755
--- a/scripts/schedules/frostbloom.py
+++ b/scripts/schedules/frostbloom.py
@@ -14,52 +14,50 @@
 #
 #    She just walks around the tree in the yard
 
-def init ():
-    # -- Borders of the area she will stay in
-    min_x = 16
-    max_x = 24
-    min_y = 21
-    max_y = 28
-
-    speech = ["This tree is so inspiring.", \
-              "I wonder why everybody seems so excited.", \
-              "Do you know a creature more lovely than the yeti?"]
-
-def run ():
-    todo = myself.get_val ("todo")
-
-    # -- waiting
-    if todo == 0:
-        delay = myself.get_val ("delay")
-
-        # If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
-
-    # -- get movement target
-    elif todo == 1:
-        # -- the position we want to reach
-        x = randint (min_x, max_x)
-        y = randint (min_y, max_y)
-
-        myself.set_goal (x, y, NO_MOVE)
-
-        delay = randint (30, 90) * 30
-        myself.set_val ("delay", delay)
-        myself.set_val ("todo", 2)
-
-    # -- walk to the new position
-    elif todo == 2:
-        if myself.follow_path () == 1:
-            myself.set_val ("todo", 0)
-
-
-    # -- utter a random remark
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
-    if tmp == 0:
-        myself.speak (speech[randint (0, 2)])
-        delay = randint (50, 150) * 20
-        myself.set_val ("say_something", delay)
+# -- Borders of the area she will stay in
+min_x = 16
+max_x = 24
+min_y = 21
+max_y = 28
+
+speech = ["This tree is so inspiring.", \
+          "I wonder why everybody seems so excited.", \
+          "Do you know a creature more lovely than the yeti?"]
+
+todo = myself.get_val ("todo")
+
+# -- waiting
+if todo == 0:
+    delay = myself.get_val ("delay")
+
+    # If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
+
+# -- get movement target
+elif todo == 1:
+    # -- the position we want to reach
+    x = randint (min_x, max_x)
+    y = randint (min_y, max_y)
+
+    myself.set_goal (x, y, NO_MOVE)
+
+    delay = randint (30, 90) * 30
+    myself.set_val ("delay", delay)
+    myself.set_val ("todo", 2)
+
+# -- walk to the new position
+elif todo == 2:
+    if myself.follow_path () == 1:
+        myself.set_val ("todo", 0)
+
+
+# -- utter a random remark
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+if tmp == 0:
+    myself.speak (speech[randint (0, 2)])
+    delay = randint (50, 150) * 20
+    myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/janesta.py b/scripts/schedules/janesta.py
index bc58598..3cbfa91 100644
--- a/scripts/schedules/janesta.py
+++ b/scripts/schedules/janesta.py
@@ -14,50 +14,49 @@
 #
 #    She'll busy herself in Silverhair's room
 
-def init ():
-    speech = ["Oh, dear. Oh, dear.", \
-              "What will happen to us if they take the Mistress?", \
-              "I must do something about this awful room.", \
-              "Oh, how do they expect us to live decently in a place like 
this?"]
-
-    coords = [(1, 3, STAND_NORTH), \
-              (6, 3, STAND_NORTH), \
-              (1, 5, STAND_SOUTH), \
-              (4, 2, STAND_WEST)]
-
-def run ():
-    todo = myself.get_val ("todo")
-
-    # -- waiting
-    if todo == 0:
-        delay = myself.get_val ("delay")
-        # If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
-
-    # -- engage a new movement
-    elif todo == 1:
-        x, y, dir = coords[randint (0, 3)]
-
-        myself.set_goal (x, y, dir)
-        myself.set_val ("todo", 2)
-
-    # -- moving
-    elif todo == 2:
-        if myself.follow_path () == 1:
-            # -- the time we stay at the same place
-            delay = randint (20, 60) * 10
-
-            myself.set_val ("delay", delay)
-            myself.set_val ("todo", 0)
-
-
-    # -- utter a random remark
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
-    if tmp == 0:
-        myself.speak (speech[randint (0, 3)])
-        delay = randint (50, 75) * 35
-        myself.set_val ("say_something", delay)
+
+speech = ["Oh, dear. Oh, dear.", \
+          "What will happen to us if they take the Mistress?", \
+          "I must do something about this awful room.", \
+          "Oh, how do they expect us to live decently in a place like this?"]
+
+coords = [(1, 3, STAND_NORTH), \
+          (6, 3, STAND_NORTH), \
+          (1, 5, STAND_SOUTH), \
+          (4, 2, STAND_WEST)]
+
+todo = myself.get_val ("todo")
+
+# -- waiting
+if todo == 0:
+    delay = myself.get_val ("delay")
+    # If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
+
+# -- engage a new movement
+elif todo == 1:
+    x, y, dir = coords[randint (0, 3)]
+
+    myself.set_goal (x, y, dir)
+    myself.set_val ("todo", 2)
+
+# -- moving
+elif todo == 2:
+    if myself.follow_path () == 1:
+        # -- the time we stay at the same place
+        delay = randint (20, 60) * 10
+
+        myself.set_val ("delay", delay)
+        myself.set_val ("todo", 0)
+
+
+# -- utter a random remark
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+if tmp == 0:
+    myself.speak (speech[randint (0, 3)])
+    delay = randint (50, 75) * 35
+    myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/jelom.py b/scripts/schedules/jelom.py
index be797db..2581f1d 100644
--- a/scripts/schedules/jelom.py
+++ b/scripts/schedules/jelom.py
@@ -14,47 +14,45 @@
 #
 #    He guards the door to Lady Silverhair's room
 
-def init ():
-    speech = ["Someone fetch me a drink!", \
-              "That'll teach them fancy Elves a lesson!", \
-              "Send them to the cursed island, I say!"]
-
-def run ():
-    todo = myself.get_val ("todo")
-
-    # If standing
-    if todo == 0:
-        delay = myself.get_val ("delay")
-        # If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
-
-    # Engage a new movement
-    elif todo == 1:
-        # Choose where to move, if destination is already occupied we'll
-        # fall into the wait state (0) again automatically next time
-        if myself.posy () == 3:
-            myself.set_goal (2, 6, STAND_NORTH)
-        else:
-            myself.set_goal (2, 3, STAND_SOUTH)
-
-        # Next time we'll actually move!
-        myself.set_val ("todo", 2)
-
-    # Moving, follow the path until it is reached.
-    elif todo == 2:
-        # Reached the goal? Wait a while then...
-        if myself.follow_path ():
-            myself.set_val ("delay", randint (30, 60) * 20)
-            myself.set_val ("todo", 0)
-
-
-    # -- utter a random remark
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
-    if tmp <= 0:
-        myself.speak (speech[randint (0, 2)])
-        delay = randint (75, 150) * 20
-        myself.set_val ("say_something", delay)
+speech = ["Someone fetch me a drink!", \
+          "That'll teach them fancy Elves a lesson!", \
+          "Send them to the cursed island, I say!"]
+
+todo = myself.get_val ("todo")
+
+# If standing
+if todo == 0:
+    delay = myself.get_val ("delay")
+    # If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
+
+# Engage a new movement
+elif todo == 1:
+    # Choose where to move, if destination is already occupied we'll
+    # fall into the wait state (0) again automatically next time
+    if myself.posy () == 3:
+        myself.set_goal (2, 6, STAND_NORTH)
+    else:
+        myself.set_goal (2, 3, STAND_SOUTH)
+        
+    # Next time we'll actually move!
+    myself.set_val ("todo", 2)
+
+# Moving, follow the path until it is reached.
+elif todo == 2:
+    # Reached the goal? Wait a while then...
+    if myself.follow_path ():
+        myself.set_val ("delay", randint (30, 60) * 20)
+        myself.set_val ("todo", 0)
+
+
+# -- utter a random remark
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+if tmp <= 0:
+    myself.speak (speech[randint (0, 2)])
+    delay = randint (75, 150) * 20
+    myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/keyboard_control.py 
b/scripts/schedules/keyboard_control.py
index 82600db..d74e6f8 100755
--- a/scripts/schedules/keyboard_control.py
+++ b/scripts/schedules/keyboard_control.py
@@ -51,108 +51,108 @@ def close_gate ():
         sm.get_square (6, 19).set_walkable_west (0)
         sm.get_square (6, 20).set_walkable_west (0)
 
-
-def run ():
-    if input_has_been_pushed (SDLK_o):
-        open_gate ()
-
-    if input_has_been_pushed (SDLK_c):
-        close_gate ()
-
-    # -- react to the action key
-    if input_has_been_pushed (SDLK_SPACE):
-        # -- see whether a character(/object) is next to the player
-        p = myself.whosnext ()
-
-        # - Yes :)
-        if p != None and p.currentmove() < WALK_NORTH:
-            # -- launch the other guy's (object's) action script
-            p.launch_action (myself)
-
-            # -- Cleanup
-            p = None
-        elif p == None:
-            evt = action_event ()
-            evt.submap = myself.submap ()
-            evt.x = myself.posx ()
-            evt.y = myself.posy ()
-            evt.dir = myself.currentmove ()
-            evt.c = myself
-            event_handler_raise_event (evt)
-
-    # -- bring up the main menu
-    elif input_has_been_pushed (SDLK_ESCAPE):
-        import main_menu
-
-        # -- open main menu without animation, with saving and background 
enabled
-        menu = main_menu.main_menu (1, 1, 1)
-        menu.thisown = C
-
-        # Stop updating the map
-        map_engine.set_should_update_map (0)
-
-        # -- this tells us when the main menu is closed
-        menu.py_signal_connect (on_menu_close, win_event_CLOSE, (myself))
-
-        # -- add stuff to the win_manager
-        win_manager_add (menu)
-        win_manager_set_focus (menu)
-        menu = None
-
-    # -- move the player around
-    elif input_is_pushed (SDLK_UP): myself.go_north ()
-    elif input_is_pushed (SDLK_DOWN): myself.go_south ()
-    elif input_is_pushed (SDLK_RIGHT): myself.go_east ()
-    elif input_is_pushed (SDLK_LEFT): myself.go_west ()
-
-    # Special tip! :)
-    elif input_has_been_pushed (SDLK_n):
-        if myself.submap () < map_engine.get_landmap ().nbr_of_submaps () - 1:
-            myself.jump_to (myself.submap () + 1, 5, 3)
-        else:
-            myself.jump_to (0, 7, 18)
-
-    elif input_has_been_pushed (SDLK_p):
-        if myself.submap () > 1:
-            myself.jump_to (myself.submap () - 1, 5, 3)
-        elif myself.submap () == 1:
-            myself.jump_to (0, 7, 18)
-        else:
-            myself.jump_to (map_engine.get_landmap ().nbr_of_submaps () - 1, 
5, 3)
-
-    # -- shortcut to the load screen
-    elif input_has_been_pushed (SDLK_l):
-        s = data_screen (LOAD_SCREEN)
-        s.thisown = C
-        s.py_signal_connect (on_data_screen_close, win_event_CLOSE)
-        # Stop updating the map
-        map_engine.set_should_update_map (0)
-        s.set_activate (1)     
-        win_manager_add (s)
-        win_manager_set_focus (s)
-
-
-    # -- and to the save screen
-    elif input_has_been_pushed (SDLK_s):
-        s = data_screen (SAVE_SCREEN)
-        s.thisown = C
-        s.py_signal_connect (on_data_screen_close, win_event_CLOSE)
-        # Stop updating the map
-        map_engine.set_should_update_map (0)
-        s.set_activate (1)     
-        win_manager_add (s)
-        win_manager_set_focus (s)
-
-
-    # -- python console
-    elif input_has_been_pushed (SDLK_TAB):
-        import console
-        c = console.console (globals ())
-        c.thisown = C
-        c.py_signal_connect (on_data_screen_close, win_event_CLOSE)
-        # Stop updating the map
-        map_engine.set_should_update_map (0)
-        c.set_activate (1)
-        win_manager_add (c)
-        win_manager_set_focus (c)
-        c = None
+#print "%d %d %d" % (myself.submap (), myself.posx (), myself.posy ())
+
+if input_has_been_pushed (SDLK_o):
+    open_gate ()
+
+if input_has_been_pushed (SDLK_c):
+    close_gate ()
+
+# -- react to the action key
+if input_has_been_pushed (SDLK_SPACE):
+    # -- see whether a character(/object) is next to the player
+    p = myself.whosnext ()
+
+    # - Yes :)
+    if p != None and p.currentmove() < WALK_NORTH:
+        # -- launch the other guy's (object's) action script 
+        p.launch_action (myself)
+
+        # -- Cleanup
+        p = None
+    elif p == None:
+        evt = action_event ()
+        evt.submap = myself.submap ()
+        evt.x = myself.posx ()
+        evt.y = myself.posy ()
+        evt.dir = myself.currentmove ()
+        evt.c = myself
+        event_handler_raise_event (evt)
+
+# -- bring up the main menu
+elif input_has_been_pushed (SDLK_ESCAPE):
+    import main_menu
+
+    # -- open main menu without animation, with saving and background enabled
+    menu = main_menu.main_menu (1, 1, 1)
+    menu.thisown = C
+    
+    # Stop updating the map
+    map_engine.set_should_update_map (0)
+
+    # -- this tells us when the main menu is closed
+    menu.py_signal_connect (on_menu_close, win_event_CLOSE, (myself))
+
+    # -- add stuff to the win_manager
+    win_manager_add (menu)
+    win_manager_set_focus (menu)
+    menu = None
+
+# -- move the player around
+elif input_is_pushed (SDLK_UP): myself.go_north ()
+elif input_is_pushed (SDLK_DOWN): myself.go_south ()
+elif input_is_pushed (SDLK_RIGHT): myself.go_east ()
+elif input_is_pushed (SDLK_LEFT): myself.go_west ()
+
+# Special tip! :)
+elif input_has_been_pushed (SDLK_n):
+    if myself.submap () < map_engine.get_landmap ().nbr_of_submaps () - 1:
+        myself.jump_to (myself.submap () + 1, 5, 3)
+    else:
+        myself.jump_to (0, 7, 18)
+
+elif input_has_been_pushed (SDLK_p):
+    if myself.submap () > 1:
+        myself.jump_to (myself.submap () - 1, 5, 3)
+    elif myself.submap () == 1:
+        myself.jump_to (0, 7, 18)        
+    else:
+        myself.jump_to (map_engine.get_landmap ().nbr_of_submaps () - 1, 5, 3)
+
+# -- shortcut to the load screen
+elif input_has_been_pushed (SDLK_l):
+    s = data_screen (LOAD_SCREEN)
+    s.thisown = C
+    s.py_signal_connect (on_data_screen_close, win_event_CLOSE)
+    # Stop updating the map
+    map_engine.set_should_update_map (0)
+    s.set_activate (1) 
+    win_manager_add (s)
+    win_manager_set_focus (s)
+
+
+# -- and to the save screen
+elif input_has_been_pushed (SDLK_s):
+    s = data_screen (SAVE_SCREEN)
+    s.thisown = C
+    s.py_signal_connect (on_data_screen_close, win_event_CLOSE)
+    # Stop updating the map
+    map_engine.set_should_update_map (0)
+    s.set_activate (1) 
+    win_manager_add (s)
+    win_manager_set_focus (s)
+
+
+# -- python console
+elif input_has_been_pushed (SDLK_TAB):
+    import console
+    c = console.console (globals ())
+    c.thisown = C
+    c.py_signal_connect (on_data_screen_close, win_event_CLOSE)
+    # Stop updating the map
+    map_engine.set_should_update_map (0)
+    c.set_activate (1)
+    win_manager_add (c)
+    win_manager_set_focus (c)
+    c = None
diff --git a/scripts/schedules/oliver.py b/scripts/schedules/oliver.py
index 65c6a68..351e55d 100755
--- a/scripts/schedules/oliver.py
+++ b/scripts/schedules/oliver.py
@@ -16,99 +16,96 @@
 #    When summoned by Orloth, he'll show the player to his room
 
 
-def init ():
-    speech = ["It's so exciting. An Elven Lady, here at Waste's Edge!", \
-              "I gotta hurry before mother complains again.", \
-              "Why can't I have a little dog!?"]
+speech = ["It's so exciting. An Elven Lady, here at Waste's Edge!", \
+          "I gotta hurry before mother complains again.", \
+          "Why can't I have a little dog!?"]
+
+# -- Oliver summoned to common room
+if myself.get_val ("goto_players_room") == 1:
+    # -- beam him directly there, as it is faster that way
+    if myself.submap () != 1:
+        myself.jump_to (1, 13, 7, STAND_NORTH)
 
     # -- the tiles around Orloth
     offsets = [(1,1),(1,-1),(-1,1),(-1,-1),(1,0),(0,1),(-1,0),(0,-1)]
 
-
-def run ():
-    # -- Oliver summoned to common room
-    if myself.get_val ("goto_players_room") == 1:
-        # -- beam him directly there, as it is faster that way
-        if myself.submap () != 1:
-            myself.jump_to (1, 13, 7, STAND_NORTH)
-
-        # -- find a free spot near Orloth and the player
-        i = 0
-        orloth = characters["Orloth Redwyne"]
-        while i < 7:
-            x, y = offsets[i][:2]
-            x = x + orloth.posx ()
-            y = y + orloth.posy ()
-            if myself.set_goal (x, y, NO_MOVE): break
-            i = i + 1
-
-        myself.set_val ("goto_players_room", 2)
-        myself.set_val ("todo", 2)
-
-    # -- in the player's room
-    elif myself.get_val ("goto_players_room") == 3:
-        # -- start talking to the player
-        myself.launch_action (the_player)
-
-    # -- leave the player's room and goto the barn
-    elif myself.get_val ("goto_barn") == 1:
-        location = myself.submap ()
-        myself.set_val ("goto_barn", 2)
-
-        # -- Player's room
-        if location == 12:
-            myself.set_goal (5, 1, NO_MOVE)
-
-        # -- First floor
-        elif location == 9:
-            myself.set_goal (8, 1, NO_MOVE)
-
-        # -- Second floor (this shouldn't happen, but it once did ...)
-        elif location == 14:
-            myself.set_goal (4, 1, NO_MOVE)
-
-        # -- Common Room
-        elif location == 1:
-            myself.set_goal (13, 8, NO_MOVE)
-
-        # -- Yard, our final goal (for now)
-        elif location == 0:
-            myself.set_goal (25, 15, NO_MOVE)
-            myself.set_val ("goto_barn", 0)
-
-        myself.set_val ("todo", 2)
-
-
-    # -- "normal" schedule
-    todo = myself.get_val ("todo")
-
-    # -- waiting
-    if todo == 0:
-        delay = myself.get_val ("delay")
-
-        # If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
-
-    # -- get movement target
-    elif todo == 1:
-        # -- on our way back from bjarn's room
-        if myself.get_val ("goto_barn") == 2:
-            myself.set_val ("goto_barn", 1)
-
-    # -- move
-    elif todo == 2:
-        if myself.follow_path () == 1:
-            myself.set_val ("todo", 0)
-
-
-    # -- do some random babbling
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
-
-    if tmp == 0:
-        myself.speak (speech[randint (0, 2)])
-        delay = randint (80, 160) * 10
-        myself.set_val ("say_something", delay)
+    # -- find a free spot near Orloth and the player
+    i = 0
+    orloth = characters["Orloth Redwyne"]
+    while i < 7:
+        x, y = offsets[i][:2]
+        x = x + orloth.posx ()
+        y = y + orloth.posy ()
+        if myself.set_goal (x, y, NO_MOVE): break
+        i = i + 1
+
+    myself.set_val ("goto_players_room", 2)
+    myself.set_val ("todo", 2)
+
+# -- in the player's room
+elif myself.get_val ("goto_players_room") == 3:
+    # -- start talking to the player
+    myself.launch_action (the_player)
+    
+# -- leave the player's room and goto the barn
+elif myself.get_val ("goto_barn") == 1:
+    location = myself.submap ()
+    myself.set_val ("goto_barn", 2)
+
+    # -- Player's room
+    if location == 12:
+        myself.set_goal (5, 1, NO_MOVE)
+
+    # -- First floor
+    elif location == 9:
+        myself.set_goal (8, 1, NO_MOVE)
+
+    # -- Second floor (this shouldn't happen, but it once did ...)
+    elif location == 14:
+        myself.set_goal (4, 1, NO_MOVE)
+
+    # -- Common Room
+    elif location == 1:
+        myself.set_goal (13, 8, NO_MOVE)
+
+    # -- Yard, our final goal (for now)
+    elif location == 0:
+        myself.set_goal (25, 15, NO_MOVE)
+        myself.set_val ("goto_barn", 0)
+
+    myself.set_val ("todo", 2)
+
+
+# -- "normal" schedule
+todo = myself.get_val ("todo")
+
+# -- waiting
+if todo == 0:
+    delay = myself.get_val ("delay")
+
+    # If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
+
+# -- get movement target
+elif todo == 1:
+    # -- on our way back from bjarn's room
+    if myself.get_val ("goto_barn") == 2:
+        myself.set_val ("goto_barn", 1)
+
+# -- move
+elif todo == 2:
+    if myself.follow_path () == 1:
+        myself.set_val ("todo", 0)
+
+
+# -- do some random babbling
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+
+if tmp == 0:
+    myself.speak (speech[randint (0, 2)])
+    delay = randint (80, 160) * 10
+    myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/orloth.py b/scripts/schedules/orloth.py
index 0d3da36..4499c49 100755
--- a/scripts/schedules/orloth.py
+++ b/scripts/schedules/orloth.py
@@ -15,98 +15,96 @@
 #    He'll walk up to a table occasionally and either set or clean it
 #    From time to time he'll complain about the grandfather clock
 
-def init ():
-    speech = ["I gotta clean this mug!", \
-              "That barrel is leaking.", \
-              "I hope they'll find the thief!"]
-
-    coords = [(10, 3, STAND_NORTH), \
-              (3, 5, STAND_SOUTH), \
-              (7, 6, STAND_EAST), \
-              (12, 3, STAND_SOUTH), \
-              (7, 4, STAND_WEST), \
-              (3, 7, 0), \
-              (9, 7, 0), \
-              (12, 5, 0), \
-              (6, 5, 0)]
-
-def run ():
-    todo = myself.get_val ("todo")
-
-    # -- waiting
-    if todo == 0:
-        delay = myself.get_val ("delay")
-
-        # -- If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
-
-            # -- put/take the first mug
-            if delay == 100:
-                index = myself.get_val ("table_num")
-                if index > 0:
-                    key = "table%i_set" % index
-                    val = myself.get_val (key)
-
-                    x, y = coords[index+4][:2]
-                    if val == 0:
-                        map_engine.get_landmap ().put_mapobject (1,x,y,106)
-                    else:
-                        map_engine.get_landmap ().remove_mapobject (1,x,y,106)
-
-            # -- put/take the second mug
-            elif delay == 50:
-                index = myself.get_val ("table_num")
-                if index > 0:
-                    key = "table%i_set" % index
-                    val = myself.get_val (key)
-                    myself.set_val (key, ~val)
-
-                    x, y = coords[index+4][:2]
-                    if val == 0:
-                        map_engine.get_landmap ().put_mapobject (1,x,y,107)
-                    else:
-                        map_engine.get_landmap ().remove_mapobject (1,x,y,107)
-
-    # -- engage a new movement
-    elif todo == 1:
-        # -- when we are at the bar, then wait a while before
-        #    moving again
-        if myself.posx () != 2:
-            delay = randint (40, 120) * 20
-            myself.set_val ("delay", delay)
-            myself.set_goal (2, 2, STAND_SOUTH)
-            myself.set_val ("table_num", 0)
-
-        # -- otherwise only wait a little
-        else:
-            index = randint (0, 4)
-            x, y, dir = coords[index]
-            myself.set_goal (x, y, dir)
-            myself.set_val ("delay", 150)
-            myself.set_val ("table_num", index)
-
-        myself.set_val ("todo", 2)
-
-    # -- moving
-    elif todo == 2:
-        if myself.follow_path () == 1:
-            # -- standing in front of the clock
-            if myself.posx () == 10:
-                myself.speak ("That clock is late again!")
-
-                tmp = myself.get_val ("say_something")
-                myself.set_val ("say_something", tmp + 75)
-
-            myself.set_val ("todo", 0)
-
-
-    # -- utter a random remark
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
-    if tmp == 0:
-        myself.speak (speech[randint (0, 2)])
-        delay = randint (50, 150) * 20
-        myself.set_val ("say_something", delay)
+speech = ["I gotta clean this mug!", \
+          "That barrel is leaking.", \
+          "I hope they'll find the thief!"]
+
+coords = [(10, 3, STAND_NORTH), \
+          (3, 5, STAND_SOUTH), \
+          (7, 6, STAND_EAST), \
+          (12, 3, STAND_SOUTH), \
+          (7, 4, STAND_WEST), \
+          (3, 7, 0), \
+          (9, 7, 0), \
+          (12, 5, 0), \
+          (6, 5, 0)]
+
+todo = myself.get_val ("todo")
+
+# -- waiting
+if todo == 0:
+    delay = myself.get_val ("delay")
+
+    # -- If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
+
+        # -- put/take the first mug
+        if delay == 100:
+            index = myself.get_val ("table_num")
+            if index > 0:
+                key = "table%i_set" % index
+                val = myself.get_val (key)
+
+                x, y = coords[index+4][:2]
+                if val == 0:
+                    map_engine.get_landmap ().put_mapobject (1,x,y,106)
+                else:
+                    map_engine.get_landmap ().remove_mapobject (1,x,y,106)
+
+        # -- put/take the second mug
+        elif delay == 50:
+            index = myself.get_val ("table_num")
+            if index > 0:
+                key = "table%i_set" % index
+                val = myself.get_val (key)
+                myself.set_val (key, ~val)
+
+                x, y = coords[index+4][:2]
+                if val == 0:
+                    map_engine.get_landmap ().put_mapobject (1,x,y,107)
+                else:
+                    map_engine.get_landmap ().remove_mapobject (1,x,y,107)
+
+# -- engage a new movement
+elif todo == 1:
+    # -- when we are at the bar, then wait a while before
+    #    moving again
+    if myself.posx () != 2:
+        delay = randint (40, 120) * 20
+        myself.set_val ("delay", delay)
+        myself.set_goal (2, 2, STAND_SOUTH)
+        myself.set_val ("table_num", 0)
+
+    # -- otherwise only wait a little
+    else:
+        index = randint (0, 4)
+        x, y, dir = coords[index]
+        myself.set_goal (x, y, dir)
+        myself.set_val ("delay", 150)
+        myself.set_val ("table_num", index)
+
+    myself.set_val ("todo", 2)
+
+# -- moving
+elif todo == 2:
+    if myself.follow_path () == 1:
+        # -- standing in front of the clock
+        if myself.posx () == 10:
+            myself.speak ("That clock is late again!")
+
+            tmp = myself.get_val ("say_something")
+            myself.set_val ("say_something", tmp + 75)
+
+        myself.set_val ("todo", 0)
+
+
+# -- utter a random remark
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+if tmp == 0:
+    myself.speak (speech[randint (0, 2)])
+    delay = randint (50, 150) * 20
+    myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/random_move.py b/scripts/schedules/random_move.py
index a308bf2..ddbd787 100755
--- a/scripts/schedules/random_move.py
+++ b/scripts/schedules/random_move.py
@@ -1,9 +1,8 @@
-def run ():
-    move=randint(10,30)
-    if move>=10:
-        dir=randint(0,3)
+move=randint(10,30)
+if move>=10:
+  dir=randint(0,3)
 
-        if dir==0: myself.go_north();
-        if dir==1: myself.go_south();
-        if dir==2: myself.go_west();
-        if dir==3: myself.go_east();
+  if dir==0: myself.go_north();
+  if dir==1: myself.go_south();
+  if dir==2: myself.go_west();
+  if dir==3: myself.go_east();
diff --git a/scripts/schedules/sarin.py b/scripts/schedules/sarin.py
index 70e4649..71cb176 100755
--- a/scripts/schedules/sarin.py
+++ b/scripts/schedules/sarin.py
@@ -16,94 +16,93 @@
 #    to time he'll stop and chose another direction
 
 
-def init ():
-    # -- Borders of the area he should stay in
-    min_x = 1
-    max_x = 6
-    min_y = 2
-    max_y = 6
-
-    speech = ["Ruffinans, the lot of them!", \
-              "How dare they imprison one better than they?", \
-              "This is an insult to all of the High Born.", \
-              "I cannot believe such disrespect. Barbarians!"]
-
-def run ():
-    # -- delay for orientation change
-    delay = myself.get_val ("delay")
-
-    # -- switch orientation
+# -- Borders of the area he should stay in
+min_x = 1
+max_x = 6
+min_y = 2
+max_y = 6
+
+speech = ["Ruffinans, the lot of them!", \
+          "How dare they imprison one better than they?", \
+          "This is an insult to all of the High Born.", \
+          "I cannot believe such disrespect. Barbarians!"]
+
+
+# -- delay for orientation change
+delay = myself.get_val ("delay")
+
+# -- switch orientation
+if delay == 0:
+    # -- get the current direction ...
+    dir = myself.get_val ("direction")
+
+    # -- ... and set the new one accordingly
+    if dir == WALK_EAST or dir == WALK_WEST:
+        dir = randint (WALK_NORTH, WALK_SOUTH)
+    else:
+        dir = randint (WALK_WEST, WALK_EAST)
+
+    # -- time until the next orientation change
+    delay = randint (100, 200) * 15
+    myself.set_val ("direction", dir)
+    myself.set_val ("delay", delay)
+    myself.set_val ("todo", 1)
+
+else:
+    myself.set_val ("delay", delay - 1)
+
+
+todo = myself.get_val ("todo")
+
+# -- waiting
+if todo == 0:
+    # -- delay for direction change
+    delay = myself.get_val ("switch_direction")
+
     if delay == 0:
-        # -- get the current direction ...
-        dir = myself.get_val ("direction")
-
-        # -- ... and set the new one accordingly
-        if dir == WALK_EAST or dir == WALK_WEST:
-            dir = randint (WALK_NORTH, WALK_SOUTH)
-        else:
-            dir = randint (WALK_WEST, WALK_EAST)
-
-        # -- time until the next orientation change
-        delay = randint (100, 200) * 15
-        myself.set_val ("direction", dir)
-        myself.set_val ("delay", delay)
         myself.set_val ("todo", 1)
-
     else:
-        myself.set_val ("delay", delay - 1)
-
-
-    todo = myself.get_val ("todo")
-
-    # -- waiting
-    if todo == 0:
-        # -- delay for direction change
-        delay = myself.get_val ("switch_direction")
-
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("switch_direction", delay - 1)
-
-    # -- get movement target
-    elif todo == 1:
-        # -- get the current direction ...
-        dir = myself.get_val ("direction")
-
-        # -- switch direction
-        if dir == WALK_NORTH:
-            goal = (myself.posx (), min_y, STAND_SOUTH, 0, 1)
-        elif dir == WALK_SOUTH:
-            goal = (myself.posx (), max_y, STAND_NORTH, 0, -1)
-        elif dir == WALK_EAST:
-            goal = (max_x, myself.posy(), STAND_WEST, -1, 0)
-        else:
-            goal = (min_x, myself.posy (), STAND_EAST, 1, 0)
-
-        x, y, d = goal[:3]
-        myself.set_val ("direction", d + 4)
-
-        while not myself.set_goal (x, y, d):
-            offx, offy = goal [-2:]
-            x = x + offx
-            y = y + offy
-
-        myself.set_val ("todo", 2)
-
-    # -- move
-    elif todo == 2:
-        if myself.follow_path () == 1:
-            # -- wait a little on the current tile
-            delay = randint (15, 30) * 10
-            myself.set_val ("switch_direction", delay)
-
-            myself.set_val ("todo", 0)
-
-
-    # -- utter a random remark
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
-    if tmp == 0:
-        myself.speak (speech[randint (0, 3)])
-        delay = randint (50, 150) * 15
-        myself.set_val ("say_something", delay)
+        myself.set_val ("switch_direction", delay - 1)
+
+# -- get movement target
+elif todo == 1:
+    # -- get the current direction ...
+    dir = myself.get_val ("direction")
+
+    # -- switch direction
+    if dir == WALK_NORTH:
+        goal = (myself.posx (), min_y, STAND_SOUTH, 0, 1)
+    elif dir == WALK_SOUTH:
+        goal = (myself.posx (), max_y, STAND_NORTH, 0, -1)
+    elif dir == WALK_EAST:
+        goal = (max_x, myself.posy(), STAND_WEST, -1, 0)
+    else:
+        goal = (min_x, myself.posy (), STAND_EAST, 1, 0)
+
+    x, y, d = goal[:3]
+    myself.set_val ("direction", d + 4)
+
+    while not myself.set_goal (x, y, d):
+        offx, offy = goal [-2:]
+        x = x + offx
+        y = y + offy
+
+    myself.set_val ("todo", 2)
+
+# -- move
+elif todo == 2:
+    if myself.follow_path () == 1:
+        # -- wait a little on the current tile
+        delay = randint (15, 30) * 10
+        myself.set_val ("switch_direction", delay)
+
+        myself.set_val ("todo", 0)
+
+
+# -- utter a random remark
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+if tmp == 0:
+    myself.speak (speech[randint (0, 3)])
+    delay = randint (50, 150) * 15
+    myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/silverhair.py b/scripts/schedules/silverhair.py
index ed43f89..4deebee 100755
--- a/scripts/schedules/silverhair.py
+++ b/scripts/schedules/silverhair.py
@@ -15,57 +15,55 @@
 #    She will mainly stand still, but occasionally walk up to the
 #    window and make a remark about the weather.
 
-def init ():
-    speech = ["In truth, Sarin, it is no bother. I am not offended.", \
-              "Janesta, dear, worry not. I am content here.", \
-              "Janesta, please bring my figurine. I wish to see it more 
closely.", \
-              "It truly is a lovely day. I expect we will have time yet to 
enjoy it."]
+speech = ["In truth, Sarin, it is no bother. I am not offended.", \
+          "Janesta, dear, worry not. I am content here.", \
+          "Janesta, please bring my figurine. I wish to see it more closely.", 
\
+          "It truly is a lovely day. I expect we will have time yet to enjoy 
it."]
 
-def run ():
-    todo = myself.get_val ("todo")
+todo = myself.get_val ("todo")
 
-    # -- waiting
-    if todo == 0:
-        delay = myself.get_val ("delay")
+# -- waiting
+if todo == 0:
+    delay = myself.get_val ("delay")
 
-        # If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
+    # If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
 
-    # -- get movement target
-    elif todo == 1:
-        # -- goto the window
-        if myself.posx () == 4:
-            # ... and speak about the weather
-            say = randint (33, 66) * 10
-            delay = randint (50, 75) * 15
-            myself.set_val ("say_something", say)
-            myself.set_goal (6, 4, STAND_EAST)
+# -- get movement target
+elif todo == 1:
+    # -- goto the window
+    if myself.posx () == 4:
+        # ... and speak about the weather
+        say = randint (33, 66) * 10
+        delay = randint (50, 75) * 15
+        myself.set_val ("say_something", say)
+        myself.set_goal (6, 4, STAND_EAST)
 
-        # -- go back to our normal position
-        else:
-            delay = randint (100, 200) * 35
-            myself.set_goal (4, 4, STAND_SOUTH)
+    # -- go back to our normal position
+    else:
+        delay = randint (100, 200) * 35
+        myself.set_goal (4, 4, STAND_SOUTH)
 
-        myself.set_val ("say_something", say)
-        myself.set_val ("delay", delay)
-        myself.set_val ("todo", 2)
+    myself.set_val ("say_something", say)
+    myself.set_val ("delay", delay)
+    myself.set_val ("todo", 2)
 
-    # -- move
-    elif todo == 2:
-        if myself.follow_path () == 1:
-            myself.set_val ("todo", 0)
+# -- move
+elif todo == 2:
+    if myself.follow_path () == 1:
+        myself.set_val ("todo", 0)
 
-    # -- speak
-    say = myself.get_val ("say_something")
-    myself.set_val ("say_something", say - 1)
-    if say == 0:
-        if myself.posx () == 6:
-            myself.speak (speech[3])
-        else:
-            myself.speak (speech[randint (0, 2)])
+# -- speak
+say = myself.get_val ("say_something")
+myself.set_val ("say_something", say - 1)
+if say == 0:
+    if myself.posx () == 6:
+        myself.speak (speech[3])
+    else:
+        myself.speak (speech[randint (0, 2)])
 
-        say = randint (60, 180) * 20
-        myself.set_val ("say_something", say)
+    say = randint (60, 180) * 20
+    myself.set_val ("say_something", say)
diff --git a/scripts/schedules/talan.py b/scripts/schedules/talan.py
index e7ce97e..3abed94 100755
--- a/scripts/schedules/talan.py
+++ b/scripts/schedules/talan.py
@@ -14,47 +14,45 @@
 #
 #    He guards the gate
 
-def init ():
-    speech = ["Halt! Who goes there?", \
-              "\"Ai! laurie lantar lassi surinen ...\"", \
-              "Nobody may pass through the gate!"]
-
-def run ():
-    todo = myself.get_val ("todo")
-
-    # If standing
-    if todo == 0:
-        delay = myself.get_val ("delay")
-        # If standing delay expired, move around next time
-        if delay == 0:
-            myself.set_val ("todo", 1)
-        else:
-            myself.set_val ("delay", delay - 1)
-
-    # Engage a new movement
-    elif todo == 1:
-        # Choose where to move, if destination is already occupied we'll
-        # fall into the wait state (0) again automatically next time
-        if myself.posy () == 17:
-            myself.set_goal (11, 19, STAND_NORTH)
-        else:
-            myself.set_goal (11, 17, STAND_SOUTH)
-
-        # Next time we'll actually move!
-        myself.set_val ("todo", 2)
-
-    # Moving, follow the path until it is reached.
-    elif todo == 2:
-        # Reached the goal? Wait a while then...
-        if myself.follow_path ():
-            myself.set_val ("delay", randint (25, 50) * 20)
-            myself.set_val ("todo", 0)
-
-
-    # -- utter a random remark
-    tmp = myself.get_val ("say_something")
-    myself.set_val ("say_something", tmp - 1)
-    if tmp <= 0:
-        myself.speak (speech[randint (0, 2)])
-        delay = randint (50, 150) * 20
-        myself.set_val ("say_something", delay)
+speech = ["Halt! Who goes there?", \
+          "\"Ai! laurie lantar lassi surinen ...\"", \
+          "Nobody may pass through the gate!"]
+
+todo = myself.get_val ("todo")
+
+# If standing
+if todo == 0:
+    delay = myself.get_val ("delay")
+    # If standing delay expired, move around next time
+    if delay == 0:
+        myself.set_val ("todo", 1)
+    else:
+        myself.set_val ("delay", delay - 1)
+
+# Engage a new movement
+elif todo == 1:
+    # Choose where to move, if destination is already occupied we'll
+    # fall into the wait state (0) again automatically next time
+    if myself.posy () == 17:
+        myself.set_goal (11, 19, STAND_NORTH)
+    else:
+        myself.set_goal (11, 17, STAND_SOUTH)
+        
+    # Next time we'll actually move!
+    myself.set_val ("todo", 2)
+
+# Moving, follow the path until it is reached.
+elif todo == 2:
+    # Reached the goal? Wait a while then...
+    if myself.follow_path ():
+        myself.set_val ("delay", randint (25, 50) * 20)
+        myself.set_val ("todo", 0)
+
+
+# -- utter a random remark
+tmp = myself.get_val ("say_something")
+myself.set_val ("say_something", tmp - 1)
+if tmp <= 0:
+    myself.speak (speech[randint (0, 2)])
+    delay = randint (50, 150) * 20
+    myself.set_val ("say_something", delay)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]