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

API script for initiative macro (VTM: V20)

Hi folks As am setting my char sheet I found an initiative script on this forum and after creating the macro and adding the script 1) it does not work (worked only few times) 2) when I launch my game  it gets stuck at "loading" and assets loading keep cycling through  and it goes on forever only way is to remove the script. is there a new initiative script that works with the new V20 sheet? also maybe not the right forum, but anyway to able to make hotkeys of the dice pool under the section "dice" so the players does not have to open the page  everytime a roll needs to be made? appreciate the help and thank you
1667310676
The Aaron
Roll20 Production Team
API Scripter
Can you link to the script that you are using?
1667311600

Edited 1667311667
Bilo
Pro
Hi there am using this script with the new char sheet of V20 with this macro ! ini ?{Dexterity|2} ?{Wits|2} ?{Celerity|0} ?{Mod|0} 0 ------------------------------------------ on("chat:message", function(msg) { if( msg.type != 'api' ) return; var cmd = msg.content.toLowerCase().split(' '); if( cmd[0] == "!ini" ) { var inputName = msg.who; var list = findObjs({ _type: "character", name: inputName }); var str = ""; if (cmd[5] == 1) str = str + "/w gm "; str = str + "<br><b>Initiative Roll</b>"; var roll = Math.floor((Math.random()*10)+1); str = str + "<br>Dexterity: " + cmd[1]; str = str + "<br>Wits: " + cmd[2]; str = str + "<br>Celerity: " + cmd[3]; str = str + "<br>Mod: " + cmd[4]; str = str + "<br>Roll: " + roll; var count = 0; count = roll + parseInt(cmd[1]) + parseInt(cmd[2]) + parseInt(cmd[3]) + parseInt(cmd[4]); str = str + "<br><b>Total: </b>" + count; if (list.length == 0) { sendChat("player|"+msg.playerid, str); } else { sendChat("character|"+list[0].id, str); } var turnorder; var turnorder; if(Campaign().get("turnorder") == "") turnorder = []; //NOTE: We check to make sure that the turnorder isn't just an empty string first. If it is treat it like an empty array. else turnorder = JSON.parse(Campaign().get("turnorder")); //Add a new custom entry to the end of the turn order. turnorder.push({ id: "-1", pr: count, custom: msg.who }); Campaign().set("turnorder", JSON.stringify(turnorder)); } });
1667315651
The Aaron
Roll20 Production Team
API Scripter
This: ! ini ?{Dexterity|2} ?{Wits|2} ?{Celerity|0} ?{Mod|0} 0 Should be this: !ini ?{Dexterity|2} ?{Wits|2} ?{Celerity|0} ?{Mod|0} 0 See if that makes it work.
I copy pasted and stil does not work and does not show in the turn order
You might need to re-sort the turn order; it sometimes doesn't update right away after a script updates the internal list.
thank you Bill that seemed to work!!