From a6b25f609b9c5aaa3cecdd8d10674b9c5751881a Mon Sep 17 00:00:00 2001 From: ryo_saeba Date: Sun, 4 Mar 2007 10:49:01 +0000 Subject: [PATCH] Pickup event test. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@5670 282e977c-c81d-0410-88c4-b93c2d0d6712 --- test/python | 8 ++++++++ test/python.py | 8 ++++++++ test/python_pickup.py | 14 ++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 test/python_pickup.py diff --git a/test/python b/test/python index 6bb21e4aa..0f3cae3d6 100644 --- a/test/python +++ b/test/python @@ -102,6 +102,14 @@ arch cobblestones2 x 4 y 2 end +arch apple +x 4 +y 2 +arch event_pickup +title Python +slaying /test/python_pickup.py +end +end arch cobblestones2 x 4 y 3 diff --git a/test/python.py b/test/python.py index d30b1efeb..605229b0d 100644 --- a/test/python.py +++ b/test/python.py @@ -26,6 +26,7 @@ def do_help(): whoami.Say(' - bed') whoami.Say(' - readkey') whoami.Say(' - writekey') + whoami.Say(' - speed') def do_arch(): archs = Crossfire.GetArchetypes() @@ -226,6 +227,11 @@ def do_writekey(): whoami.Say('writekey returned %d'%who.WriteKey(topic[1], val, int(topic[2]))) +def do_speed(): + whoami.Say('Your speed is %f and your speed_left %f'%(who.Speed, who.SpeedLeft)) +# who.Speed = 0.2 + who.SpeedLeft = -50 + whoami.Say('Changed your speed, now %f and %f'%(who.Speed, who.SpeedLeft)) topic = Crossfire.WhatIsMessage().split() #whoami.Say('topic = %s'%topic) @@ -270,5 +276,7 @@ elif topic[0] == 'readkey': do_readkey() elif topic[0] == 'writekey': do_writekey() +elif topic[0] == 'speed': + do_speed() else: do_help() diff --git a/test/python_pickup.py b/test/python_pickup.py new file mode 100644 index 000000000..4856d0c85 --- /dev/null +++ b/test/python_pickup.py @@ -0,0 +1,14 @@ +import Crossfire + +Crossfire.SetReturnValue( 1 ) + +whoami = Crossfire.WhoAmI() +who = Crossfire.WhoIsActivator() +where = Crossfire.WhoIsOther() + +whoami.Say("i'm %s pickup by %s"%(whoami.Name, who.Name)) +if (where) : + whoami.Say("i'm about to be put into %s"%where.Name) +else: + whoami.Say('put nowhere') +