Welcome Guest [Log In] [Register]
Viewing Single Post From: Plug-in System
Reid.
C'est un piège!
[ *  *  * ]
Jory
Jun 28 2009, 11:32 AM
Oh, I do know how to solve the compatebillity issue: Upon registration, you get a username. Each code also has a "codename". Both these names are valid Javascript class/variable names. Then if I where to want to make a code called "Banner Rotator", it would be something like this:
Code:
 
Jory.BannerRotator.execute()
{
// My code here
}
That way, if somebody else wants to make a banner rotator, it would be in otherpersonsusername.BannerRotator.execute(). (FYI, execute() gets automatically called by our hypothetical system. :) )

Do note I'm not sure this exact syntax is valid in Javascript. But I'm sure there is something close enough.
That would be very hard to implement. This is the valid syntax:
Code:
 
var Jory = {
BannerRotator:{
execute:function(){
// do something
}}}
Or, you could always do things the long way.
Code:
 
var Jory = new Object();
Jory.BannerRotator = new Object();
Jory.BannerRotator.execute = function(){
// do something
}
While you could, in theory, create something like this, it would have be interestingly done. For example, let's say you want to install Jory's banner rotator code. You'd go to his (your?) page and you'd see something like so:
Code:
 
// these are Jory's codes
var Jory = {
BannerRotator: {
execute:function(){
// do some BannerRotator code here, I guess
}
},
DestroyYourBoard: {
execute:function(){
// put a code to destroy your board here
}
},
DecimateTheUniverse: {
execute:function(){
// you get the drift
}
},
BeReallyCool: {
execute:function(){
// indeed
}
}
}
Now this is keeping your Name.Code.execute syntax intact, we could also just make the code name the function itself:
Code:
 
var Jory = {
BannerRotator:function(){
// do some banner rotation here.... woooot!
},
DestroyYourBoard:function(){
// and so on
},
DecimateTheUniverse:function(){
// ... do I even need this here anymore? :O
},
BeReallyCool:function(){
// yep.
}
}
That is a possibility as well, which makes the name itself also the function (i.e. to run the banner rotator, we would do Jory.BannerRotator())

Now this would install all of the user's codes and from there you could activate the ones you needed, which would solve the problem, I suppose. The only problem is making this fall linearly (I guess?) like this. If you search for a code, it would have to direct you to that user's page where you would get all of the user's codes and then activate the one code you need.

JavaScript is an interesting language and even this syntax usage would not prevent all code conflicts. There are some systems that just aren't compatible for a multitude of reasons. For example, the thunder arcade and the AIO. Try debugging why those two won't work together; good luck. I don't think the two share any variables either, as I believe all of the AIO's variables, for the most part, begin with aio_ . There are some issues that are inherently difficult to fix.

The plug-in database is a good idea, though, if you could manage to get everything to work in unison. That, I am afraid, would be quite the challenge.
Offline Profile Quote Post
Plug-in System · ZetaBoards Discussion