From 9b5b95a0fe206323c3b713664d8feec909102a3a Mon Sep 17 00:00:00 2001 From: ryo_saeba Date: Sat, 29 Mar 2008 21:45:45 +0000 Subject: [PATCH] Python hook check. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@8664 282e977c-c81d-0410-88c4-b93c2d0d6712 --- test/python.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/python.py b/test/python.py index 38c7e0ca5..0a64b6eae 100644 --- a/test/python.py +++ b/test/python.py @@ -38,6 +38,7 @@ def do_help(): whoami.Say(' - checkinv') whoami.Say(' - face') whoami.Say(' - anim') + whoami.Say(' - hook') def do_arch(): archs = Crossfire.GetArchetypes() @@ -378,6 +379,22 @@ def do_anim(): obj.Anim = (topic[1]) whoami.Say('Anim changed') +def do_hook(): + item = whoami.Map.CreateObject('food', 0, 0) + whoami.Say('Created item.') + item2 = whoami.Map.ObjectAt(0, 0) + while item2.Above: + item2 = item2.Above + if item != item2: + whoami.Say('Not the same items!') + item.Remove() + whoami.Say('Trying to access removed item, exception coming') + try: + item2.Quantity = 1 + whoami.Say('No exception! Error!') + except: + whoami.Say('Exception came, ok') + topic = Crossfire.WhatIsMessage().split() #whoami.Say('topic = %s'%topic) #whoami.Say('topic[0] = %s'%topic[0]) @@ -445,5 +462,7 @@ elif topic[0] == 'anim': do_anim() elif topic[0] == 'face': do_face() +elif topic[0] == 'hook': + do_hook() else: do_help()