How to create your own Expert Lotto plugins

How to create your own Expert Lotto plugins

Postby stan » Sun Jan 12, 2025 6:41 pm

Download & install
- download and install the latest version of JDK (java.oracle.com)
- download and install the latest version of NetBeans IDE from http://www.netbeans.org
- download and install the latest version of Expert Lotto 5

Setup reference libraries in NetBeans
- start NetBeans and click menu 'Tools - NetBeans Platforms'
- click 'Add Platform' and browse the folder with Expert Lotto 5 installation
- click button 'Next'
- enter 'el5-release' into 'Platform name' field and click 'Finish' button

The steps above define which version of Expert Lotto the plugins will be developed against.
When a new version of Expert Lotto is released which adds new methods or classes to its public API
then you should start Expert Lotto from the installation folder above, click menu 'Help - Check for updates'
to download and apply application updates. If you then start Netbeans IDE the new methods and classes will
be available in module classpath and you can call the new methods or classes.

It is possible to setup more than one Expert Lotto platform. For example you can download and install
a development build of Expert Lotto 5 (see the tutorial at our web site) and develop your plugins against
the development version of Expert Lotto. However the development version of Expert Lotto may have some new
methods and/or classes which are not available in the latest official release yet. So the plugins built
against the development version of Expert Lotto will not work in the latest official release of Expert Lotto.

Download Expert Lotto API javadoc:https://expertlotto.com/files/javadoc.zip

Download and install Expert Lotto API support plugin
- download this file: https://expertlotto.com/files/com-expertlotto-apisupport.nbm
- run NetBeans and click menu 'Tools - Plugins'
- switch to 'Downloaded' tab and click 'Add Plugins' button
- browse the downloaded file and let the wizard install the plugin
This plugins adds new items into NetBeans 'New File' wizard - you can easily create skeleton files for various
ticket filters and/or ticket analyzers.

Create a new project for your plugins
- run NetBeans
- click menu 'File - New Project'
- select 'NetBeans Modules' category and 'Module Suite' project
- pick a project name, e.g. 'my plugins' and the location for module source files on your disk.
(I recommend module names without space characters)
- in 'NetBeans platform' combo box select 'el5-release' platform created above
- click 'Finish' button
The steps above just created a placeholder for a collection of additional Expert Lotto modules. Each module
in the collection can provide additional filters, analyzers, top-level window or any other extensions.
One of the advantages of the collection of modules (i.e. 'module suite' in NetBeans terms) is that it
can generate a list of plugins in the suite which Expert Lotto users can add to their Plugin Managers
and then conveniently download and install new modules from the suite or update already installed modules -
the same way as automatic updates of Expert Lotto's main libraries.
If you right-click 'my plugins' node in 'Projects' window you can choose 'Create NBMs' from popup menu,
it will build all modules in the suite and generate the auto-update xml. See the content of 'build/updates'
folder in your project folder. You can upload this updates folder to our web site and tell your users to
install your plugins using this updates xml.
(Note - intially the updates folder will be empty until you add a new module into the suite)

Create a new plugin
- run NetBeans and make sure your 'my plugins' suite project is opened
- click menu 'File - New Project'
- select 'NetBeans modules' category and choose 'Module' project, click button 'Next'
- enter 'Project Name', e.g. 'my first module' and choose 'Add to module suite' and pick the suite you
created in the steps above. Click button 'Next'
- pick a 'code name base', it is some sort of module ID which identifies it in the module suite, usually it
is the name of the main module package, e.g. 'myplugins.testing.myfirstmodule'
- click 'Finish' button
Now you have just created an empty Expert Lotto module. If you click menu 'Run - Run Project', NetBeans will
compile the module and run your Expert Lotto installation with that module. If you click menu 'Tools - Plugins'
in the running Expert Lotto you'll see your new module listed under 'Installed' tab.

