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 a681af9 028/237: Modularize


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 a681af9 028/237: Modularized event scripts
Date: Mon, 25 Jul 2016 18:14:54 +0000 (UTC)

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

    Modularized event scripts
    Started with character schedules
    Smaller sfx
---
 audio/select.wav                      |  Bin 220558 -> 44396 bytes
 audio/switch.wav                      |  Bin 171750 -> 37116 bytes
 scripts/events/1st_to_fellnir.py      |   27 +-----
 scripts/events/1st_to_frostbloom.py   |   28 +-----
 scripts/events/1st_to_player.py       |   27 +-----
 scripts/events/1st_to_silverhair.py   |   27 +-----
 scripts/events/2nd_to_illig.py        |   27 +-----
 scripts/events/2nd_to_oliver.py       |   27 +-----
 scripts/events/2nd_to_redwyne.py      |   27 +-----
 scripts/events/cellar_to_alek.py      |   27 +-----
 scripts/events/cellar_to_bath.py      |   27 +-----
 scripts/events/cellar_to_dwarfs.py    |   27 +-----
 scripts/events/cellar_to_storage.py   |   27 +-----
 scripts/events/common_to_kitchen.py   |   30 ++----
 scripts/events/common_to_parlor.py    |   30 ++----
 scripts/events/inn_to_yard.py         |   37 ++------
 scripts/events/kitchen_to_common.py   |    4 +
 scripts/events/kitchen_to_yard.py     |    4 +
 scripts/events/parlor_to_common.py    |    4 +
 scripts/events/yard_to_inn.py         |    5 +
 scripts/events/yard_to_kitchen.py     |   31 ++----
 scripts/modules/.cvsignore            |    1 +
 scripts/modules/Makefile.am           |    2 +-
 scripts/modules/console.py            |  138 +++++++++++++++++++++++++++
 scripts/modules/events.py             |   57 +++++++++++
 scripts/modules/main_menu.py          |  120 +++++++++++------------
 scripts/modules/schedules.py          |  167 +++++++++++++++++++++++++++++++++
 scripts/schedules/Makefile.am         |    2 +-
 scripts/schedules/keyboard_control.py |   22 +++--
 scripts/schedules/orloth.py           |   65 +++++++++++++
 30 files changed, 588 insertions(+), 429 deletions(-)

diff --git a/audio/select.wav b/audio/select.wav
index 760a7cf..ece8246 100755
Binary files a/audio/select.wav and b/audio/select.wav differ
diff --git a/audio/switch.wav b/audio/switch.wav
index cc274f4..b52ae79 100755
Binary files a/audio/switch.wav and b/audio/switch.wav differ
diff --git a/scripts/events/1st_to_fellnir.py b/scripts/events/1st_to_fellnir.py
index 10d36e7..c398533 100755
--- a/scripts/events/1st_to_fellnir.py
+++ b/scripts/events/1st_to_fellnir.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 9:
-  p.jump_to (10, 1, 3, STAND_EAST)
+  switch_submap (p, 10, 1, 3, STAND_EAST)
 else:
-  p.jump_to (9, 7, 3, STAND_WEST)
+  switch_submap (p, 9, 7, 3, STAND_WEST)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/1st_to_frostbloom.py 
b/scripts/events/1st_to_frostbloom.py
index 37a07fb..ff454e7 100755
--- a/scripts/events/1st_to_frostbloom.py
+++ b/scripts/events/1st_to_frostbloom.py
@@ -1,28 +1,10 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 9:
-  p.jump_to (11, 5, 3, STAND_WEST)
+  switch_submap (p, 11, 5, 3, STAND_WEST)
 else:
-  p.jump_to (9, 1, 3, STAND_EAST)
+  switch_submap (p, 9, 1, 3, STAND_EAST)
+
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/1st_to_player.py b/scripts/events/1st_to_player.py
index 6aa42d9..2ac5ccd 100755
--- a/scripts/events/1st_to_player.py
+++ b/scripts/events/1st_to_player.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 9:
-  p.jump_to (12, 5, 2, STAND_SOUTH)
+  switch_submap (p, 12, 5, 2, STAND_SOUTH)
 else:
-  p.jump_to (9, 6, 4, STAND_NORTH)
+  switch_submap (p, 9, 6, 4, STAND_NORTH)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/1st_to_silverhair.py 
b/scripts/events/1st_to_silverhair.py
index 41dbaf9..6b6e437 100755
--- a/scripts/events/1st_to_silverhair.py
+++ b/scripts/events/1st_to_silverhair.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 9:
-  p.jump_to (13, 7, 2, STAND_SOUTH)
+  switch_submap (p, 13, 7, 2, STAND_SOUTH)
 else:
-  p.jump_to (9, 1, 7, STAND_NORTH)
+  switch_submap (p, 9, 1, 7, STAND_NORTH)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/2nd_to_illig.py b/scripts/events/2nd_to_illig.py
index 0897c0e..35f448e 100755
--- a/scripts/events/2nd_to_illig.py
+++ b/scripts/events/2nd_to_illig.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 14:
-  p.jump_to (17, 6, 2, STAND_SOUTH)
+  switch_submap (p, 17, 6, 2, STAND_SOUTH)
 else:
