Create account / Log in

Undo Specific Move Capability

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

Undo Specific Move Capability

Postby RedMike » March 19th, 2012, 8:35 pm

Is there a way to undo a specific move not necessarily the last move ? This is for pbem games.

I want to know if there's a stock built in way to do it, or if it can be done with a custom class ?

Appreciate any help along these lines.
RedMike...out
RedMike
 
Posts: 18
Joined: May 2nd, 2009, 8:10 pm

Re: Undo Specific Move Capability

Postby uckelman » April 23rd, 2012, 11:56 pm

Thus spake RedMike:
> Is there a way to undo a specific move not necessarily the last move ?
> This is for pbem games.

Presently, no. VASSAL 4 might have this capability, insofar is it's
possible to do it sensibly. (There are certain sorts of moves where
it's not clear what the result of undoing them should be. For example,
suppose you move a piece from A to B, then from B to C. The result of
undoing the undoing the first move only seems ill-defined.)

--
J.
User avatar
uckelman
Site Admin
 
Posts: 8138
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Undo Specific Move Capability

Postby RedMike » April 24th, 2012, 4:00 am

I was thinking about the possibility of writing a custom class that would save a units starting position and would enable a unit to return back to it's start hex. I'm not a java man so I don't know how to accomplish this function off the top of my head. Perhaps someone who is saavy in java could help.
RedMike...out
RedMike
 
Posts: 18
Joined: May 2nd, 2009, 8:10 pm

Re: Undo Specific Move Capability

Postby irishwulf » April 24th, 2012, 10:33 am

You can do this without a custom class. Store the system properties CurrentX and CurrentY in dynamic properties, say 'myStartX' and 'myStartY', and use the Send To Location trait to return the piece to those coordinates.

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

Re: Undo Specific Move Capability

Postby RedMike » April 24th, 2012, 3:13 pm

I'll try that, thanks!
RedMike...out
RedMike
 
Posts: 18
Joined: May 2nd, 2009, 8:10 pm

Re: Undo Specific Move Capability

Postby RedMike » April 27th, 2012, 4:51 am

irishwolf,

I'm having a hard time trying to figure out how to do this. Can you give me an example ?

I made a protoype that had two Dynamic Properties, one called startX and the other called startY.

I assigned then a value of CurrentX and CurrentY respectively.

I then added a Send to Location that is supposed to return the piece to it's original hex but it gives me a bad data in module message, the value is not a number and sends the unit to the 0,0 hex coordinate. The map uses an alpha-numeric hex grid too by the way.

I tried enclosing CurrentX and CurrentY in $ signs but when I do that it auto defaults the values to zero.

Regards,
RedMike
RedMike...out
RedMike
 
Posts: 18
Joined: May 2nd, 2009, 8:10 pm

Re: Undo Specific Move Capability

Postby irishwulf » April 30th, 2012, 4:11 pm

Mike,
I've never worked with hexes, and so I don't know the answer to your problem. Some debugging tips:
1) See what Vassal thinks CurrentX and CurrentY are with Report Action.
2) See what Vassal thinks startX and startY are with Report Action.
3) Try to get Send to Location to work by manually entering a specific grid location.
irishwulf
 
Posts: 243
Joined: December 17th, 2011, 4:29 am


Return to Module Design

Who is online

Users browsing this forum: No registered users and 0 guests