More Python tests.

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@5819 282e977c-c81d-0410-88c4-b93c2d0d6712
master
ryo_saeba 2007-03-18 00:08:45 +00:00
parent 2386618e1b
commit 5b90804e69
3 changed files with 55 additions and 0 deletions

View File

@ -41,6 +41,14 @@ arch cobblestones2
x 1
y 4
end
arch exit
x 1
y 4
arch event_apply
title Python
slaying /test/python_exit.py
end
end
arch cobblestones2
x 2
end
@ -72,6 +80,14 @@ arch cobblestones2
x 2
y 4
end
arch oakdoor
x 2
y 4
arch event_apply
title Python
slaying /test/python_exit.py
end
end
arch cobblestones2
x 3
end

View File

@ -27,6 +27,9 @@ def do_help():
whoami.Say(' - readkey')
whoami.Say(' - writekey')
whoami.Say(' - speed')
whoami.Say(' - owner')
whoami.Say(' - friendlylist')
whoami.Say(' - create')
def do_arch():
archs = Crossfire.GetArchetypes()
@ -233,6 +236,28 @@ def do_speed():
who.SpeedLeft = -50
whoami.Say('Changed your speed, now %f and %f'%(who.Speed, who.SpeedLeft))
def do_owner():
whoami.Say('Not implemented.');
def do_friendlylist():
friends = Crossfire.GetFriendlyList()
for ob in friends:
if (ob.Owner):
n = ob.Owner.Name
else:
n = ''
whoami.Say(' - %s (%s)'%(ob.Name, n))
def do_create():
first = Crossfire.CreateObjectByName('gem')
if (first):
whoami.Say('created gem: %s'%first.Name)
first.Teleport(whoami.Map, 2, 2)
second = Crossfire.CreateObjectByName('diamond')
if (second):
whoami.Say('created diamond: %s'%second.Name)
second.Teleport(whoami.Map, 2, 2)
topic = Crossfire.WhatIsMessage().split()
#whoami.Say('topic = %s'%topic)
#whoami.Say('topic[0] = %s'%topic[0])
@ -278,5 +303,11 @@ elif topic[0] == 'writekey':
do_writekey()
elif topic[0] == 'speed':
do_speed()
elif topic[0] == 'owner':
do_owner()
elif topic[0] == 'friendlylist':
do_friendlylist()
elif topic[0] == 'create':
do_create()
else:
do_help()

View File

@ -0,0 +1,8 @@
import Crossfire
#Crossfire.SetReturnValue( 1 )
whoami = Crossfire.WhoAmI()
who = Crossfire.WhoIsActivator()
whoami.Say("exit applied by %s"%who.Name)