-  p.jump_to (14, 1, 7, STAND_NORTH)
+  switch_submap (p, 14, 1, 7, STAND_NORTH)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/2nd_to_oliver.py b/scripts/events/2nd_to_oliver.py
index a22c4ff..2544644 100755
--- a/scripts/events/2nd_to_oliver.py
+++ b/scripts/events/2nd_to_oliver.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 14:
-  p.jump_to (16, 5, 5, STAND_WEST)
+  switch_submap (p, 16, 5, 5, STAND_WEST)
 else:
-  p.jump_to (14, 1, 5, STAND_EAST)
+  switch_submap (p, 14, 1, 5, STAND_EAST)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/2nd_to_redwyne.py b/scripts/events/2nd_to_redwyne.py
index ec09a56..7a80ef1 100755
--- a/scripts/events/2nd_to_redwyne.py
+++ b/scripts/events/2nd_to_redwyne.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 14:
-  p.jump_to (15, 1, 5, STAND_EAST)
+  switch_submap (p, 15, 1, 5, STAND_EAST)
 else:
-  p.jump_to (14, 2, 5, STAND_WEST)
+  switch_submap (p, 14, 2, 5, STAND_WEST)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/cellar_to_alek.py b/scripts/events/cellar_to_alek.py
index c7df0cf..2b2a050 100755
--- a/scripts/events/cellar_to_alek.py
+++ b/scripts/events/cellar_to_alek.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 4:
-  p.jump_to (6, 5, 6 + (p.posy () - 6), STAND_WEST)
+  switch_submap (p, 6, 5, 6 + (p.posy () - 6), STAND_WEST)
 else:
-  p.jump_to (4, 1, 6 + (p.posy () - 6), STAND_EAST)
+  switch_submap (p, 4, 1, 6 + (p.posy () - 6), STAND_EAST)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/cellar_to_bath.py b/scripts/events/cellar_to_bath.py
index 31007eb..5ddcb92 100755
--- a/scripts/events/cellar_to_bath.py
+++ b/scripts/events/cellar_to_bath.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 4:
-  p.jump_to (5, 3, 6, STAND_NORTH)
+  switch_submap (p, 5, 3, 6, STAND_NORTH)
 else:
-  p.jump_to (4, 2, 6, STAND_SOUTH)
+  switch_submap (p, 4, 2, 6, STAND_SOUTH)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/cellar_to_dwarfs.py 
b/scripts/events/cellar_to_dwarfs.py
index 5d32537..323a112 100755
--- a/scripts/events/cellar_to_dwarfs.py
+++ b/scripts/events/cellar_to_dwarfs.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 4:
-  p.jump_to (7, 1, 6 + (p.posy () - 6), STAND_EAST)
+  switch_submap (p, 7, 1, 6 + (p.posy () - 6), STAND_EAST)
 else:
-  p.jump_to (4, 9, 6 + (p.posy () - 6), STAND_WEST)
+  switch_submap (p, 4, 9, 6 + (p.posy () - 6), STAND_WEST)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/cellar_to_storage.py 
b/scripts/events/cellar_to_storage.py
index 4390a58..51e52fa 100755
--- a/scripts/events/cellar_to_storage.py
+++ b/scripts/events/cellar_to_storage.py
@@ -1,28 +1,9 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+p = characters [name]
 
 if p.submap () == 4:
-  p.jump_to (8, 6, 3 + (p.posy () - 9), STAND_WEST)
+  switch_submap (p, 8, 6, 3 + (p.posy () - 9), STAND_WEST)
 else:
-  p.jump_to (4, 1, 9 + (p.posy () - 3), STAND_EAST)
+  switch_submap (p, 4, 1, 9 + (p.posy () - 3), STAND_EAST)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/common_to_kitchen.py 
b/scripts/events/common_to_kitchen.py
index ca788bb..1dbf03a 100755
--- a/scripts/events/common_to_kitchen.py
+++ b/scripts/events/common_to_kitchen.py
@@ -1,28 +1,10 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+mychar = characters [name]
 
-if p.submap () == 1:
-  p.jump_to (3, 1, 2, STAND_SOUTH)
+# Common room to Kitchen
+if mychar.submap() == 1:
+    switch_submap (mychar, 3, 1, 2, STAND_SOUTH)
 else:
-  p.jump_to (1, 1, 7, STAND_NORTH)
+    switch_submap (mychar, 1, 1, 7, STAND_NORTH)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/common_to_parlor.py 
b/scripts/events/common_to_parlor.py
index 1a6b5c1..06d9825 100755
--- a/scripts/events/common_to_parlor.py
+++ b/scripts/events/common_to_parlor.py
@@ -1,28 +1,10 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+mychar = characters [name]
 
-if p.submap () == 1:
-  p.jump_to (2, 1, 4, STAND_EAST)
+# -- From Common Room to Parlour
+if mychar.submap () == 1:
+    switch_submap (mychar, 2, 1, 4, STAND_EAST)
 else:
-  p.jump_to (1, 13, 4, STAND_WEST)
+    switch_submap (mychar, 1, 13, 4, STAND_WEST)
 
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
diff --git a/scripts/events/inn_to_yard.py b/scripts/events/inn_to_yard.py
index 0049508..6e64387 100755
--- a/scripts/events/inn_to_yard.py
+++ b/scripts/events/inn_to_yard.py
@@ -1,32 +1,13 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-# Close the inn door.
-if p.submap () == 0:
-  map_engine.get_landmap ().get_mapobject (0).get_animation (0).next_frame ()
+mychar = characters [name]
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+# Close the inn door.
+if mychar.submap () == 0:
+    map_engine.get_landmap ().get_mapobject (0).get_animation (0).next_frame ()
 
-if p.submap () == 1:
-  p.jump_to (0, 18, 14, STAND_SOUTH)
+# -- From Common Room to Yard
+if mychar.submap () == 1:
+    switch_submap (mychar, 0, 18, 14, STAND_SOUTH)
 else:
-  p.jump_to (1, 13, 7, STAND_NORTH)
-
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
+    switch_submap (mychar, 1, 13, 7, STAND_NORTH)
diff --git a/scripts/events/kitchen_to_common.py 
b/scripts/events/kitchen_to_common.py
new file mode 100755
index 0000000..4d6d74d
--- /dev/null
+++ b/scripts/events/kitchen_to_common.py
@@ -0,0 +1,4 @@
+from events import switch_submap
+
+# -- Kitchen to Common Room
+switch_submap (characters [name], 1, 1, 7, STAND_NORTH)
diff --git a/scripts/events/kitchen_to_yard.py 
b/scripts/events/kitchen_to_yard.py
new file mode 100755
index 0000000..0e89523
--- /dev/null
+++ b/scripts/events/kitchen_to_yard.py
@@ -0,0 +1,4 @@
+from events import switch_submap
+
+# -- From Kitchen to Yard
+switch_submap (characters [name], 0, 12, 14, STAND_EAST)
diff --git a/scripts/events/parlor_to_common.py 
b/scripts/events/parlor_to_common.py
new file mode 100755
index 0000000..1398710
--- /dev/null
+++ b/scripts/events/parlor_to_common.py
@@ -0,0 +1,4 @@
+from events import switch_submap
+
+# -- From Parlour to Common Room
+switch_submap (characters [name], 1, 13, 4, STAND_WEST)
diff --git a/scripts/events/yard_to_inn.py b/scripts/events/yard_to_inn.py
new file mode 100755
index 0000000..bcfe126
--- /dev/null
+++ b/scripts/events/yard_to_inn.py
@@ -0,0 +1,5 @@
+from events import switch_submap
+
+# -- From Yard to Common Room
+map_engine.get_landmap ().get_mapobject (0).get_animation (0).next_frame ()
+switch_submap (characters [name], 1, 13, 7, STAND_NORTH)
diff --git a/scripts/events/yard_to_kitchen.py 
b/scripts/events/yard_to_kitchen.py
index c51599c..cd9069e 100755
--- a/scripts/events/yard_to_kitchen.py
+++ b/scripts/events/yard_to_kitchen.py
@@ -1,29 +1,10 @@
-p = characters [name]
-p.set_schedule_active (0)
-p.stand ()
+from events import switch_submap
 
-if p == the_player:
-  i = 0
-  while i < 60:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i + (gametime_frames_to_do () * 2)
+mychar = characters [name]
 
-if p.submap () == 0:
-  p.jump_to (3, 6, 3, STAND_WEST)
+# -- From Yard to Kitchen
+if mychar.submap () == 0:
+    switch_submap (mychar, 3, 6, 3, STAND_WEST)
 else:
-  p.jump_to (0, 12, 14, STAND_EAST)
-
-if p == the_player:
-  i=60
-  while i > 0:
-    map_engine.mainloop ()
-    screen_transition (i * 2)
-    screen_show ()
-    gametime_update ()
-    i = i - (gametime_frames_to_do () * 2)
-    
-p.set_schedule_active (1)
+    switch_submap (mychar, 0, 12, 14, STAND_EAST)
 
diff --git a/scripts/modules/.cvsignore b/scripts/modules/.cvsignore
index 3dda729..551aedb 100755
--- a/scripts/modules/.cvsignore
+++ b/scripts/modules/.cvsignore
@@ -1,2 +1,3 @@
 Makefile.in
 Makefile
+*.pyc
diff --git a/scripts/modules/Makefile.am b/scripts/modules/Makefile.am
index fa45db8..7579961 100755
--- a/scripts/modules/Makefile.am
+++ b/scripts/modules/Makefile.am
@@ -1,5 +1,5 @@
 pkgdatadir = $(gamedatadir)/scripts/modules
 
-pkgdata_DATA = main_menu.py ins_modules.py
+pkgdata_DATA = console.py main_menu.py ins_modules.py schedules.py events.py
 
 EXTRA_DIST = $(pkgdata_DATA)
