Page 1 of 1

Automatic Piece Movement

PostPosted: March 10th, 2016, 3:23 am
by bnorling
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

Re: Automatic Piece Movement

PostPosted: March 10th, 2016, 2:55 pm
by DrNostromo
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.

Re: Automatic Piece Movement

PostPosted: March 11th, 2016, 3:30 am
by bnorling
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.

Re: Automatic Piece Movement

PostPosted: March 11th, 2016, 3:31 am
by bnorling
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?