## Beam me up, Scottie

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

patoace
Dragon
Posts: 313
Joined: Mon Sep 24, 2007 6:10 pm
Location: Rancagua - Chile

### Beam me up, Scottie

Please check this reply in this same thread for an updated version of this macro with the same functionallity. It no longer needs tables!

This short macro can be dropped in any campaign to transport all your PC tokens between maps, with a few clicks.

All it needs is a table called "Mapa" with this format:

Code: Select all

``Range     Value[number]  [mapName],[x coordinates],[y coordinates]``

ie

Code: Select all

``Range    Value1          Sandpoint,10,452          Varisia,140,853          Magnimar,11,134``

This is the macro

Code: Select all

``[h,code:{[abort(isGM())][in=0 ][Lst=""][while(tbl("Mapa",in)!=tbl("Mapa",in+2)),code:{   [in=in+1]   [Lst=Listappend(Lst,listGet(tbl("Mapa",in),0))]}][bla=input("map|"+Lst+"|Destino|Radio")][abort(bla)][map=map+1][Dest=listGet(tbl("Mapa",map),0)][x=listGet(tbl("Mapa",map),1)][y=listGet(tbl("Mapa",map),2)][foreach(in,getPC()),code:{[moveTokenToMap(in, Dest, x, y)][x=x+1]}]}]Todas las fichas transportadas al mapa "[r:Dest]"``
Last edited by patoace on Tue Aug 31, 2010 10:34 am, edited 1 time in total.

PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

### Re: Beam me up, Scottie

I get the following error.

Code: Select all

``  Invalid condition in WHILE(tbl("Mapa",in)!=tbl("Mapa",in+2)) roll option.       Statement options (if any): while(tbl("Mapa",in)!=tbl("Mapa",in+2)),code       Statement Body : { [in=in+1] [Lst=Listappend(Lst,listGet(tbl("Mapa",in),0))] }``
I am a special snowflake!

patoace
Dragon
Posts: 313
Joined: Mon Sep 24, 2007 6:10 pm
Location: Rancagua - Chile

### Re: Beam me up, Scottie

I'm sorry to hear that.

It seems the macro can't find the "Mapa" table, can you upload the campaign file?

nortonweb
Cave Troll
Posts: 70
Joined: Tue Apr 07, 2009 8:19 pm

### Re: Beam me up, Scottie

Bit of a tweak. This moves the selected tokens to the visible map from a select drop down. You enter the x and y of where you want to go.

You can jump on the same map or onto a new map.

For every extra token the x is increased by 1. This is from patoace's code. I guess it could be clever and try to keep a formation by looking at the group set up first but that would take too much brain power for 5.30pm at work

Code: Select all

``[h:abort(isGM())][H:bla=input("mapName|"+getVisibleMapNames()+"|Destino|LIST|value=string", "x|0|X loc|TEXT|WIDTH=4", "y|0|Y Loc|TEXT|WIDTH=4")][h:abort(bla)][h:Dest=mapName][h: ids = getSelected()][h,if(getCurrentMapName()==Dest),code:{[h,foreach(idHere,ids),code:{[h:moveToken(x, y,0,idHere)][h:x=x+1]}]};{[h,foreach(idHere,ids),code:{[h:moveTokenToMap(idHere, Dest, x, y)][h:x=x+1]}]}]moved``

patoace
Dragon
Posts: 313
Joined: Mon Sep 24, 2007 6:10 pm
Location: Rancagua - Chile

### Re: Beam me up, Scottie

Interesting

Your approach has the advantage of not requiring a table to store the coordinates, but in the other hand, it's hard to remember the "entry point" for every map.

I'll adopt the abilities to move a token in the same map, which then takes me to think of having several entry points for the same map (tavern and town square for instance). Also, I'll add the function to to transport or move selected tokens only, but stating that if there are none selected, the macro affects all PCs.

Code: Select all

``[h,code:{[abort(isGM())][tokenId=if(getSelected()=="",getPC(),getSelected())][tokenNm=""][foreach(in,tokenId):tokenNm=listappend(tokenNm,getName(in))][Lst=""][in=0][while(tbl("Mapa",in)!=tbl("Mapa",in+2)),code:{   [in=in+1]   [Lst=Listappend(Lst,listGet(tbl("Mapa",in),0))]}][bla=input("Fichas|"+tokenNm+"||Label","map|"+Lst+"|Destino|Radio")][abort(bla)][map=map+1][Dest=listGet(tbl("Mapa",map),0)][x=listGet(tbl("Mapa",map),1)][y=listGet(tbl("Mapa",map),2)]}][if(getCurrentMapName()==Dest),code:{   [h,foreach(in,tokenId),code:{[moveToken(x, y,0,in)][x=x+1]}]   [r:tokenNm] movido(s) a [r:Dest]   };{   [h,foreach(in,tokenId),code:{[moveTokenToMap(in, Dest, x, y)][x=x+1]}]   [r:tokenNm] llevado(s) al mapa [r:Dest]}]``

PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

### Re: Beam me up, Scottie

Works like a charm.
Thanks to you both.
I am a special snowflake!

patoace
Dragon
Posts: 313
Joined: Mon Sep 24, 2007 6:10 pm
Location: Rancagua - Chile

### Re: Beam me up, Scottie

PinkRose wrote:Works like a charm.
Thanks to you both.

The latest 1.3b60 comes with the setCurrentMap() of evident interes for this macro. This version, once the token are moved to the new map, changes the current map and centers the image in the destination.

[h,code:{
[abort(isGM())]

[tokenId=if(getSelected()=="",getPC(),getSelected())]
[tokenNm=""]
[foreach(in,tokenId):tokenNm=listappend(tokenNm,getName(in))]
[Lst=""]
[in=0]
[while(tbl("Mapa",in)!=tbl("Mapa",in+2)),code:{
[in=in+1]
[Lst=Listappend(Lst,listGet(tbl("Mapa",in),0))]
}]

[bla=input(
"Fichas|"+tokenNm+"||Label",
)]

[abort(bla)]
[map=map+1]

[Dest=listGet(tbl("Mapa",map),0)]
[x=listGet(tbl("Mapa",map),1)]
[y=listGet(tbl("Mapa",map),2)]
}]

[if(getCurrentMapName()==Dest),code:{
[h,foreach(in,tokenId),code:{
[moveToken(x, y,0,in)][x=x+1]
}]
[r:tokenNm] movido(s) a [r:Dest] [goto(x,y)]
};{
[h,foreach(in,tokenId),code:{
[moveTokenToMap(in, Dest, x, y)][x=x+1]
}]
[r:tokenNm] llevado(s) al mapa [r:setCurrentMap(Dest)] [goto(x,y)]
}]

PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

### Re: Beam me up, Scottie

Hey Code Monkeys,

1. Can the formation of the selected tokens be saved when they teleport?
2. Can we apply a name to the teleport location, instead/in addition to the map?
So that way we can teleport to specific destinations on the same map easily?

I am a special snowflake!

patoace
Dragon
Posts: 313
Joined: Mon Sep 24, 2007 6:10 pm
Location: Rancagua - Chile

### Re: Beam me up, Scottie

The first request, I guess it can be done, but it's too hard for my macro ranks. The second one, is just a label for the input dialog, and it can be implemented via a fourth parameter in the "maps" table, and changing this

Code: Select all

``[Lst=Listappend(Lst,listGet(tbl("Mapa",in),0))]``

to this

Code: Select all

``[Lst=Listappend(Lst,listGet(tbl("Mapa",in),3))]``

Now your "map" table should look like this

Code: Select all

``Range   Value1       Sandpoint, 83,11, Sandpoint Church2       Sandpoint, 130,52, Sandpoint Tavern3       Dungeon, 0, 0, Dungeon``

CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

### Re: Beam me up, Scottie

Hmm... first request would require...

a) select a reference token.

b) calculate x/y-offset for any token to reference token and store it somewhere (on a lib:token?), store offset 0/0 for reference token.

c) place any token to the new place considering the stored offset.

Doesn't sound too complicated ... if I find the time, i'll give it a shot. Cant promise anything, though :-/

PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

### Re: Beam me up, Scottie

patoace, thank you very much.
For the help here and for the involvement in the community in general.

Instead of exact formation, would it be easier to at least form them in a group?
A 3x2 or 2x3 block of adventurers would fit much better on most maps then a 1x6 column of adventurers.

Doesn't sound too complicated

Thanks for looking into it CoveredInFish.
Last edited by PinkRose on Thu Dec 03, 2009 4:38 am, edited 1 time in total.

CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

### Re: Beam me up, Scottie

Okay, done it. Seems to work fine. Destination-Table should have 4 values (Map, x, y, Label).

EDIT: removed buggy code. You find fixed version below.
Last edited by CoveredInFish on Mon Jan 04, 2010 5:29 am, edited 2 times in total.

lmarkus001
Great Wyrm
Posts: 1864
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

### Re: Beam me up, Scottie

Just sharing in case they were missed... I have two ways of moving tokens in the generic toolset linked below...

PinkRose
Dragon
Posts: 732
Joined: Sat Nov 15, 2008 2:28 pm
Location: The City of Roses, Oregon

### Re: Beam me up, Scottie

I'm getting this error now.

Code: Select all

``   Roll option list can't end with a comma.       Statement options (if any): r if(getCurrentMapName()==Dest),code       Statement Body (first 200 characters): { [h,foreach(in,tokenId),code:{ [h: jsonOffset = json.get(jsonAllOffsets, in)] [h: xOffset = json.get(jsonOffset, "x")] [h: yOffset = json.get(jsonOffset, "y")] [m ``
I am a special snowflake!

CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

### Re: Beam me up, Scottie

Darn ... a typo. How could that happen? I guess copy-paste is NOT idiot-proof.

replace this

Code: Select all

``[r if(getCurrentMapName()==Dest),code:{``

with this (note the missing ,)

Code: Select all

``[r,if(getCurrentMapName()==Dest),code:{ ``

Hope thats the only one ...