diff --git a/scripts/modules/console.py b/scripts/modules/console.py
new file mode 100755
index 0000000..01ec9b5
--- /dev/null
+++ b/scripts/modules/console.py
@@ -0,0 +1,138 @@
+import sys
+from adonthell import *
+
+# -- A simple python console with command history
+class console (win_container):
+
+    # -- Constructor
+    def __init__(self, ns):    
+        win_container.__init__(self)
+
+        self.namespace = ns
+        self.history = []
+        self.hist_idx = 0
+        self.thisown = 0
+        self.quit = 1
+
+        # read the old history
+        self.read_history ()
+
+        self.py_signal_connect (self.on_destroy, win_event_DESTROY)
+        self.py_signal_connect (self.on_update, win_event_UPDATE)
+        
+        # -- load font and theme
+        self.font = win_font (WIN_THEME_ORIGINAL)
+        self.theme = win_theme (WIN_THEME_ORIGINAL)
+        
+        self.move (10, 150)    
+        self.resize (300, 80)
+        self.set_border (self.theme)
+        self.set_background (self.theme)
+        self.set_trans_background (1)
+        
+        self.entry = win_write ()
+        self.entry.thisown = 0
+        self.entry.py_signal_connect (self.on_execute, win_event_ACTIVATE_KEY)
+        self.entry.move (5, 5)
+        self.entry.resize (290, 70)
+        # -- causes a crash:
+        # self.entry.set_form (label_AUTO_HEIGHT)
+        self.entry.set_font (self.font)
+        self.entry.set_cursor (1)
+        self.entry.set_cursor_moveable (1)
+        self.entry.set_text ("")
+        self.entry.pack ()
+        
+        self.add (self.entry)
+        self.set_focus_object (self.entry)
+        
+        self.set_visible_background (1);
+        self.set_visible_border (1);
+        self.set_visible_all (1);
+        self.set_activate (1)
+
+        self.entry.set_focus (1)
+        self.entry.set_activate (1)
+
+    # -- cleanup --
+    def __del__(self):
+        self.write_history ()
+
+        del self.font
+        del self.theme
+
+    # -- callback for command execution
+    def on_execute (self):
+        text = self.entry.text_char ()
+        # print "Execute", text
+ 
+        # -- if we have a command ...
+        if text != None:
+            
+            # -- ... add it to command history ...
+            if self.hist_idx == 0 or text != self.history[-1]:
+                self.history.append (text + '\n')
+                self.hist_idx = len (self.history)
+    
+            # -- ... and try to execute it
+            try:
+                result = eval (text, self.namespace)
+                self.entry.set_text (str (result))
+            except:
+                type, value = sys.exc_info()[:2]
+                error = "Error:\n  " + str (type) + ":\n  \"" + str (value) + 
"\""
+                self.entry.set_text (error)
+
+    # -- callback to close the window
+    def on_destroy (self):
+        return self.quit
+
+    # -- catch relevant keypresses 
+    def on_update (self):
+        
+        # -- quit
+        if input_has_been_pushed (SDLK_ESCAPE):
+            # print "Quitting ..."
+            self.quit = 0
+
+        # -- clear screen
+        elif input_has_been_pushed (SDLK_DELETE):
+            # print "Deleting ..."
+            self.entry.set_text ("")
+        
+        # -- previous command
+        elif input_has_been_pushed (SDLK_UP):
+            # print "Up ..."
+            if self.hist_idx > 0:
+                self.hist_idx = self.hist_idx - 1
+                self.entry.set_text (self.history[ self.hist_idx ][:-1])
+        
+        # -- next command
+        elif input_has_been_pushed (SDLK_DOWN):
+            # print "Down ..."
+            if self.hist_idx < len (self.history) - 1:
+                self.hist_idx = self.hist_idx + 1
+                self.entry.set_text (self.history[ self.hist_idx ][:-1])
+
+    # -- Read the old history from ~/.adonthell/history
+    def read_history (self):
+        dir = gamedata_user_data_dir ()
+        dir = dir + "/history"
+
+        # -- try to open the file
+        file = open (dir, 'r')
+        if file != None:
+            self.history = file.readlines ()
+            self.hist_idx = len (self.history)
+            file.close ()
+
+    # -- Write the last 50 commands to ~/.adonthell/history
+    def write_history (self):
+        dir = gamedata_user_data_dir ()
+        dir = dir + "/history"
+
+        # -- try to open the file
+        file = open (dir, 'w')
+        if file != None:
+            file.writelines (self.history[-50:])
+            file.close ()
diff --git a/scripts/modules/events.py b/scripts/modules/events.py
new file mode 100755
index 0000000..9308b22
--- /dev/null
+++ b/scripts/modules/events.py
@@ -0,0 +1,57 @@
+#
+#  (C) Copyright 2001 Alexandre Courbot
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
+from adonthell import gamedata_player, gamedata_map_engine, mapcharacter
+from adonthell import screen_transition, screen_show, gametime_update
+from adonthell import gametime_frames_to_do, mapengine
+
+# -- Fade the screen out
+def fade_out ():
+    i = 0
+
+    while i < 60:
+        gamedata_map_engine ().mainloop ()
+
+        screen_transition (i * 2)
+        screen_show ()
+
+        gametime_update ()
+        i = i + (gametime_frames_to_do () * 2)
+
+# -- Fade the screen in
+def fade_in ():
+    i = 60
+
+    while i > 0:
+        gamedata_map_engine ().mainloop ()
+
+        screen_transition(i * 2)
+        screen_show ()
+
+        gametime_update ()
+        i = i - (gametime_frames_to_do () * 2)
+
+# -- switch submaps (character, new coordinates, new submap,
+#    direction the character shall face)
+def switch_submap (mychar, x, y, submap, dir):
+    mychar.set_schedule_active (0)
+    mychar.stand ()
+
+    # -- comparing mychar and player directly does not work (???)
+    if mychar.get_name () == gamedata_player ().get_name ():
+        fade_out ()
+        mychar.jump_to (x, y, submap, dir)
+        fade_in ()
+    else:
+        mychar.jump_to (x, y, submap, dir)
+
+    mychar.set_schedule_active (1)
diff --git a/scripts/modules/main_menu.py b/scripts/modules/main_menu.py
index ea05867..0402f8e 100755
--- a/scripts/modules/main_menu.py
+++ b/scripts/modules/main_menu.py
@@ -8,25 +8,25 @@ class main_menu (win_container):
     #   enable_s defines whether we have a "save" option (1) or not (0)
     #   enable_b turns background/border on (1) or off (0)
     def __init__ (self, startup, enable_s, enable_b = 0):      
