Order of operation for plugin

related to programming for xlobby, code samples, examples etc.

Order of operation for plugin

Postby WannaTheater on Tue Apr 07, 2009 12:30 pm

I posted a version of this in support, but thought I would ask a different version here:

I have a startup event that runs several events when XL starts. One of these modifies my movies database. How do I get XL to reread the database file that has been updated? I can't even find how to do it through the editor GUI. Is there a better way of doing this (i.e. I saw a thread about running a plugin when it is loaded. If I do this, WHEN is the plugin initialization run - someone said during splash... is this before the databases are read?)

Currently the only way I can see my changes is to restart XL.

Thanks!
WannaTheater
 
Posts: 235
Joined: Thu Aug 24, 2006 11:35 am
Location: Florida

Re: Order of operation for plugin

Postby Marbles_00 on Tue Apr 07, 2009 1:04 pm

If I do this, WHEN is the plugin initialization run - someone said during splash... is this before the databases are read?)

I'm going to answer your second question first...If you follow the info provided on most skins splash screens (if it is provided), you will see that the loading of plugins are one of the first things Xlobby will do. Then a little later during the loadup, it will load all the databases.



I have a startup event that runs several events when XL starts. One of these modifies my movies database. How do I get XL to reread the database file that has been updated? I can't even find how to do it through the editor GUI. Is there a better way of doing this (i.e. I saw a thread about running a plugin when it is loaded.


Hmm...here's a thought...maybe you could use XAnt. It has a rebuild database function, then you perform a refresh database. I wonder if you could modify the Xant moviestemplate.xml file to suit, set up the XAnt.ini file to suit, then rebuild any database to suit. I've only used the function to rebuild movies databases after I make a new entry, but I wonder if it would work for other databases as well.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Order of operation for plugin

Postby WannaTheater on Tue Apr 07, 2009 1:27 pm

Thanks Marbles. Good idea on checking the splash stats (I will with another skin). Dont think xAnt will work, because some of the my code fixes a deficiency with the DBs that xAnt creates. But here is some more detail...

I'm already using xAnt, and the plugin is generating about 5 XL databases. THEN I need to run code against those generated database (lots of logic in the code which is making decisions off certain tags to modify others, fix deficiency in xAnt/ANT). Once the modifications of these databases are complete, I try to "update database" (both from within the plugin, then also tried by hand in the GUI), but changes are not reflected in XL. From F2 database edit, I still see the "Pre-modified" tags, but opening the actual XL xml database files shows the POST-modified ... So how do I force XL to reread a database!

The odd thing is this all worked with XScriptNG... But as an engineer I needed cleaner code in plugin form :)

NOTE: Regarding the xAnt deficiency: I don't use the the "ANT format - amc?" for my ANT database. I use the xml format. For some reason, the ANT xml database represents carriage returns as vertical bars ("|"). This information is passed through by xAnt into XL databases, hence no carriage returns in my front end data. I would love to get the xAnt source to process everything there, but have not been able to :)
WannaTheater
 
Posts: 235
Joined: Thu Aug 24, 2006 11:35 am
Location: Florida

Re: Order of operation for plugin

Postby defrag on Tue Apr 14, 2009 11:33 am

I've a sneaky feeling the plugins are loaded alphbetically... but don't quote me on it. I remember asking Steven many many moons ago if we could manage the loading order. Try naming your plugin accordingly so it loads after the one you want to follow. You can but try.........
defrag
 
Posts: 376
Joined: Mon Jan 16, 2006 7:56 am
Location: Didcot, UK

Re: Order of operation for plugin

Postby P3rv3rt B3ar on Tue Apr 14, 2009 7:41 pm

if i remember correctly u can do it (generating of xml files) while xl loads (within constructor of your plugin class) just keep hoggin the thread til u r done so lobby wont try early read. But if thats incorrect... i can check xpert source to see how its done.
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Re: Order of operation for plugin

Postby WannaTheater on Tue Apr 14, 2009 8:51 pm

Thanks.... but how do you hog the thread? I thought you call a plugin, Xlobby suspends, plugin completes, XL continues?
WannaTheater
 
Posts: 235
Joined: Thu Aug 24, 2006 11:35 am
Location: Florida

Re: Order of operation for plugin

Postby P3rv3rt B3ar on Tue Apr 14, 2009 11:10 pm

Exactly right, thats how u hog it, just do your own stuff (processing the files and re-writing them) in effect blocking xl til u return (as opposite to creating a new thread for your stuff and returning the original right away)
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland