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 4330c0d 053/237: Removed in


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 4330c0d 053/237: Removed in-game imports, which are now done at init time.
Date: Mon, 25 Jul 2016 18:14:56 +0000 (UTC)

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

    Removed in-game imports, which are now done at init time.
---
 scripts/events/1st_to_2nd.py          |    6 ++----
 scripts/events/1st_to_fellnir.py      |    6 ++----
 scripts/events/1st_to_frostbloom.py   |    6 ++----
 scripts/events/1st_to_player.py       |    6 ++----
 scripts/events/1st_to_silverhair.py   |    6 ++----
 scripts/events/2nd_to_illig.py        |    6 ++----
 scripts/events/2nd_to_oliver.py       |    6 ++----
 scripts/events/2nd_to_redwyne.py      |    6 ++----
 scripts/events/barn_to_cellar.py      |    6 ++----
 scripts/events/cellar_to_alek.py      |    6 ++----
 scripts/events/cellar_to_bath.py      |    6 ++----
 scripts/events/cellar_to_dwarfs.py    |    6 ++----
 scripts/events/cellar_to_storage.py   |    6 ++----
 scripts/events/common_to_1st.py       |    6 ++----
 scripts/events/common_to_cellar.py    |    6 ++----
 scripts/events/common_to_kitchen.py   |    6 ++----
 scripts/events/common_to_parlor.py    |    6 ++----
 scripts/events/inn_to_yard.py         |    6 ++----
 scripts/events/kitchen_to_cellar.py   |    6 ++----
 scripts/events/yard_to_kitchen.py     |    6 ++----
 scripts/modules/console.py            |    3 +--
 scripts/modules/ins_modules.py        |   12 ++++++++++--
 scripts/schedules/alek.py             |    6 +-----
 scripts/schedules/erek.py             |    8 +-------
 scripts/schedules/frostbloom.py       |    7 +------
 scripts/schedules/keyboard_control.py |    8 ++++----
 scripts/schedules/oliver.py           |    3 ---
 scripts/schedules/orloth.py           |   10 ++--------
 scripts/schedules/sarin.py            |    9 +--------
 scripts/schedules/silverhair.py       |    9 ++-------
 scripts/schedules/talan.py            |    9 +++------
 31 files changed, 66 insertions(+), 138 deletions(-)

diff --git a/scripts/events/1st_to_2nd.py b/scripts/events/1st_to_2nd.py
index 90f3824..8252ea3 100755
--- a/scripts/events/1st_to_2nd.py
+++ b/scripts/events/1st_to_2nd.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # 1st floor to 2nd floor
 if mychar.submap() == 9:
-    switch_submap (mychar, 14, 4, 2, STAND_SOUTH)
+    events.switch_submap (mychar, 14, 4, 2, STAND_SOUTH)
 else:
-    switch_submap (mychar, 9, 6, 2, STAND_SOUTH)
+    events.switch_submap (mychar, 9, 6, 2, STAND_SOUTH)
 
diff --git a/scripts/events/1st_to_fellnir.py b/scripts/events/1st_to_fellnir.py
index e5fa4af..4a19fa8 100755
--- a/scripts/events/1st_to_fellnir.py
+++ b/scripts/events/1st_to_fellnir.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 9:
-  switch_submap (p, 10, 1, 3, STAND_EAST)
+  events.switch_submap (p, 10, 1, 3, STAND_EAST)
 else:
-  switch_submap (p, 9, 8, 2, STAND_WEST)
+  events.switch_submap (p, 9, 8, 2, STAND_WEST)
 
diff --git a/scripts/events/1st_to_frostbloom.py 
b/scripts/events/1st_to_frostbloom.py
index 756fb8e..7292261 100755
--- a/scripts/events/1st_to_frostbloom.py
+++ b/scripts/events/1st_to_frostbloom.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 9:
-  switch_submap (p, 11, 4, 3, STAND_WEST)
+  events.switch_submap (p, 11, 4, 3, STAND_WEST)
 else:
