Crossfire Server, Trunk
give.py
Go to the documentation of this file.
1 import Crossfire
2 
3 def getReceiver(me, direction):
4  map = me.Map
5  x = me.X
6  y = me.Y
7 
8  if direction==2:
9  ob = map.ObjectAt(x+1, y-1)
10  elif direction==3:
11  ob = map.ObjectAt(x+1, y)
12  elif direction==4:
13  ob = map.ObjectAt(x+1, y+1)
14  elif direction==5:
15  ob = map.ObjectAt(x, y+1)
16  elif direction==6:
17  ob = map.ObjectAt(x-1, y+1)
18  elif direction==7:
19  ob = map.ObjectAt(x-1, y)
20  elif direction==8:
21  ob = map.ObjectAt(x-1, y-1)
22  else:
23  ob = map.ObjectAt(x, y-1)
24  return ob
25 
26 whoami = Crossfire.WhoAmI()
27 name = Crossfire.ScriptName()
28 parms = Crossfire.ScriptParameters()
29 
30 if not parms:
31  whoami.Message("Show which object ?")
32 else:
33  op = whoami.CheckInventory(parms)
34  if not op:
35  whoami.Message('No matching object found to give.')
36  else:
37  direction = whoami.Facing
38  receiver = getReceiver(whoami, direction)
39  if not receiver:
40  whoami.Message('Nobody to give this to.')
41  else:
42  top = receiver
43  while(top):
44  next = top.Above
45  top.Event(whoami,op, "give", 0)
46  top = next
give.getReceiver
def getReceiver(me, direction)
Definition: give.py:3
while
while(1)
Definition: loader.cpp:36468