Programming tutorial - MyCounterFactory.class

So I’d like to take a shot at making a custom counter trait to resolve nested variable references and store the results in a named local property, because I think that would be really awesome. For the same module, I have successfully implemented a custom class partially cannibalized from in the programming tutorial, but I haven’t had any luck with Using the classfile provided with the tutorial in zap/MyCounterFactory.class, and setting the third line of the buildfile (in TextPad) to:
, I get an ‘error building zap.MyCounterFactory’ when opening the module for editing. Is the process described in the tutorial still valid for 3.1.17? Further, I must admit that there are some methods described in the tutorials the functions of which I don’t /really/ understand. Who is the best person to direct my questions about custom classes to?


yeah - Im not surprised. We do have a problem with that stuff, theres a bug with the Zap tutorial stuff (can’t find it at the moment) :slight_smile:

What you might want to do is try this instead (a custom command encoder that extends BasicCommandEncoder)

example that adds two traits in my module:

public class CCCommandEncoder extends BasicCommandEncoder {

public Decorator createDecorator(String type, GamePiece inner) {
if (type.startsWith(CalculatedProperty.ID)) {
return new CalculatedProperty(type, inner);
else (type.startsWith(CCInfo.ID)) {
return new CCInfo(type, inner);
return super.createDecorator(type, inner);

Thank you, Tim, I’ll give that a shot. It’s nice to start with something that already works!