-  switch_submap (p, 9, 1, 2, STAND_EAST)
+  events.switch_submap (p, 9, 1, 2, STAND_EAST)
 
 
diff --git a/scripts/events/1st_to_player.py b/scripts/events/1st_to_player.py
index 920ec1c..74885af 100755
--- a/scripts/events/1st_to_player.py
+++ b/scripts/events/1st_to_player.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 9:
-  switch_submap (p, 12, 5, 2, STAND_SOUTH)
+  events.switch_submap (p, 12, 5, 2, STAND_SOUTH)
 else:
-  switch_submap (p, 9, 7, 3, STAND_NORTH)
+  events.switch_submap (p, 9, 7, 3, STAND_NORTH)
 
diff --git a/scripts/events/1st_to_silverhair.py 
b/scripts/events/1st_to_silverhair.py
index fcb7738..7351911 100755
--- a/scripts/events/1st_to_silverhair.py
+++ b/scripts/events/1st_to_silverhair.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 9:
-  switch_submap (p, 13, 5, 2, STAND_SOUTH)
+  events.switch_submap (p, 13, 5, 2, STAND_SOUTH)
 else:
-  switch_submap (p, 9, 1, 6, STAND_NORTH)
+  events.switch_submap (p, 9, 1, 6, STAND_NORTH)
 
diff --git a/scripts/events/2nd_to_illig.py b/scripts/events/2nd_to_illig.py
index 35f448e..e25486f 100755
--- a/scripts/events/2nd_to_illig.py
+++ b/scripts/events/2nd_to_illig.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 14:
-  switch_submap (p, 17, 6, 2, STAND_SOUTH)
+  events.switch_submap (p, 17, 6, 2, STAND_SOUTH)
 else:
-  switch_submap (p, 14, 1, 7, STAND_NORTH)
+  events.switch_submap (p, 14, 1, 7, STAND_NORTH)
 
diff --git a/scripts/events/2nd_to_oliver.py b/scripts/events/2nd_to_oliver.py
index dc563e3..eb374bb 100755
--- a/scripts/events/2nd_to_oliver.py
+++ b/scripts/events/2nd_to_oliver.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 14:
-  switch_submap (p, 16, 6, 5, STAND_WEST)
+  events.switch_submap (p, 16, 6, 5, STAND_WEST)
 else:
-  switch_submap (p, 14, 1, 5, STAND_EAST)
+  events.switch_submap (p, 14, 1, 5, STAND_EAST)
 
diff --git a/scripts/events/2nd_to_redwyne.py b/scripts/events/2nd_to_redwyne.py
index 7a80ef1..7bdf1bc 100755
--- a/scripts/events/2nd_to_redwyne.py
+++ b/scripts/events/2nd_to_redwyne.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 14:
-  switch_submap (p, 15, 1, 5, STAND_EAST)
+  events.switch_submap (p, 15, 1, 5, STAND_EAST)
 else:
-  switch_submap (p, 14, 2, 5, STAND_WEST)
+  events.switch_submap (p, 14, 2, 5, STAND_WEST)
 
diff --git a/scripts/events/barn_to_cellar.py b/scripts/events/barn_to_cellar.py
index a000f16..71fd454 100755
--- a/scripts/events/barn_to_cellar.py
+++ b/scripts/events/barn_to_cellar.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # Barn to cellar
 if mychar.submap() == 0:
-    switch_submap (mychar, 4, 12, 2, STAND_SOUTH)
+    events.switch_submap (mychar, 4, 12, 2, STAND_SOUTH)
 else:
-    switch_submap (mychar, 0, 24, 11, STAND_SOUTH)
+    events.switch_submap (mychar, 0, 24, 11, STAND_SOUTH)
 
diff --git a/scripts/events/cellar_to_alek.py b/scripts/events/cellar_to_alek.py
index 2b2a050..10e3408 100755
--- a/scripts/events/cellar_to_alek.py
+++ b/scripts/events/cellar_to_alek.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 4:
-  switch_submap (p, 6, 5, 6 + (p.posy () - 6), STAND_WEST)
+  events.switch_submap (p, 6, 5, 6 + (p.posy () - 6), STAND_WEST)
 else:
-  switch_submap (p, 4, 1, 6 + (p.posy () - 6), STAND_EAST)
+  events.switch_submap (p, 4, 1, 6 + (p.posy () - 6), STAND_EAST)
 
diff --git a/scripts/events/cellar_to_bath.py b/scripts/events/cellar_to_bath.py
index 5ddcb92..c76585a 100755
--- a/scripts/events/cellar_to_bath.py
+++ b/scripts/events/cellar_to_bath.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 4:
-  switch_submap (p, 5, 3, 6, STAND_NORTH)
+  events.switch_submap (p, 5, 3, 6, STAND_NORTH)
 else:
-  switch_submap (p, 4, 2, 6, STAND_SOUTH)
+  events.switch_submap (p, 4, 2, 6, STAND_SOUTH)
 
diff --git a/scripts/events/cellar_to_dwarfs.py 
b/scripts/events/cellar_to_dwarfs.py
index 1b0da3f..2c180af 100755
--- a/scripts/events/cellar_to_dwarfs.py
+++ b/scripts/events/cellar_to_dwarfs.py
@@ -1,5 +1,3 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 4:
@@ -11,7 +9,7 @@ if p.submap () == 4:
             p.stand ()
             p.go_west ()
     else:
-        switch_submap (p, 7, 1, 6 + (p.posy () - 6), STAND_EAST)
+        events.switch_submap (p, 7, 1, 6 + (p.posy () - 6), STAND_EAST)
 else:
-    switch_submap (p, 4, 9, 6 + (p.posy () - 6), STAND_WEST)
+    events.switch_submap (p, 4, 9, 6 + (p.posy () - 6), STAND_WEST)
 
diff --git a/scripts/events/cellar_to_storage.py 
b/scripts/events/cellar_to_storage.py
index 51e52fa..6b9c7ad 100755
--- a/scripts/events/cellar_to_storage.py
+++ b/scripts/events/cellar_to_storage.py
@@ -1,9 +1,7 @@
-from events import switch_submap
-
 p = characters [name]
 
 if p.submap () == 4:
-  switch_submap (p, 8, 6, 3 + (p.posy () - 9), STAND_WEST)
+  events.switch_submap (p, 8, 6, 3 + (p.posy () - 9), STAND_WEST)
 else:
-  switch_submap (p, 4, 1, 9 + (p.posy () - 3), STAND_EAST)
+  events.switch_submap (p, 4, 1, 9 + (p.posy () - 3), STAND_EAST)
 
diff --git a/scripts/events/common_to_1st.py b/scripts/events/common_to_1st.py
index 4fce225..d02449c 100755
--- a/scripts/events/common_to_1st.py
+++ b/scripts/events/common_to_1st.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # Common room to 1st floor
 if mychar.submap() == 1:
-    switch_submap (mychar, 9, 8, 2, STAND_SOUTH)
+    events.switch_submap (mychar, 9, 8, 2, STAND_SOUTH)
 else:
-    switch_submap (mychar, 1, 12, 2, STAND_SOUTH)
+    events.switch_submap (mychar, 1, 12, 2, STAND_SOUTH)
 
diff --git a/scripts/events/common_to_cellar.py 
b/scripts/events/common_to_cellar.py
index 325c85b..822d313 100755
--- a/scripts/events/common_to_cellar.py
+++ b/scripts/events/common_to_cellar.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # Common room to cellar
 if mychar.submap() == 1:
-    switch_submap (mychar, 4, 6, 2, STAND_SOUTH)
+    events.switch_submap (mychar, 4, 6, 2, STAND_SOUTH)
 else:
-    switch_submap (mychar, 1, 9, 2, STAND_SOUTH)
+    events.switch_submap (mychar, 1, 9, 2, STAND_SOUTH)
 
diff --git a/scripts/events/common_to_kitchen.py 
b/scripts/events/common_to_kitchen.py
index 1dbf03a..139e1bb 100755
--- a/scripts/events/common_to_kitchen.py
+++ b/scripts/events/common_to_kitchen.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # Common room to Kitchen
 if mychar.submap() == 1:
-    switch_submap (mychar, 3, 1, 2, STAND_SOUTH)
+    events.switch_submap (mychar, 3, 1, 2, STAND_SOUTH)
 else:
-    switch_submap (mychar, 1, 1, 7, STAND_NORTH)
+    events.switch_submap (mychar, 1, 1, 7, STAND_NORTH)
 
