diff --git a/test/python b/test/python index 8a9777abb..6bb21e4aa 100644 --- a/test/python +++ b/test/python @@ -1,12 +1,12 @@ arch map -region scorn name python +region scorn +width 5 +height 5 msg Creator: CF Java Map Editor Date: 7/15/2005 endmsg -width 5 -height 5 end arch cobblestones2 end @@ -56,8 +56,12 @@ arch sage x 2 y 2 arch event_say -slaying /test/python.py title Python +slaying /test/python.py +end +arch event_timer +title Python +slaying /test/python_timer.py end end arch cobblestones2 diff --git a/test/python.py b/test/python.py index 3ab6242f5..34a5eaa2f 100644 --- a/test/python.py +++ b/test/python.py @@ -16,6 +16,8 @@ def do_help(): whoami.Say(' - mark: marked item') whoami.Say(' - memory: storage-related tests') whoami.Say(' - time: time of day tests') + whoami.Say(' - timer: timer activation test') + whoami.Say(' - timer_kill: kill specified timer') def do_arch(): archs = Crossfire.GetArchetypes() @@ -122,6 +124,22 @@ def do_time(): whoami.Say('Week of year: %d'%cftime[6]) whoami.Say('Season: %d'%cftime[7]) +def do_timer(): + id = whoami.CreateTimer(3,1) + if id >= 0: + whoami.Say('The countdown started with a 3 second delay, timerid = %d'%id) + else: + whoami.Say('Timer failure: %d'%id) + +def do_timer_kill(): + if ( len(topic) < 2 ): + whoami.Say('Kill which timer?') + else: + timer = int(topic[1]) + whoami.Say('DestroyTimer %d'%timer); + res = Crossfire.DestroyTimer(timer) + whoami.Say(' => %d'%res) + whoami.Say( 'plugin test' ) topic = Crossfire.WhatIsMessage().split() @@ -147,5 +165,9 @@ elif topic[0] == 'basics': do_basics() elif topic[0] == 'time': do_time() +elif topic[0] == 'timer': + do_timer() +elif topic[0] == 'timer_kill': + do_timer_kill() else: do_help() diff --git a/test/python_timer.py b/test/python_timer.py new file mode 100644 index 000000000..f1ba91d81 --- /dev/null +++ b/test/python_timer.py @@ -0,0 +1,7 @@ +import Crossfire + +Crossfire.SetReturnValue( 1 ) + +whoami=Crossfire.WhoAmI() +whoami.Say( "Ping!" ) +