Version 1, last updated by sirebral at July 26, 2009 16:22 UTC
Die Roll Authenticator
This plugins takes our little bug from the Hello World plugin and gives us an interesting warning. Here we are learning more about how OpenRPG plugins can modify how the software functions.
import orpg.pluginhandler
import wx
class Plugin(orpg.pluginhandler.PluginHandler):
def __init__(self, plugindb, parent):
orpg.pluginhandler.PluginHandler.__init__(self, plugindb, parent)
self.name = 'Die Roll Authenticator'
self.author = 'Prof Sir Ebral'
self.help = 'Catch false die rolls before they happen.\n'
def plugin_menu(self):
pass
def plugin_enabled(self):
self.passed_parse = False
pass
def plugin_disabled(self):
pass
def pre_parse(self, text):
self.passed_parse = True
return text
def plugin_incoming_msg(self, text, type, name, player):
return text, type, name
def post_msg(self, text, myself):
text = text.replace('Plugin', '[1d20]') #You can remove this feature!
if self.passed_parse == False and text.find('[') > 0: #Checks to see if the data was parsed,
self.chat.InfoPost("Strange Roll!") #and if it contains a die string
else:
self.passed_parse = False
return text