View Full Version : Passing parameters to a plugin when created
ritty
03-31-2008, 10:01 PM
Hmm, I was sure I asked this last week, but can't find the thread.
Is there anyway to pass parameters to a room level plugin when instantiated?
If it's a game, one can use the game details object, but I'm looking to do this just as a room, bypassing the game manager.
The init method of BasePlugin has a EsObject parameter, but I can't seem to figure out how to pass that parameter into it.
tcarr
03-31-2008, 10:03 PM
The init method's parameter comes from the Extension.xml for the plugin. I remember answering this question. Let me see if I can give you a link to it.
edit: I can't find your post either. Here's a wiki article that might help:
XML variables (http://www.es-wiki.com/index.php?title=XML_variables)
ritty
03-31-2008, 10:53 PM
OK, So there's no way to pass data in dynamically? Perhaps I could form some sort of parameter list into the description attribute - which is a string rather than an EsObject.
ES3 was really good at being able to pass parameters with both the attributes property of the room and the variables property for plugins. How I would like these back!
tcarr
04-01-2008, 12:27 AM
If I were doing it, I would have one of the possible requests that a client can make handle this. When the plugin is created and added to the room, the client that created it then sends a plugin request with the requestParameters object holding all the data needed. Any other requests would be ignored until after this one is processed, and after it's processed once, it won't be allowed again (just use a boolean set in init()).
It's possible there's a slicker way to do this. My knee-jerk reaction to anything involving plugins is "use plugin request"; it takes me a bit longer to remember other tricks.
ritty
04-01-2008, 03:11 AM
Thanks Teresa,
I've decided to roll my own room manager running as a server plugin. This plugin then creates the room with the appropriate parameters. This is actually a good thing as I'm able to better separate the plugin logic into two separate plugins.
tcarr
04-01-2008, 04:13 AM
now that is slick!
Powered by vBulletin® Version 4.1.6 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.