Timer tests.

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@4816 282e977c-c81d-0410-88c4-b93c2d0d6712
master
ryo_saeba 2006-08-20 10:03:15 +00:00
parent c0aef97ed2
commit 7a36e8e343
3 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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()

View File

@ -0,0 +1,7 @@
import Crossfire
Crossfire.SetReturnValue( 1 )
whoami=Crossfire.WhoAmI()
whoami.Say( "Ping!" )