-       win_container.__init__(self)
+        win_container.__init__(self)
 
         self.startup = startup
 
-       # Init Position 
-       self.move (0,0) 
-       self.resize(320,240)
+        # Init Position
+        self.move (0,0)        
+        self.resize(320,240)
         
-       self.thisown = 0
+        self.thisown = 0
 
-       # load font and theme
+        # load font and theme
         self.font = win_font (WIN_THEME_ORIGINAL)
-       self.theme = win_theme (WIN_THEME_ORIGINAL)
+        self.theme = win_theme (WIN_THEME_ORIGINAL)
 
-       self.enable_save = enable_s
+        self.enable_save = enable_s
         
-       self.lg = None
+        self.lg = None
         
-       self.quit = 1
+        self.quit = 1
 
         y_pos = 30
         if enable_s: y_pos = 15
@@ -35,69 +35,66 @@ class main_menu (win_container):
         self.py_signal_connect (self.on_update, win_event_UPDATE)
         
         self.a_title = win_image()
-       self.a_title.load_pnm ("gfx/cutscene/adonthell_green.pnm")
+        self.a_title.load_pnm ("gfx/cutscene/adonthell_green.pnm")
         self.a_title.set_mask (1)
-       self.a_title.move ((self.length() - self.a_title.length())/2, y_pos)
+        self.a_title.move ((self.length() - self.a_title.length())/2, y_pos)
         self.a_title.thisown = 0
         self.a_title.pack()
-       y_pos = y_pos + 30
+        y_pos = y_pos + 30
 
-       self.title = win_label()
-       self.title.set_font(self.font)
-       self.title.set_form (label_AUTO_SIZE)
+        self.title = win_label()
+        self.title.set_font(self.font)
+        self.title.set_form (label_AUTO_SIZE)
         self.title.set_text ("-- Waste's Edge --")
         self.title.move ((self.length()-self.title.length())/2, y_pos)
         self.title.thisown = 0
-       self.title.pack()
+        self.title.pack()
         y_pos = y_pos + 40
 
-               
-       self.new_game = win_label()
-       self.new_game.set_font(self.font)
+        self.new_game = win_label()
+        self.new_game.set_font(self.font)
                self.new_game.set_form (label_AUTO_SIZE)
         if enable_s == 0: self.new_game.set_text ("New Game")
         else: self.new_game.set_text ("Continue")
         self.new_game.move (-self.new_game.length (), y_pos)
         self.new_game.pack()
-       self.new_game.thisown = 0
+        self.new_game.thisown = 0
         y_pos = y_pos + 30
 
         self.load_game = win_label ()
-       self.load_game.set_font(self.font)
-       self.load_game.set_form (label_AUTO_SIZE)
+        self.load_game.set_font(self.font)
+        self.load_game.set_form (label_AUTO_SIZE)
         self.load_game.set_text ("Load Game")
         self.load_game.move (self.length (), y_pos)
         self.load_game.pack()
-       self.load_game.thisown = 0
+        self.load_game.thisown = 0
         y_pos = y_pos + 30
        
-       self.save_game = win_label ()
-       self.save_game.set_font(self.font)
-       self.save_game.set_form (label_AUTO_SIZE)
+        self.save_game = win_label ()
+        self.save_game.set_font(self.font)
+        self.save_game.set_form (label_AUTO_SIZE)
         self.save_game.set_text ("Save Game")
         self.save_game.move (-self.save_game.length (), y_pos)  
                self.save_game.pack()
-       self.save_game.thisown = 0
+        self.save_game.thisown = 0
         if enable_s: y_pos = y_pos + 30
-
        
