Cuberite Forum
Web Plugin <-> plugin AND plugin <-> plugin relationship - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Web Plugin <-> plugin AND plugin <-> plugin relationship (/thread-452.html)



Web Plugin <-> plugin AND plugin <-> plugin relationship - Taugeshtu - 05-31-2012

Okay, I got several questions:

1. How can I get some parts of one plugin (for example, a global variable) from another plugin?
2. I'm using following code:
Code:
WebPlugin:AddTab( "(Re)Generation", HandleRequest_Generation )
How often "HandleRequest_Generation" is executed? Once every time the tab is refreshed in browser?

Thanks.


RE: Web Plugin <-> plugin AND plugin <-> plugin relationship - FakeTruth - 05-31-2012

(05-31-2012, 06:11 AM)Taugeshtu Wrote: Okay, I got several questions:

1. How can I get some parts of one plugin (for example, a global variable) from another plugin?
This is not possible at the moment, the only thing possible right now is getting the plugin name from another plugin. Implementing this is non-trivial, but I'm willing to spend some time on this. Do you require this? Can you give me some example of what you're trying to do?

(05-31-2012, 06:11 AM)Taugeshtu Wrote: 2. I'm using following code:
Code:
WebPlugin:AddTab( "(Re)Generation", HandleRequest_Generation )
How often "HandleRequest_Generation" is executed? Once every time the tab is refreshed in browser?
That is correct. The request function is called every time the browser (or whatever you use) requests a page related to your plugin from the webserver.

(05-31-2012, 06:11 AM)Taugeshtu Wrote: Thanks.
WelcomeTongue


RE: Web Plugin <-> plugin AND plugin <-> plugin relationship - Taugeshtu - 05-31-2012

Quote:Can you give me some example of what you're trying to do?
For example, I could make some base "money" plugin, which just hold information about how much money each player have, and then I make a plugin that uses that "money" plugin, for example, to make a private area (or any kind of payments).

Another example: spells. Or you can call them "effects".
You have a common "container" plugin, which helds info about all effects available (and players permissions to use them), you write a function in a separate plugin, which make some "effect" (for example, builds a wall), you ask "container" to execute some effect function in another plugin (think about Runecraft + MagicSpells functionality, sharing same "effects" base)

Such functionality will allow less "solid" plugin writing - features could overlap without being re-written.

But it's not #1 priority for me, however Smile


RE: Web Plugin <-> plugin AND plugin <-> plugin relationship - Luksor - 05-31-2012

Wow, plugin interaction could be very useful. Smile


RE: Web Plugin <-> plugin AND plugin <-> plugin relationship - xoft - 05-31-2012

I was actually thinking of a framework other day that would allow plugins to store arbitrary data for each player and possibly, for each world and globally for the server. Data such as simple ints, floats, and strings. Kind of an ini-file, but a bit specialized Smile
So the plugins could do simply:
Code:
cPlayer::GetValueInt("Section", "Variable")
etc.
That could be the easy way to implement "money" on the server. Just all plugins agreeing on using the same variable Smile


RE: Web Plugin <-> plugin AND plugin <-> plugin relationship - Taugeshtu - 05-31-2012

Quote:That could be the easy way to implement "money" on the server. Just all plugins agreeing on using the same variable
I bet if you're trying to integrate your plugin into anyone's else you'll look at that plugin sourceBig Grin

Nice idea, btw. If we could have that and another plugins' functions calls - that would help a lot. I mean, some "standart" way to store data and share it between plugins and standart way to use parts of plugins without checking variables states in Tick() overhead. Lol, Hooks on HooksBig Grin