diff --git a/scripts/events/common_to_parlor.py 
b/scripts/events/common_to_parlor.py
index 06d9825..b2b32a1 100755
--- a/scripts/events/common_to_parlor.py
+++ b/scripts/events/common_to_parlor.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # -- From Common Room to Parlour
 if mychar.submap () == 1:
-    switch_submap (mychar, 2, 1, 4, STAND_EAST)
+    events.switch_submap (mychar, 2, 1, 4, STAND_EAST)
 else:
-    switch_submap (mychar, 1, 13, 4, STAND_WEST)
+    events.switch_submap (mychar, 1, 13, 4, STAND_WEST)
 
diff --git a/scripts/events/inn_to_yard.py b/scripts/events/inn_to_yard.py
index 6e64387..287a465 100755
--- a/scripts/events/inn_to_yard.py
+++ b/scripts/events/inn_to_yard.py
@@ -1,5 +1,3 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # Close the inn door.
@@ -8,6 +6,6 @@ if mychar.submap () == 0:
 
 # -- From Common Room to Yard
 if mychar.submap () == 1:
-    switch_submap (mychar, 0, 18, 14, STAND_SOUTH)
+    events.switch_submap (mychar, 0, 18, 14, STAND_SOUTH)
 else:
-    switch_submap (mychar, 1, 13, 7, STAND_NORTH)
+    events.switch_submap (mychar, 1, 13, 7, STAND_NORTH)
diff --git a/scripts/events/kitchen_to_cellar.py 
b/scripts/events/kitchen_to_cellar.py
index f13f844..a6e276d 100755
--- a/scripts/events/kitchen_to_cellar.py
+++ b/scripts/events/kitchen_to_cellar.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # Kitchen to cellar
 if mychar.submap() == 3:
-    switch_submap (mychar, 4, 3, 12, STAND_NORTH)
+    events.switch_submap (mychar, 4, 3, 12, STAND_NORTH)
 else:
-    switch_submap (mychar, 3, 6, 5, STAND_NORTH)
+    events.switch_submap (mychar, 3, 6, 5, STAND_NORTH)
 
diff --git a/scripts/events/yard_to_kitchen.py 
b/scripts/events/yard_to_kitchen.py
index cd9069e..63caaa5 100755
--- a/scripts/events/yard_to_kitchen.py
+++ b/scripts/events/yard_to_kitchen.py
@@ -1,10 +1,8 @@
-from events import switch_submap
-
 mychar = characters [name]
 
 # -- From Yard to Kitchen
 if mychar.submap () == 0:
-    switch_submap (mychar, 3, 6, 3, STAND_WEST)
+    events.switch_submap (mychar, 3, 6, 3, STAND_WEST)
 else:
-    switch_submap (mychar, 0, 12, 14, STAND_EAST)
+    events.switch_submap (mychar, 0, 12, 14, STAND_EAST)
 
diff --git a/scripts/modules/console.py b/scripts/modules/console.py
index 13d9f4e..2b7a66d 100755
--- a/scripts/modules/console.py
+++ b/scripts/modules/console.py
@@ -89,12 +89,11 @@ class console (win_container):
 
     # -- catch relevant keypresses 
     def on_update (self):
-        
         # -- quit
         if input_has_been_pushed (SDLK_TAB):
             # print "Quitting ..."
             self.quit = 0
-
+        
         # -- clear screen
         elif input_has_been_pushed (SDLK_DELETE):
             # print "Deleting ..."
diff --git a/scripts/modules/ins_modules.py b/scripts/modules/ins_modules.py
index 895a1a0..d9835b4 100755
--- a/scripts/modules/ins_modules.py
+++ b/scripts/modules/ins_modules.py
@@ -1,3 +1,11 @@
-from random import *
+# You won't get far without this one...
 from adonthell import *
-from adonthellc import *
+
+# random methods are accessible directly
+from random import *
+
+# schedules module is accessible through "schedules" namespace
+import schedules
+
+# events module is accessible through "events" namespace
+import events
diff --git a/scripts/schedules/alek.py b/scripts/schedules/alek.py
index dc778c3..252e4b7 100755
--- a/scripts/schedules/alek.py
+++ b/scripts/schedules/alek.py
@@ -45,7 +45,6 @@ elif todo == 1:
 elif todo == 2:
     if myself.follow_path () == 1:
         # -- the time we stay at the same place