-       self.options = win_label ()
-       self.options.set_font (self.font)
-       self.options.set_form (label_AUTO_SIZE)
-       self.options.set_text ("Options")
+        self.options = win_label ()
+        self.options.set_font (self.font)
+        self.options.set_form (label_AUTO_SIZE)
+        self.options.set_text ("Options")
         self.options.move (-self.options.length (), y_pos)
         self.options.pack()
-       self.options.thisown = 0
+        self.options.thisown = 0
         y_pos = y_pos + 30
-    
        
         self.labquit = win_label ()
-       self.labquit.set_font(self.font)
-       self.labquit.set_form (label_AUTO_SIZE)
-       self.labquit.set_text ("Quit")
+        self.labquit.set_font(self.font)
+        self.labquit.set_form (label_AUTO_SIZE)
+        self.labquit.set_text ("Quit")
         self.labquit.move (self.length (), y_pos)
         self.labquit.pack()
-       self.labquit.thisown = 0
+        self.labquit.thisown = 0
         y_pos = y_pos + 30
 
         self.labels = [self.new_game, self.load_game, self.options, 
self.labquit]
@@ -110,14 +107,12 @@ class main_menu (win_container):
             self.add (label)    
 
                
-       # activate self object  
-               
-       self.set_activate (1)
+        # activate self object
+        self.set_activate (1)
         self.set_visible_all (1)       
 
         if startup == 0:
-           
-           done = 1
+            done = 1
             sign = 1
             goals = ()
             moves = ()
@@ -142,28 +137,26 @@ class main_menu (win_container):
             for label in self.labels:
                 label.move ((self.length()-label.length())/2, label.y ())
             
-        # self.select = win_select (70, 10, 180, 220, self.theme)
-        
-       self.select = win_select()
-       self.select.move(70,10)
-       self.select.resize(180, 220)
+        self.select = win_select()
+        self.select.move(70,10)
+        self.select.resize(180, 220)
        
-       self.select.set_mode ( win_select_MODE_BRIGHTNESS )
-       self.select.py_signal_connect (self.on_select, win_event_ACTIVATE_KEY);
+        self.select.set_mode ( win_select_MODE_BRIGHTNESS )
+        self.select.py_signal_connect (self.on_select, win_event_ACTIVATE_KEY);
         
-       self.select.set_background(self.theme)
-       self.select.set_visible_background (enable_b)
-       self.select.set_trans_background (1)
+        self.select.set_background(self.theme)
+        self.select.set_visible_background (enable_b)
+        self.select.set_trans_background (1)
         
-       self.select.set_border(self.theme, win_border_MINI)
+        self.select.set_border(self.theme, win_border_MINI)
         self.select.set_visible_border (enable_b)
         
-       self.select.set_circle (1)
+        self.select.set_circle (1)
         self.select.set_visible_all (1)
         self.select.thisown = 0
         
-       self.select.set_activate (1)
-       self.set_focus_object ( self.select )
+        self.select.set_activate (1)
+        self.set_focus_object ( self.select )
         
         self.add (self.select)
 
@@ -187,7 +180,6 @@ class main_menu (win_container):
     def on_destroy (self):
         return self.quit
 
-
     # -- pressing ESC will close the menu if it's open
     def on_update (self):
         if self.lg == None:
@@ -208,14 +200,13 @@ class main_menu (win_container):
        
         # New Game
         if sel == 1:
-            # data_load (0)
             self.quit = 0
 
         # Load Game
         elif sel == 2:
             self.lg = data_screen (LOAD_SCREEN)
             self.lg.thisown = 0
-           self.lg.set_activate (1)    
+            self.lg.set_activate (1)   
             if self.startup != 0:
                 self.quit = 0
             else:
@@ -228,7 +219,7 @@ class main_menu (win_container):
             self.quit = 0
             self.lg = data_screen (SAVE_SCREEN)
             self.lg.thisown = 0
-           self.lg.set_activate(1)
+            self.lg.set_activate(1)
             win_manager_add (self.lg)
             win_manager_set_focus (self.lg)
 
@@ -260,5 +251,6 @@ class main_menu (win_container):
                 if goal == label.x () + j*mod:
                     done = done - 1
                     break
