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

Gambling, Rat Race, Automated Token Movement

It is so close to working great. It's based on this thread:&nbsp; <a href="https://app.roll20.net/forum/post/11852786/macros-for-the-afterlife-casino-keys-from-the-golden-vault" rel="nofollow">https://app.roll20.net/forum/post/11852786/macros-for-the-afterlife-casino-keys-from-the-golden-vault</a> The script for the automatic token placement works great. The race works almost perfectly, but the tokens all move the same distance, and I can't for the life of me figure out what's going on. I'm guessing it's an interaction between ScriptCards and TokenMod in the way that it's written but I don't know enough about coding or the scripts to figure it out alone. !script{{ --#title|Infernal Rat Racing --=Peppercorn|1d8/3 {FLOOR} --=Viper|1d8/3 {FLOOR} --=Nightcap|1d6/3 {FLOOR} --=FSam|1d10/3 {FLOOR} --=Bailey|1d4/3 {FLOOR} --=Coddler|1d12/3 {FLOOR} --&amp;PID|@(Peppercorn.token_id) --&amp;VID|@(Viper.token_id) --&amp;NID|@(Nightcap.token_id) --&amp;FID|@(Flamenco Sam.token_id) --&amp;BID|@(Bailey.token_id) --&amp;CID|@(Coddler.token_id) --+Peppercorn| moves [$Peppercorn] Spaces --@token-mod| _move =90|[$Peppercorn]u _ids [&amp;PID] --+Viper| moves [$Viper] Spaces --@token-mod| _move =90|[$Viper]u _ids [&amp;VID] --+Nightcap| moves [$Nightcap] Spaces --@token-mod| _move =90|[$Nightcap]u _ids [&amp;NID] --+Flamenco Sam| moves [$FSam] Spaces --@token-mod| _move =90|[$FSam]u _ids [&amp;FID] --+Bailey| moves [$Bailey] Spaces --@token-mod| _move =90|[$Bailey]u _ids [&amp;BID] --+Coddler| moves [$Coddler] Spaces --@token-mod| _move =90|[$Coddler]u _ids [&amp;CID] }}
Previously I have had issues when calling a different API Mod multiple times from ScriptCards. It's usually not a problem with 1 or 2 but sometimes doing many calls seems to cause issues so I wonder if an all ScriptCards version would work for you. Note this does make some assumptions that all the tokens are on the currently active page with the player ribbon and that page's square size are the default 1 square is 70 pixels in size. Also that the token names all match the names below (ie. Peppercorn, Viper, etc.). !script{{ --#title|Infernal Rat Racing --~|array;define;Rats;Peppercorn;Viper;Nightcap;FSam;Bailey;Coddler --=Peppercorn|1d8 \ 3 --=Viper|1d8 \ 3 --=Nightcap|1d6 \ 3 --=FSam|1d10 \ 3 --=Bailey|1d4 \ 3 --=Coddler|1d12 \ 3 --%name|foreach;Rats --+[&amp;name]|moves [$[&amp;name]] Spaces --~|array;pagetokens;TArr;[*P:id];tprop:name=[&amp;name] --!t:[@TArr(0)]|left:[= [$[&amp;name].Raw] * 70 + [*[@TArr(0)]:t-left] ] --%| }} This will roll for each token, rounding down, and then move their position to the right. Hope that works for you. Let me know if you have any questions.