Not a configurable ?

I am trying to develop a new kind of trait for counters. I read the tutorial, and tried to apply it (right now, my trait is a dumbed-down version of SendToLocation).

I compiled it with the latest trunk (svn rev. 4132). When trying to open it (with rev. 4132) (open a module, go to some piece, import EUROPA.Teleport), I get (instead of the SimplePieceEditor I expect) “Not a Configurable”. Did I miss something again?

Code sample:

public class Teleport extends Decorator implements TranslatablePiece {...}

This happens also when trying to add MyCounterFactory to the module:

[code]package EUROPA;

import VASSAL.build.module.BasicCommandEncoder;
import VASSAL.counters.GamePiece;
import VASSAL.counters.Decorator;

public class MyCounterFactory extends BasicCommandEncoder {
public Decorator createDecorator(String type, GamePiece inner) {
Decorator piece = null;
if (type.startsWith(Teleport.ID)) {
piece = new Teleport(type,inner);
}
else {
piece = super.createDecorator(type,inner);
}
return piece;
}
}[/code]

And the head of my buildFile is (I checked twice):

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <VASSAL.launch.BasicModule VassalVersion="3.0.17" name="Europa Universalis 8" version="0.1"> <EUROPA.MyCounterFactory/> <VASSAL.build.module.Documentation>

PS: If this post is misplaced, please move it to the right subforum…

In fact, I get an error when trying to open Zapwars.mod :

Java.lang.AbstractMethodError at VASSAL.build.AbstractConfigurable.add(AbstractConfigurable.java:140) at VASSAL.build.Builder.build(Builder.java:76) at VASSAL.build.AbstractBuildable.build(AbstractBuildable.java:68) at VASSAL.launch.BasicModule.build(BasicModule.java:136) at VASSAL.launch.BasicModule.build(BasicModule.java:101) at VASSAL.build.GameModule.init(GameModule.java:765) at VASSAL.launch.EditModuleAction.loadModule(EditModuleAction.java:49) at VASSAL.launch.Editor.launch(Editor.java:89) at VASSAL.launch.Launcher$1.run(Launcher.java:131) ...
So I guess the bug is elsewhere (in svn trunk).

Thus spake “jcdubacq”:

No, the ZapWars module hasn’t been updated to work with 3.1 yet.

The problem you’re having is that MyCounterFactory is not a Configurable.
The reason for this is that you don’t implement Configurable or any
subinterface of Configurable, nor does MyCounterFactory’s parent class.

In order to make this work, you should either (1) implement Configurable
directly, (2) make AbstractConfigurable the parent class of MyCounterFactory,
or possibly, (3) make a subclass of AbstractConfigurable which has a
MyCounterFactory as a member.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I guess that updating the FAQ is in order, I just copied from it. Are there any examples of a simple “custom trait” working with 3.1 somewhere?

After browsing the source a bit more, MyCounterFactory should not need to be a Configurable (I do not want to introduce anything below it, I just want to insert it). Maybe I misunderstood how to build a custom trait, but if I just change the BasicCommandEncoder to MyCounterFactory in the buildFile and I add the classes (as EUROPA/MyCounterFactory.class and EUROPA/Teleport*.class) to the zip file, the custom trait does not appear in the list.

However, if I put a Teleport string in one of the counters, the Teleport trait appears correctly. For me, this fixes the thing (I build the buildFile manually anyway, so I just need to have one test piece). Thank you for your help.

Custom Command Encoders do not need to be Configurable, but in that case, cannot be added to the module using Import. They can only be added by manually editing them into the buildFile.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)