-            label.move (label.x () + j*mod, label.y ())   
-       return done
+            label.move (label.x () + j*mod, label.y ())
+
+        return done
diff --git a/scripts/modules/schedules.py b/scripts/modules/schedules.py
new file mode 100755
index 0000000..6fcd920
--- /dev/null
+++ b/scripts/modules/schedules.py
@@ -0,0 +1,167 @@
+#
+#  $Id$
+#
+#  (C) Copyright 2001 Kai Sterker <address@hidden>
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
+# Helper functions for usage in schedules
+from adonthell import *
+import random
+
+# -- A function that doesn't deserve the term 'pathfinding'
+def simple_goto_xy (mychar, goal_x, goal_y):
+
+    dist_x = mychar.posx () - goal_x
+    dist_y = mychar.posy () - goal_y
+
+    # -- reached the goal?
+    if dist_x == 0 and dist_y == 0:
+        # -- wait until we are truly there!
+        if mychar.offx () == 0 and mychar.offy () == 0:
+            return 1
+        else:
+            return 0
+
+    dst = float (abs(dist_x)) / (abs (dist_x) + abs (dist_y))
+    rnd = random.random ()
+
+    # -- preferrably walk into the direction that is closest
+    #    to the goal. But we allow a little variation.
+    if rnd > dst:
+        go_north_south (mychar, dist_x, dist_y, 1)
+    else:
+        go_east_west (mychar, dist_x, dist_y, 1)
+
+    return 0
+
+
+# -- try to walk in the direction that leads to the goal
+def go_north_south (mychar, dist_x, dist_y, count):
+
+    # -- All four directions blocked -> wait a turn
+    if count >= 4: return
+
+    # -- try to approach goal in y direction first,
+    #    if blocked, try x direction, and if that's not
+    #    possible then walk back
+    if dist_y <= 0 and mychar.can_go_south ():
+        mychar.go_south ()
+    elif dist_y >= 0 and mychar.can_go_north ():
+        mychar.go_north ()
+    else:
+        dist_y = -dist_y
+        go_east_west (mychar, dist_x, dist_y, count+1)
+
+# -- try to walk in the direction that leads to the goal
+def go_east_west (mychar, dist_x, dist_y, count):
+
+    # -- All four directions blocked -> wait a turn
+    if count >= 4: return
+
+    # -- try to approach goal in x direction first,
+    #    if blocked, try y direction, and if that's not
+    #    possible then walk back
+    if dist_x >= 0 and mychar.can_go_west ():
+        mychar.go_west ()
+    elif dist_x <= 0 and mychar.can_go_east ():
+        mychar.go_east ()
+    else:
+        dist_x = -dist_x
+        go_north_south (mychar, dist_x, dist_y, count+1)
+
+
+# -- display a "bubble" with some text above a character
+def speak (mychar, text):
+    # -- but only if he's on the player's submap
+    if mychar.submap () == gamedata_player ().submap ():
+        b = bubble (mychar, text)
+        b.thisown = 0
+
+        # -- add the bubble to the win_manager, but don't give it the focus
+        win_manager_add (b)
+
+
+# -- the "bubble"-window
+class bubble (win_container):
+    def __init__ (self, mychar, text):
+        win_container.__init__(self)
+
+        self.remain = len (text) * 10
+
+        self.py_signal_connect (self.on_destroy, win_event_DESTROY)
+        self.py_signal_connect (self.on_update, win_event_UPDATE, mychar)
+
+        self.font = win_font (WIN_THEME_ORIGINAL)
+        self.theme = win_theme (WIN_THEME_ORIGINAL)
+
+        # -- if the submap is smaller than the mapview, we have to
+        #    calculate the offset
+        view = gamedata_map_engine ().get_mapview ()
+        area = gamedata_map_engine ().get_landmap ().get_submap (mychar.submap 
())
+        if area.area_length () * MAPSQUARE_SIZE < view.length ():
+            self.offx = (view.length () - area.area_length () * 
MAPSQUARE_SIZE) / 2
+        else:
+            self.offx = 0
+        if area.area_height () * MAPSQUARE_SIZE < view.height ():
+            self.offy = (view.height () - area.area_height () * 
MAPSQUARE_SIZE) / 2
+        else:
+            self.offy = 0
+
+        # -- get the postion above the character's head
+        x, y = self.get_window_pos (mychar)
+
+        self.resize (100, 30)
+        self.move (x, y)       
+
+        self.bubble = win_label ()
+        self.bubble.set_font (self.font)
+        self.bubble.resize (90, 0)
+        self.bubble.set_form (label_AUTO_HEIGHT)
+        self.bubble.set_text (text)
+
+        x = (self.length () - self.bubble.length ()) / 2
+        y = self.height () - self.bubble.height () - 3
+
+        self.bubble.move (x, y)
+        self.bubble.thisown = 0
+        self.bubble.pack()
+
+        self.bubble.set_background (self.theme)
+        self.bubble.set_visible_background (1)
+        self.bubble.set_trans_background (1)
+
+        self.bubble.set_border(self.theme, win_border_MINI)
+        self.bubble.set_visible_border (1)
+
+        self.add (self.bubble)
+        self.set_visible_all (1)
+
+    def __del__ (self):
+        del self.theme
+        del self.font
+
+    def on_destroy (self):
+        return self.remain
+
+    def on_update (self, mychar):
+        x, y = self.get_window_pos (mychar)
+        self.move (x, y)
+        self.remain = self.remain - 1
+
+    # -- center the window above the characters head
+    def get_window_pos (self, mychar):
+        view = gamedata_map_engine ().get_mapview ()
+        x = (mychar.posx () - view.posx () - mychar.base_x ()) * MAPSQUARE_SIZE
+        x = x + mychar.offx () - view.offx () - 45 + self.offx
+        y = (mychar.posy () - view.posy () - mychar.base_y ()) * MAPSQUARE_SIZE
+        y = y + mychar.offy () - view.offy () - 25 + self.offy
+
+        return (x, y)
\ No newline at end of file
diff --git a/scripts/schedules/Makefile.am b/scripts/schedules/Makefile.am
index 68bae73..1eee574 100755
--- a/scripts/schedules/Makefile.am
+++ b/scripts/schedules/Makefile.am
@@ -1,5 +1,5 @@
 pkgdatadir = $(gamedatadir)/scripts/schedules
 
