I am trying to create an extension that uses a custom java class. The class will add
four new dice buttons to the chat window. See image below. I created the class in my module (VASL) and it was working from within VASL.
Using other VASL extensions as a model, I created an extension that appears, to my eye at least, to be structured exactly the same as they are. However it is not working. I have the created a link to the extension, SASLDice.vmdx, as I cannot attach it to this message.
It is pretty straightforward, a buildFile and then the compiled classes.
Is there an obvious reason why this isnât working? When I run VASL, I get a chat message that the SASLDice extension is loaded but it shows version 0.0 rather than version 1.0 which suggests to me that it isnât working properly. And, of course, the buttons arenât showing up.
Thanks for any help you might be able to give. I have gone through the Forum looking for extensions issues and have not found any that provide help.
Every extension that I opened contained a buildFile not a buildFile.xml. I thought that was how it was supposed to be. I will use buildFile.xml from now on.
Happy to create it using VASSAL but how do I add the compiled code classes from within VASSAL?
When I tried to use Import A Custom Class all that did was create a buildFile reference to the SASLDice.java file in VASL. The extension âworkedâ but only because the source code was in VASL, which sort of defeats the purpose.
You need top open the extension vmdx with a Zip utility and manually copy the compiled SASLDice classes in, as you would do for a module. The âImport custom classâ just gives you access to custom code that is already in the extension.
Modules and extensions saved with 3.5.0 onward use buildFile.xml instead of buildFile. The latter will still work, but seeing that is what tipped me off that this new extension hadnât been created by saving it in Vassal.
I seem to be making some progress. I have rebuilt the extension by saving it as an empty extension in vassal then copy-pasting the code file as per Brent and finally editing the buildFile.xml created by VASSAL.
As a result the extension now loads. Unfortunately, it is loading an earlier version of the code file. I cannot imagine where it is getting this from.
I wrote the code file as a class in my local vasl dev version. I then built it with Maven. That gives me two sources for the compiled code file: (1) in the target folder the build process creates a classes folder which has the necessary sub-folders and compiled class file; (2) I can extract the compiled class from the .jar file. Either way, I can then use 7-zip to get the files into the extension.
And I end up with an extension running week old code that I have long since deleted. Where it is finding it, I donât know.
Next step is to repeat the entire process using different names for everything to see I can rid myself of this troublesome code.