Difference for python/IPO/board.py from version 1.4 to 1.5


version 1.4 version 1.5
Line 22
 
Line 22
 #  #
 #Updated to use new path functions in CFPython -Todd Mitchell  #Updated to use new path functions in CFPython -Todd Mitchell
   
 import CFPython  import Crossfire
 import CFBoard  import CFBoard
 import string  import string
   
 board = CFBoard.CFBoard()  board = CFBoard.CFBoard()
   
 activator=CFPython.WhoIsActivator()  activator=Crossfire.WhoIsActivator()
 activatorname=CFPython.GetName(activator)  activatorname=activator.Name
 whoami=CFPython.WhoAmI()  whoami=Crossfire.WhoAmI()
   
 boardname=CFPython.GetEventOptions(whoami,6) # 6 is say event  boardname=Crossfire.ScriptParameters() # 6 is say event
 print "Activated %s" %boardname  print "Activated %s" %boardname
   
 if (boardname):  if (boardname):
   
  text = string.split(CFPython.WhatIsMessage(), ' ', 1)   text = string.split(Crossfire.WhatIsMessage(), ' ', 1)
   
  if text[0] == 'help' or text[0] == 'yes':   if text[0] == 'help' or text[0] == 'yes':
  message='Help for %s\nList of commands:\n\n- list\n- write <message>\n- remove <id>\n'%boardname   message='Help for %s\nList of commands:\n\n- list\n- write <message>\n- remove <id>\n'%boardname
  CFPython.Write(message, activator)   activator.Write(message)
   
  elif text[0] == 'write':   elif text[0] == 'write':
  if len(text)==2:   if len(text)==2:
  board.write(boardname, activatorname, text[1])   board.write(boardname, activatorname, text[1])
  CFPython.Write('Added to %s'%boardname, activator)   activator.Write('Added to %s'%boardname)
  else:   else:
  CFPython.Write('Usage "write <text>"', activator)   activator.Write('Usage "write <text>"')
   
  elif text[0] == 'list':   elif text[0] == 'list':
  total = board.countmsg(boardname)   total = board.countmsg(boardname)
  if total > 0:   if total > 0:
  CFPython.Write('Content of %s:'%boardname, activator)   activator.Write('Content of %s:'%boardname)
  elements = board.list(boardname)   elements = board.list(boardname)
  element = []   element = []
  id = 1   id = 1
  for element in elements:   for element in elements:
  author, message = element   author, message = element
  CFPython.Write('<%d> (%s) %s'%(id,author,message), activator)   activator.Write('<%d> (%s) %s'%(id,author,message))
  id=id+1   id=id+1
  else:   else:
  CFPython.Write('%s is empty'%boardname, activator)   activator.Write('%s is empty'%boardname)
   
  elif text[0] == 'remove':   elif text[0] == 'remove':
  if len(text)==2:   if len(text)==2:
  if board.getauthor(boardname,int(text[1]))==activatorname or CFPython.IsDungeonMaster(activator):   if board.getauthor(boardname,int(text[1]))==activatorname or activator.IsDungeonMaster:
  if board.delete(boardname, int(text[1])):   if board.delete(boardname, int(text[1])):
  CFPython.Write('Removed from %s'%boardname, activator)   activator.Write('Removed from %s'%boardname)
  else:   else:
  CFPython.Write('Doesn\'t exist on %s'%boardname, activator)   activator.Write('Doesn\'t exist on %s'%boardname)
  else:   else:
  CFPython.Write('Access denied', activator)   activator.Write('Access denied')
  else:   else:
  CFPython.Write('Usage "remove <id>"', activator)   activator.Write('Usage "remove <id>"')
   
  else:   else:
  CFPython.Write('Do you need help?', activator)   activator.Write('Do you need help?')
   
 else:  else:
  CFPython.Write('Board Error', activator)   activator.Write('Board Error')


Legend:
line(s) removed in v.1.4 
line(s) changed
 line(s) added in v.1.5

File made using version 1.96 of cvs2html by leaf at 2006-02-15 17:28