-pkgdata_DATA = action_talk.py center_player.py keyboard_control.py
+pkgdata_DATA = action_talk.py center_player.py keyboard_control.py orloth.py
 
 EXTRA_DIST = $(pkgdata_DATA)
diff --git a/scripts/schedules/keyboard_control.py 
b/scripts/schedules/keyboard_control.py
index 8b67adf..a53ca9d 100755
--- a/scripts/schedules/keyboard_control.py
+++ b/scripts/schedules/keyboard_control.py
@@ -1,4 +1,5 @@
 from main_menu import *
+from console import *
 
 # -- When the menu is closing, react accordingly
 def on_menu_close (retval, player):
@@ -67,7 +68,6 @@ if input_has_been_pushed (SDLK_SPACE):
         # -- Cleanup
         p = None
 
-
 # -- bring up the main menu
 elif input_has_been_pushed (SDLK_ESCAPE):
     # -- deactivate the player's schedule, so he can't move while the menu is 
open
@@ -109,23 +109,27 @@ elif input_has_been_pushed (SDLK_KP_MINUS):
 
 # -- shortcut to the load screen
 elif input_has_been_pushed (SDLK_l):
-    # myself.set_schedule_active (0)
     s = data_screen (LOAD_SCREEN)
-    s.thisown = 0
+    s.thisown = C
     s.set_activate (1) 
-#    s.py_signal_connect (on_data_screen_close, win_event_CLOSE, (None))
-    
     win_manager_add (s)
     win_manager_set_focus (s)
 
 
 # -- and to the save screen
 elif input_has_been_pushed (SDLK_s):
-    # myself.set_schedule_active (0)
-
     s = data_screen (SAVE_SCREEN)
-    s.thisown = 0
+    s.thisown = C
     s.set_activate (1) 
-#    s.py_signal_connect (on_menu_close, win_event_CLOSE, (myself))
     win_manager_add (s)
     win_manager_set_focus (s)
+
+
+# -- python console
+elif input_has_been_pushed (SDLK_TAB):
+    c = console (globals ())
+    c.thisown = C
+    c.set_activate (1)
+    win_manager_add (c)
+    win_manager_set_focus (c)
+    c = None
diff --git a/scripts/schedules/orloth.py b/scripts/schedules/orloth.py
new file mode 100755
index 0000000..021b285
--- /dev/null
+++ b/scripts/schedules/orloth.py
@@ -0,0 +1,65 @@
+#
+#  (C) Copyright 2001 Kai Sterker <address@hidden>
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
+# -- Movement schedule for Orloth Redwyne
+import schedules
+import random
+
+speech = ["I gotta clean this mug!", "That barrel is leaking.", "I hope 
they'll find the thief!"]
+coords = [(3, 5, STAND_SOUTH), (7, 6, STAND_EAST), (12, 3, STAND_SOUTH), (7, 
4, STAND_WEST), (10, 3, STAND_NORTH)]
+
+todo = character_base.get (myself, "wait_behind_bar")
+
+# -- leave the barcharacter_base.get (myself, "wait_behind_bar") == 0
+if todo == 0:
+    # -- get the position we want to reach
+    goal = character_base.get (myself, "goal")
+    x, y, dir = coords[goal]
+
+    if schedules.simple_goto_xy (myself, x, y) == 1:
+        # -- wait a little
+        character_base.set (myself, "wait_behind_bar", -150)
+
+        if dir == STAND_NORTH: myself.stand_north ()
+        elif dir == STAND_EAST: myself.stand_east ()
+        elif dir == STAND_SOUTH: myself.stand_south ()
+        else: myself.stand_west ()
+
+        # -- standing in front of the clock
+        if goal == 4:
+            schedules.speak (myself, "That clock is late again!")
+
+
+# -- stand still
+elif todo < 0:
+    character_base.set (myself, "wait_behind_bar", todo + 1)
+    if todo == -1:
+        # -- calculate the next move
+        delay = random.randint (40, 120) * 20
+        character_base.set (myself, "wait_behind_bar", delay)
+        character_base.set (myself, "goal", random.randint (0, 4))
+
+# -- go to/stay behind bar
+else:
+    character_base.set (myself, "wait_behind_bar", todo - 1)
+
+    # -- reached the bar
+    if schedules.simple_goto_xy (myself, 2, 2) == 1:
+        myself.stand_south ()
+
+    # -- utter a random remark
+    tmp = character_base.get (myself, "say_something")
+    character_base.set (myself, "say_something", tmp - 1)
+    if tmp == 0:
+        schedules.speak (myself, speech[random.randint (0, 2)])
+        delay = random.randint (50, 150) * 20
+        character_base.set (myself, "say_something", delay)
\ No newline at end of file



reply via email to

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