-        from random import randint
         delay = randint (60, 150) * 20
 
         myself.set_val ("delay", delay)
@@ -56,9 +55,6 @@ elif todo == 2:
 tmp = myself.get_val ("say_something")
 myself.set_val ("say_something", tmp - 1)
 if tmp == 0:
-    from schedules import speak
-    from random import randint
-
-    speak (myself, speech[randint (0, 2)])
+    schedules.speak (myself, speech[randint (0, 2)])
     delay = randint (40, 80) * 25
     myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/erek.py b/scripts/schedules/erek.py
index c8f4cb5..30170af 100755
--- a/scripts/schedules/erek.py
+++ b/scripts/schedules/erek.py
@@ -48,7 +48,6 @@ elif myself.get_val ("leave_bjarn") == 1:
 
     # -- hopefully in the common room
     else:
-        from random import randint
         myself.set_val ("leave_bjarn", 0)
         x, y, dir = coords[randint (0, 1)]
         myself.set_goal (x, y, dir)
@@ -90,8 +89,6 @@ elif todo == 1:
 # -- move
 elif todo == 2:
     if myself.follow_path () == 1:
-        from random import randint
-
         # -- reached common room
         if myself.submap () == 1 and myself.posx () == 13:
             x, y, dir = coords[randint (0, 1)]
@@ -118,9 +115,6 @@ tmp = myself.get_val ("say_something")
 myself.set_val ("say_something", tmp - 1)
 
 if tmp == 0:
