Timer tests.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@4816 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
c0aef97ed2
commit
7a36e8e343
12
test/python
12
test/python
|
|
@ -1,12 +1,12 @@
|
||||||
arch map
|
arch map
|
||||||
region scorn
|
|
||||||
name python
|
name python
|
||||||
|
region scorn
|
||||||
|
width 5
|
||||||
|
height 5
|
||||||
msg
|
msg
|
||||||
Creator: CF Java Map Editor
|
Creator: CF Java Map Editor
|
||||||
Date: 7/15/2005
|
Date: 7/15/2005
|
||||||
endmsg
|
endmsg
|
||||||
width 5
|
|
||||||
height 5
|
|
||||||
end
|
end
|
||||||
arch cobblestones2
|
arch cobblestones2
|
||||||
end
|
end
|
||||||
|
|
@ -56,8 +56,12 @@ arch sage
|
||||||
x 2
|
x 2
|
||||||
y 2
|
y 2
|
||||||
arch event_say
|
arch event_say
|
||||||
slaying /test/python.py
|
|
||||||
title Python
|
title Python
|
||||||
|
slaying /test/python.py
|
||||||
|
end
|
||||||
|
arch event_timer
|
||||||
|
title Python
|
||||||
|
slaying /test/python_timer.py
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
arch cobblestones2
|
arch cobblestones2
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ def do_help():
|
||||||
whoami.Say(' - mark: marked item')
|
whoami.Say(' - mark: marked item')
|
||||||
whoami.Say(' - memory: storage-related tests')
|
whoami.Say(' - memory: storage-related tests')
|
||||||
whoami.Say(' - time: time of day tests')
|
whoami.Say(' - time: time of day tests')
|
||||||
|
whoami.Say(' - timer: timer activation test')
|
||||||
|
whoami.Say(' - timer_kill: kill specified timer')
|
||||||
|
|
||||||
def do_arch():
|
def do_arch():
|
||||||
archs = Crossfire.GetArchetypes()
|
archs = Crossfire.GetArchetypes()
|
||||||
|
|
@ -122,6 +124,22 @@ def do_time():
|
||||||
whoami.Say('Week of year: %d'%cftime[6])
|
whoami.Say('Week of year: %d'%cftime[6])
|
||||||
whoami.Say('Season: %d'%cftime[7])
|
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' )
|
whoami.Say( 'plugin test' )
|
||||||
|
|
||||||
topic = Crossfire.WhatIsMessage().split()
|
topic = Crossfire.WhatIsMessage().split()
|
||||||
|
|
@ -147,5 +165,9 @@ elif topic[0] == 'basics':
|
||||||
do_basics()
|
do_basics()
|
||||||
elif topic[0] == 'time':
|
elif topic[0] == 'time':
|
||||||
do_time()
|
do_time()
|
||||||
|
elif topic[0] == 'timer':
|
||||||
|
do_timer()
|
||||||
|
elif topic[0] == 'timer_kill':
|
||||||
|
do_timer_kill()
|
||||||
else:
|
else:
|
||||||
do_help()
|
do_help()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import Crossfire
|
||||||
|
|
||||||
|
Crossfire.SetReturnValue( 1 )
|
||||||
|
|
||||||
|
whoami=Crossfire.WhoAmI()
|
||||||
|
whoami.Say( "Ping!" )
|
||||||
|
|
||||||
Loading…
Reference in New Issue