Add a new Expert Lotto extension
- run NetBeans and make sure the plugin project created above is opened and selected in 'Projects' window
- click menu 'File - New file'
- select 'ExpertLotto' category and choose 'Analyzer or Evaluator' file type. Click button 'Next'
- in the next step select 'IndexEvaluator' in filter type to add another column to Expert Lotto's Package
Properties and Winning Numbers Properties windows
- enter e.g. 'just testing' into display name and some text into 'short description' fields. The entered
text will be presented to Expert Lotto users when selecting columns for those two windows in Expert Lotto
stats options
- click button 'Next'
- in the next step choose class name prefix, e.g. 'MyTest' and click button 'Finish'
- the API support wizard will generate two files for you - MyTestIndexEvaluator.java and
MyTestIndexEvaluatorFactory.java
- note that some methods throw new UnsupportedOperationException - you must implement those method bodies.
Let's make an extension adding another 'odd/even' column to statistical properties windows
- in the 'factory' class implement getIndexSize() as follows:
private int getIndexSize( TicketConfig config ) {
return config.getMainNumberCount()+1;
}
this method says how many possible unique values the column in statistical table will have. In our case it
is the count of main ticket numbers + 1, because we will be showing the ratio of odd/even numbers
(0:6, 1:5, 2:4, 3:3, 4:2, 5:1, 6:0)
- in the evaluator class you need to implement toIndex and toValue methods as follows:
protected int toIndex(TicketNumbers tn) {
int oddCount = 0;
for( int i=0; i<tn.getMainNumberCount(); i++ ) {
if( tn.isMaskedAt(i) )
continue;
oddCount += tn.getNumberAt(i) % 2;
}
return oddCount;
}
(simply count the odd numbers in the ticket)

protected Comparable toValue(int index) {
return ValueSupport.ratio(index, getTicketConfig().getMainNumberCount()-index);
}
(show the given index (0 to 6) as a pair of numbers, e.g. 0 -> "0:6", 1 will convert to "1:6" etc

Now you can run your project and Expert Lotto will show this extra column in Package Properties and
Winning Numbers Properties windows.

Also, if you build updates for your whole module suite, you'll see that .nbm file was created and the
updates.xml points to your new module.

Important: Whenever you add new extensions to an existing module or just fix a bug in a module, you
must update module version number so that your users will see it as a module update. Otherwise the plugin
manager in Expert Lotto would think it is still the same, unchanged module.
To increment module version number, right-click the module node in Projects window and select 'Properties'
from its context menu. In the properties window select 'API versioning' and change 'specification version'
from e.g. 1.1.0 to 1.1.1

You will need to study Expert Lotto API javadoc and example source code (expertlotto.com/files/examples_src.zip)
to see which extensions can be created and how to implement them.
Expert Lotto Team
User avatar
stan
Site Admin
 
Posts: 6385
Joined: Thu Sep 23, 2004 1:01 pm

Re: How to create your own Expert Lotto plugins

Postby stan » Sun Jan 12, 2025 6:44 pm

If you have any problem/question when developing your plugins please start a new thread here so others can learn from your mistakes and/or advise a solution to your problem.
Expert Lotto Team
User avatar
stan
Site Admin
 
Posts: 6385
Joined: Thu Sep 23, 2004 1:01 pm

Re: How to create your own Expert Lotto plugins

Postby sjontori » Tue Jan 28, 2025 12:45 am

Hi Stan

I am interested in developing plug-ins

I am having trouble downloading the javadoc.zip and the com-expertlotto-apisupport.nbm files.

Would you be able send these files?
Thank you

Sjontori
sjontori
 
Posts: 24
Joined: Tue Nov 11, 2014 8:37 am

Re: How to create your own Expert Lotto plugins

Postby stan » Tue Jan 28, 2025 9:43 am

I fixed the links in my previous post, please try again.
Expert Lotto Team
User avatar
stan
Site Admin
 
Posts: 6385
Joined: Thu Sep 23, 2004 1:01 pm

Re: How to create your own Expert Lotto plugins

Postby rol24 » Wed Jan 29, 2025 1:43 pm

stan wrote:I fixed the links in my previous post, please try again.


Thanks a lot Stan, I'll take a look at this, it would be very useful to be able to create new or more customized filters for expert lotto.
rol24
 
Posts: 53
Joined: Mon Aug 19, 2024 1:01 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests