Create account / Log in

Programming tutorial - MyCounterFactory.class

Issues with the Vassal engine.

Moderators: uckelman, Tim M

Programming tutorial - MyCounterFactory.class

Postby irishwulf » January 27th, 2012, 5:32 am

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 Tension.java in the programming tutorial, but I haven't had any luck with MyCounterFactory.java. Using the classfile provided with the tutorial in zap/MyCounterFactory.class, and setting the third line of the buildfile (in TextPad) to:
<zap.MyCounterFactory/>
, 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?

-Seth
irishwulf
 
Posts: 243
Joined: December 17th, 2011, 4:29 am

Re: Programming tutorial - MyCounterFactory.class

Postby Tim M » January 27th, 2012, 2:15 pm

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) :)

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);
}
}
Tim,
Vassal Uber Geek/Guru

Problems? post your OS, Physical Mem, version of Vassal and Java plus the Module in question.
No developer can help with out that info, thx!
User avatar
Tim M
 
Posts: 1812
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Re: Programming tutorial - MyCounterFactory.class

Postby irishwulf » January 27th, 2012, 6:05 pm

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

Cheers,
Seth
irishwulf
 
Posts: 243
Joined: December 17th, 2011, 4:29 am


Return to Technical Support & Bugs

Who is online

Users browsing this forum: esparver73 and 2 guests