Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Select a token

Hello, i would like to select a token but i don't manage The ID Token is MNAsc9snpZdEtdyNWPt Can someone write the script for me please ? Same thing for moving the token to the left  thanks Bye
1616680542
The Aaron
Roll20 Production Team
API Scripter
The API can't affect the User Interface for a Player.  You can think of the API as another player off in the cloud—other players can't change what you have selected either. You can move tokens by id using TokenMod: !token-mod --set left|-3g --ids @{target|token_id}
OK thanks i'm novice the ID token is MNAsc9snpZdEtdyNWPt so i type         !token-mod --set left|-3g --ids @{target| -MWdTupzoT2Uhz6cB-t8 }       is it good ?
1616681399
The Aaron
Roll20 Production Team
API Scripter
It would be like this: !token-mod --set left|-3g --ids -MWdTupzoT2Uhz6cB-t8 Note that a Token's ID is unique to that specific instance of the token.  If you copy/paste it, or delete it and drag in a new one, it will have a new ID. If you're just setting up something like opening a door on the map, the above will definitely work.  If you're building something reusable, you'll need to do some other things.
1616682317
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If you did want to target a token, you could use this: !token-mod --set left|-3g --ids @{target|token_id} Then you could move any token you target. Note that unless the gm of the game has set the configuration of token-mod to allow players to use IDs, only a GM can use the command.
OK thanks i tried with       !token-mod --set left|-3g --ids  MNAsc9snpZdEtdyNWPt MNAsc9snpZdEtdyNWPt      is the good ID but it doesn't work,  what is missing ? what didn't i ? thanks
1616682749
David M.
Pro
API Scripter
The token_id might be missing a leading dash ("-MNAsc...")?
1616682811
The Aaron
Roll20 Production Team
API Scripter
The - is part of the ID.
no i tried with an other token      -MNAsc9snpZdEtdyNWPt and it doesn't work
1616683018
The Aaron
Roll20 Production Team
API Scripter
1) do you have TokenMod installed? 2) Does the command with @{target|token_id} work?
yes it works : i have to select a target so i click on a token and nothing happens
1616683477
The Aaron
Roll20 Production Team
API Scripter
What version of TokenMod does it show in the API Console?
latest
i tried with 0.8.64 :    same problem
1616684362

Edited 1616684436
The Aaron
Roll20 Production Team
API Scripter
Ok, just to be completely sure, you see a line like this in the API Output Console: "-=> TokenMod v0.8.64 <=-  [Fri Feb 19 2021 04:55:16 GMT+0000 (Coordinated Universal Time)]" Select a token and run this command: !token-mod --set statusmarkers|blue:3 Does it add a blue status marker with a 3 on it? Also, you have a handout in the journal named "Help: TokenMod" ?
i see this line : "No existing sandbox found.  Preparing sandbox to start on game activity."       in the API output console (for all the scripts i installed) and the command doesn't work 
1616684825

Edited 1616684879
The Aaron
Roll20 Production Team
API Scripter
Ok.  In a separate tab, open the game.  On the API Scripts page, click "Restart API Sandbox".  Make sure you see that TokenMod v0.8.64 line show up. Verify that you have a tab named TokenMod: If you already had the game tab open, refresh it.   You may as well refresh the API Scripts tab while you're at it.
Sorry it works it's my own fault i was not on the same game between the game and API settings window Thanks another question : where can i find the DECK IDs and can tou make me a script for putting on the table 3 cards from a specified deck ? in any case you're very nice to help me thanks a lot
1616685300

Edited 1616685507
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There is a script available in the One Click installation called Dealer that will deal cards to players, but it doesn't deal to the table.
1616685820
The Aaron
Roll20 Production Team
API Scripter
Great!  
is there a command to put some cards  on the table  ?!
1616688479
The Aaron
Roll20 Production Team
API Scripter
There is an api function, but last I checked it was somewhat buggy.
you can send me a link ?
1616688911
The Aaron
Roll20 Production Team
API Scripter
Yes.&nbsp; Note that this is about the functions the API can call, not a script for people to use. A script would still need to be created: <a href="https://app.roll20.net/forum/post/6223396/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6223396/slug%7D</a>
OK thanks
i found this :&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; !token-mod --move 5850 --ids (token_id) positive or negative moves the token&nbsp; up or down&nbsp; but how to move left or right ?
With this one :&nbsp; &nbsp; &nbsp;&nbsp; !token-mod --set left|-3g --ids @{target|token_id} how to move down, up, and right ?
1616691651
The Aaron
Roll20 Production Team
API Scripter
All of this is covered in the help document in your Journal. Move Use&nbsp; --move &nbsp;to supply a sequence of move operations to apply to a token. By default, moves are relative to the current facing of the token as defined by the rotation handle (generally, the "up" direction when the token is unrotated). Each operation can be either a distance, or a rotation followed by a distance, separated by a pipe&nbsp; | . Distances can use the unit specifiers ( g , u , ft ,etc -- see the&nbsp; Numbers &nbsp;section for more) and may be positive or negative. Rotations can be positive or negative. They can be prefaced by a&nbsp; = &nbsp;to ignore the current rotation of the character and instead move based on up being 0. They can further be followed by a&nbsp; ! &nbsp;to also rotate the token to the new direction. Moving 3 grid spaces in the current facing. !token-mod&nbsp;--move&nbsp;3g Moving 3 grid spaces at 45 degrees to the current facing. !token-mod&nbsp;--move&nbsp;45|3g Moving 2 units to the right, ignoring the current facing. !token-mod&nbsp;--move&nbsp;=90|2u Moving 10ft in the direction 90 degrees to the left of the current facing, and updating the facing to that new direction. !token-mod&nbsp;--move&nbsp;-90!|10ft Moving forward 2 grid spaces, then right 10ft, then 3 units at 45 degrees to the current facing and updating to that face that direction. !token-mod&nbsp;--move&nbsp;2g&nbsp;90|10ft&nbsp;=45!|3u --move is based on the facing of the token.&nbsp; It uses the direction of the rotation handle as the "forward" direction.&nbsp; So moving "left" and "right" can be achieved with (relative to facing): !token-mod --move 90|1g and !token-mod --move -90|1g or (relative to screen): !token-mod --move =90|1g and !token-mod --move =-90|1g
1616691739
The Aaron
Roll20 Production Team
API Scripter
All of this is covered in the help document in your Journal. Numbers Number values can be any floating point number (though most fields will drop the fractional part). Numbers must be given a numeric value. They cannot be blank or a non-numeric string. Available Numbers Properties: left top width height scale It's probably a good idea not to set the location of a token off screen, or the width or height to 0. Placing a token in the top left corner of the map and making it take up a 2x2 grid section: !token-mod --set top|0 left|0 width|140 height|140 You can also apply relative change using&nbsp; + ,&nbsp; - ,&nbsp; * , and&nbsp; / . This will move each token one unit down, 2 units left, then make it 5 times as wide and half as tall. !token-mod --set top|+70 left|-140 width|*5 height|/2 You can use&nbsp; = &nbsp;to explicity set a value. This is the default behavior, but you might need to use it to move something to a location off the edge using a negative number but not a relative number: !token-mod --set top|=-140
OK thans a lot&nbsp;