summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--data/test.lua27
2 files changed, 22 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b6b074a..b0bf8777 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-02 Philipp Sehmisch <tmw@crushnet.org>
+
+ * data/test.lua: Used an example for schedule_in which is more in step with
+ actual practice. Used an example for schedule_every which is less annoying
+ for the server admin.
+
2008-05-31 Philipp Sehmisch <tmw@crushnet.org>
* data/script/libtmw.lua: Scripted a scheduler which can execute script
diff --git a/data/test.lua b/data/test.lua
index ad006a52..c2a88126 100644
--- a/data/test.lua
+++ b/data/test.lua
@@ -27,17 +27,9 @@ atinit(function()
tmw.trigger_create(56 * 32, 32 * 32, 64, 64, "patrol_waypoint", 1, true)
tmw.trigger_create(63 * 32, 32 * 32, 64, 64, "patrol_waypoint", 2, true)
- schedule_every(5, function()
- print("This is the schedule_every 5 seconds task")
+ schedule_every(3600, function()
+ print("One hour has passed on map 1-1")
end)
-
- schedule_in(25, function()
- print("This is the schedule_in 25 seconds after map initialisation task")
- schedule_in(7, function()
- print("This task was scheduled 7 seconds ago by the other schedule_in task")
- end)
- end)
-
end)
@@ -61,7 +53,8 @@ function npc1_talk(npc, ch)
"A Christmas party!",
"To buy.",
"To sell.",
- "To make a donation.")
+ "To make a donation.",
+ "Slowly count from one to ten.")
if v == 1 then
do_message(npc, ch, "Sorry, this is a heroic-fantasy game, I do not have any gun.")
elseif v == 2 then
@@ -90,6 +83,18 @@ function npc1_talk(npc, ch)
else
do_message(npc, ch, "I would feel bad taking money from someone that poor.")
end
+ elseif v == 6 then
+ tmw.being_say(npc, "As you wish...")
+ schedule_in(2, function() tmw.being_say(npc, "One") end)
+ schedule_in(4, function() tmw.being_say(npc, "Two") end)
+ schedule_in(6, function() tmw.being_say(npc, "Three") end)
+ schedule_in(8, function() tmw.being_say(npc, "Four") end)
+ schedule_in(10, function() tmw.being_say(npc, "Five") end)
+ schedule_in(12, function() tmw.being_say(npc, "Six") end)
+ schedule_in(14, function() tmw.being_say(npc, "Seven") end)
+ schedule_in(16, function() tmw.being_say(npc, "Eight") end)
+ schedule_in(18, function() tmw.being_say(npc, "Nine") end)
+ schedule_in(20, function() tmw.being_say(npc, "Ten") end)
end
end