-    from schedules import speak
-    from random import randint
-
-    speak (myself, speech[randint (0, 2)])
+    schedules.speak (myself, 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 b65d628..483301a 100755
--- a/scripts/schedules/frostbloom.py
+++ b/scripts/schedules/frostbloom.py
@@ -38,8 +38,6 @@ if todo == 0:
 
 # -- get movement target
 elif todo == 1:
-    from random import randint
-
     # -- the position we want to reach
     x = randint (min_x, max_x)
     y = randint (min_y, max_y)
@@ -60,9 +58,6 @@ elif todo == 2:
 tmp = myself.get_val ("say_something")
 myself.set_val ("say_something", tmp - 1)
 if tmp == 0:
-    from schedules import speak
-    from random import randint
-
-    speak (myself, speech[randint (0, 2)])
+    schedules.speak (myself, speech[randint (0, 2)])
     delay = randint (50, 150) * 20
     myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/keyboard_control.py 
b/scripts/schedules/keyboard_control.py
index 05505fa..6b742b1 100755
--- a/scripts/schedules/keyboard_control.py
+++ b/scripts/schedules/keyboard_control.py
@@ -67,10 +67,10 @@ if input_has_been_pushed (SDLK_SPACE):
 
 # -- bring up the main menu
 elif input_has_been_pushed (SDLK_ESCAPE):
-    from main_menu import *
+    import main_menu
 
     # -- open main menu without animation, with saving and background enabled
-    menu = main_menu (1, 1, 1)
+    menu = main_menu.main_menu (1, 1, 1)
     menu.thisown = C
 
     # -- this tells us when the main menu is closed
@@ -122,8 +122,8 @@ elif input_has_been_pushed (SDLK_s):
 
 # -- python console
 elif input_has_been_pushed (SDLK_TAB):
-    from console import *
-    c = console (globals ())
+    import console
+    c = console.console (globals ())
     c.thisown = C
     c.set_activate (1)
     win_manager_add (c)
diff --git a/scripts/schedules/oliver.py b/scripts/schedules/oliver.py
index 4945532..2bcce4b 100755
--- a/scripts/schedules/oliver.py
+++ b/scripts/schedules/oliver.py
@@ -15,9 +15,6 @@
 #    He'll walk around in the stable and yard.
 #    When summoned by Orloth, he'll show the player to his room
 
-import schedules
-import random
-
 speech = ["It's so exciting. An Elven Lady at Waste's Edge!", \
           "I gotta hurry before mother complains again.", \
           "I want a little dog!"]
diff --git a/scripts/schedules/orloth.py b/scripts/schedules/orloth.py
index 95aab5c..f58bbac 100755
--- a/scripts/schedules/orloth.py
+++ b/scripts/schedules/orloth.py
@@ -39,8 +39,6 @@ if todo == 0:
 
 # -- engage a new movement
 elif todo == 1:
-    from random import randint
-
     # -- when we are at the bar, then wait a while before
     #    moving again
     if myself.posx () == 2:
@@ -61,8 +59,7 @@ elif todo == 2:
     if myself.follow_path () == 1:
         # -- standing in front of the clock
         if myself.posx () == 10:
-            from schedules import speak
-            speak (myself, "That clock is late again!")
+            schedules.speak (myself, "That clock is late again!")
 
             tmp = myself.get_val ("say_something")
             myself.set_val ("say_something", tmp + 75)
@@ -74,9 +71,6 @@ elif todo == 2:
 tmp = myself.get_val ("say_something")
 myself.set_val ("say_something", tmp - 1)
 if tmp == 0:
-    from schedules import speak
-    from random import randint
-
-    speak (myself, speech[randint (0, 2)])
+    schedules.speak (myself, speech[randint (0, 2)])
     delay = randint (50, 150) * 20
     myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/sarin.py b/scripts/schedules/sarin.py
index 5e38d8c..11e8fa0 100755
--- a/scripts/schedules/sarin.py
+++ b/scripts/schedules/sarin.py
@@ -33,8 +33,6 @@ delay = myself.get_val ("delay")
 
 # -- switch orientation
 if delay == 0:
-    from random import randint
-
     # -- get the current direction ...
     dir = myself.get_val ("direction")
 
@@ -94,8 +92,6 @@ elif todo == 1:
 # -- move
 elif todo == 2:
     if myself.follow_path () == 1:
-        from random import randint
-
         # -- wait a little on the current tile
         delay = randint (15, 30) * 10
         myself.set_val ("switch_direction", delay)
@@ -107,9 +103,6 @@ elif todo == 2:
 tmp = myself.get_val ("say_something")
 myself.set_val ("say_something", tmp - 1)
 if tmp == 0:
-    from schedules import speak
-    from random import randint
-
-    speak (myself, speech[randint (0, 3)])
+    schedules.speak (myself, speech[randint (0, 3)])
     delay = randint (50, 150) * 10
     myself.set_val ("say_something", delay)
diff --git a/scripts/schedules/silverhair.py b/scripts/schedules/silverhair.py
index bab5d3d..bd0c7f6 100755
--- a/scripts/schedules/silverhair.py
+++ b/scripts/schedules/silverhair.py
@@ -34,8 +34,6 @@ if todo == 0:
 
 # -- get movement target
 elif todo == 1:
-    from random import randint
-
     # -- goto the window
     if myself.posx () == 4:
         # ... and speak about the weather
@@ -62,13 +60,10 @@ elif todo == 2:
 say = myself.get_val ("say_something")
 myself.set_val ("say_something", say - 1)
 if say == 0:
-    from schedules import speak
-    from random import randint
-
     if myself.posx () == 6:
-        speak (myself, speech[3])
+        schedules.speak (myself, speech[3])
     else:
-        speak (myself, speech[randint (0, 2)])
+        schedules.speak (myself, speech[randint (0, 2)])
 
     say = randint (50, 150) * 20
     myself.set_val ("say_something", say)
diff --git a/scripts/schedules/talan.py b/scripts/schedules/talan.py
index de05ee2..5c7307c 100755
--- a/scripts/schedules/talan.py
+++ b/scripts/schedules/talan.py
@@ -45,8 +45,7 @@ elif todo == 1:
 elif todo == 2:
     # Reached the goal? Wait a while then...
     if myself.follow_path ():
-        import random
-        myself.set_val ("delay", random.randint (25, 50) * 20)
+        myself.set_val ("delay", randint (25, 50) * 20)
         myself.set_val ("todo", 0)
 
 
@@ -54,8 +53,6 @@ elif todo == 2:
 tmp = myself.get_val ("say_something")
 myself.set_val ("say_something", tmp - 1)
 if tmp <= 0:
-    import schedules
-    import random
-    schedules.speak (myself, speech[random.randint (0, 2)])
-    delay = random.randint (50, 150) * 20
+    schedules.speak (myself, 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]