Create account / Log in

Automatic Piece Movement

Topics related to the main Vassal engine.

Moderators: Tim M, uckelman

Automatic Piece Movement

Postby bnorling » March 10th, 2016, 3:23 am

I am developing a game in which a large number of pieces need to be moved each turn, in a very predictable way. I am trying to automate this and am trying figure out how. This is what I have so far:

I use a move counter. I have a large number of regions on the board with a name like spot1 spot2 spot3, etc..
The pieces that need to move have a "move to location" trait that combines "spot" with the current move counter. I.e. spot3
I guess this uses basic concatenation and I only stumbled across it by trial and error.

This works, but I have a few more requirements and it doesn't work on pieces that the players use. Is there a way to take a piece's current location, like spot3, and separate the "spot" and the 3, increment the 3 to 4, and put it back together? So, if a piece is on spot3, it will be moved to spot4. I need this to work on a couple different tracks so it will be like tracka1, tracka2 and trackb1 and trackb2, etc....

Thanks,


Ben
bnorling
 
Posts: 4
Joined: March 10th, 2016, 2:25 am

Re: Automatic Piece Movement

Postby DrNostromo » March 10th, 2016, 2:55 pm

I believe the way to do this would have your "send to locations" set to send to spot$SpotNumber$. Your pieces can have a "dynamic property" for the value SpotNumber and you would send a command to the pieces to increment the SpotNumber by 1 and then send them to the new location.

You could probably use some variation of this concept.
User avatar
DrNostromo
 
Posts: 1034
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: Automatic Piece Movement

Postby bnorling » March 11th, 2016, 3:30 am

I've made progress. So I have several "tracks".. A piece placed in the track should advance by one location (irregular grid) when a key is pressed or something. It should also "loop" as the tracks go round and round. I've started using zones to differentiate between the zone and the location within the zone, but it seems I can't use the same region names in different zones.
bnorling
 
Posts: 4
Joined: March 10th, 2016, 2:25 am

Re: Automatic Piece Movement

Postby bnorling » March 11th, 2016, 3:31 am

Also, this would all be a lot easier if I could cut up strings.. Is there any way to do that without writing an extension?
bnorling
 
Posts: 4
Joined: March 10th, 2016, 2:25 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron