Thread: [wpdev-commits] xmlscripts/scripts/commands events.py,1.5,1.6
Brought to you by:
rip,
thiagocorrea
From: Richard M. <dr...@us...> - 2004-08-26 22:23:43
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12327/commands Modified Files: events.py Log Message: Fixed a small bug from the hasevent/hasscript switch. Index: events.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/events.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** events.py 25 Aug 2004 17:03:04 -0000 1.5 --- events.py 26 Aug 2004 22:23:33 -0000 1.6 *************** *** 3,7 **** from wolfpack.consts import LOG_MESSAGE, EVENT_USE ! def addscript_response(player, arguments, target): script = arguments[0] object = None --- 3,7 ---- from wolfpack.consts import LOG_MESSAGE, EVENT_USE ! def addscript_response( player, arguments, target ): script = arguments[0] object = None *************** *** 11,26 **** elif target.char: if target.char.rank > player.rank and player != target.char: ! player.socket.sysmessage("You've burnt your fingers!") ! return ! object = target.char else: ! player.socket.sysmessage('You have to target a character or item.') ! return ! player.log(LOG_MESSAGE, "Adds script '%s' to object 0x%x.\n" % (script, object.serial)) ! object.addscript(script) object.resendtooltip() ! player.socket.sysmessage('You add the script to your target.') """ --- 11,26 ---- elif target.char: if target.char.rank > player.rank and player != target.char: ! player.socket.sysmessage( "You've burnt your fingers!" ) ! return False object = target.char else: ! player.socket.sysmessage( 'You have to target a character or item.' ) ! return False ! player.log( LOG_MESSAGE, "Adds script '%s' to object 0x%x.\n" % ( script, object.serial ) ) ! object.addscript( str( script ) ) object.resendtooltip() ! player.socket.sysmessage( 'You add the script to your target.' ) ! return True """ *************** *** 30,50 **** Script is the id of the script you want to attach. """ ! def commandAddscript(socket, command, arguments): if len(arguments) == 0: ! socket.sysmessage('Usage: addscript <identifier>') ! return script = arguments.strip() try: ! wolfpack.hasscript(script, EVENT_USE) except: ! socket.sysmessage('No such script: %s.' % script) ! return ! socket.sysmessage("Please select the object you want to add the script '%s' to." % script) ! socket.attachtarget('commands.events.addscript_response', [script]) ! def removescript_response(player, arguments, target): script = arguments[0] object = None --- 30,50 ---- Script is the id of the script you want to attach. """ ! def commandAddscript( socket, command, arguments ): if len(arguments) == 0: ! socket.sysmessage( 'Usage: addscript <identifier>' ) ! return False script = arguments.strip() try: ! wolfpack.hasevent( script, EVENT_USE ) except: ! socket.sysmessage( 'No such script: %s.' % script ) ! return False ! socket.sysmessage( "Please select the object you want to add the script '%s' to." % script) ! socket.attachtarget( 'commands.events.addscript_response', [ script ] ) ! def removescript_response( player, arguments, target ): script = arguments[0] object = None *************** *** 54,72 **** elif target.char: if target.char.rank > player.rank and player != target.char: ! player.socket.sysmessage("You've burnt your fingers!") ! return object = target.char else: ! player.socket.sysmessage('You have to target a character or item.') ! return ! if object.hasscript(script): ! player.log(LOG_MESSAGE, "Removes script '%s' from object 0x%x.\n" % (script, object.serial)) ! object.removescript(script) object.resendtooltip() ! player.socket.sysmessage('You remove the script from your target.') else: ! player.socket.sysmessage('Your target does not have the given script.') """ --- 54,74 ---- elif target.char: if target.char.rank > player.rank and player != target.char: ! player.socket.sysmessage( "You've burnt your fingers!" ) ! return False object = target.char else: ! player.socket.sysmessage( 'You have to target a character or item.' ) ! return False ! if object.hasscript( str( script ) ): ! player.log( LOG_MESSAGE, "Removes script '%s' from object 0x%x.\n" % ( script, object.serial ) ) ! object.removescript( str( script ) ) object.resendtooltip() ! player.socket.sysmessage( 'You remove the script from your target.' ) ! return True else: ! player.socket.sysmessage( 'Your target does not have the given script.' ) ! return False """ *************** *** 79,96 **** if len(arguments) == 0: socket.sysmessage('Usage: removescript <identifier>') ! return script = arguments.strip() try: ! wolfpack.hasscript(script, EVENT_USE) except: ! socket.sysmessage('No such script: %s.' % script) ! return ! socket.sysmessage("Please select the object you want to remove the script '%s' from." % script) ! socket.attachtarget('commands.events.removescript_response', [script]) def onLoad(): ! wolfpack.registercommand('addscript', commandAddscript) ! wolfpack.registercommand('removescript', commandRemovescript) --- 81,99 ---- if len(arguments) == 0: socket.sysmessage('Usage: removescript <identifier>') ! return False script = arguments.strip() try: ! wolfpack.hasevent( script, EVENT_USE ) except: ! socket.sysmessage( 'No such script: %s.' % script ) ! return False ! socket.sysmessage( "Please select the object you want to remove the script '%s' from." % script) ! socket.attachtarget( 'commands.events.removescript_response', [ script ] ) ! return True def onLoad(): ! wolfpack.registercommand( 'addscript', commandAddscript ) ! wolfpack.registercommand( 'removescript', commandRemovescript ) |