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

Initiative Macro (In Character Sheet D&D 5E) Not Working

1416440339

Edited 1416440648
All other clickable buttons and macros seem to work in my campaign, but the Initiative button/macro is not working. This doesn't work for any person in my campaign. Also, I cannot add turns for any token on the object layer. I am on Chrome, running Windows Vista. Thanks, David
1416445481
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
I'm moving this since it is not a bug issue for Roll20 but for a specific character sheet. Also, David, are you making sure you have a token selected that represents a character before trying to roll for Initiative?
Ok. Sorry for the incorrect posting. Yes, I have a token selected that represents a character. Other players in my campaign can't roll initiative on any of their characters either. I also can't add turns for any token that is on the object layer (usually do this by right clicking and clicking on "Add Turn").
This has now happened in another campaign of mine. Any ideas or help?
1416463755
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Alright, I'm going to move you back to the bug forums, since this seems to be an issue you're having with all games and not specifically the 5th Ed sheet. Can you please follow the steps in this guide .
I will follow the steps in the guide. It doesn't happen in all of my campaigns, just two so far.
This is the bottom part of the console log for my campaign. The "Uncaught TypeError: Cannot read property 'id' of null" message is the one that shows up when I click the initiative button on any character sheet. I also get that exact same error message when I open up the turn order (by clicking on the Turn Order button, under the Fog of War button). Any suggestions? Updating character sheet values Took 1016ms Updating character sheet values Took 663ms Finished after going 4 levels deep. Uncaught TypeError: Cannot read property 'id' of null app.js:33 Finished after going 4 levels deep. Uncaught TypeError: Cannot read property 'id' of null app.js:33 Finished after going 4 levels deep. Uncaught TypeError: Cannot read property 'id' of null app.js:33 Finished after going 4 levels deep. Uncaught TypeError: Cannot read property 'id' of null app.js:33 window resize app.js?1416345136:36 Final set zoom! app.js?1416345136:23 UPDATE GL SIZE! app.js?1416345136:23 Final set zoom! app.js?1416345136:23 Finished after going 4 levels deep. app.js?1416345136:33 Uncaught TypeError: Cannot read property 'id' of null app.js?1416345136:33 Finished after going 4 levels deep. app.js?1416345136:33 Uncaught TypeError: Cannot read property 'id' of null
Do you have any API scripts enabled?
1416526901

Edited 1416527028
I did in one of the two campaigns, but then I disabled and then deleted them and the problem did not go away. In the second campaign where this happened, I did not have any API scripts enabled. The second campaign was a copy of the first campaign, before I started messing with any API scripts (since it says on the API script page to use only on copied campaigns).
Any ideas on how to solve this problem?
What I'm guessing happened here is an API script you were using messed up your initiative order variable for your Campaign. Since you copied the first campaign to make the second, even though you never used the API script on it the "messed up" order was copied as well. Give me a link to the first campaign's details page and I'll take a look at your data and verify if that's what happened.
Ok. Thank you very much! The following is the link: <a href="https://app.roll20.net/campaigns/details/560816/a-man-can-die-but-once" rel="nofollow">https://app.roll20.net/campaigns/details/560816/a-man-can-die-but-once</a>
Try it now and see if it's fixed.
Which scripts were you running? Curious to know if it was one of my init scripts that did it and how I could go about fixing it.
It works! Thanks so much! Do you have any idea what script caused the problem? I would like to continue using API scripts, but I'm worried about screwing it up again.
HoneyBadger, I was using the script that follows "HP" and gives tokens red dot for &lt; half HP and red x for 0 HP. I was also using scripts for "patrolling" guards and scripts that would move a token to the GM layer while moving a different token to the objects layer when enabled (awesome for turning a chest into a mimic without having to move tokens yourself). I was also messing around with a different script that I couldn't get to work.
I'm not sure if it would have been any of those...it would have to have been a script that modified the "turnorder" variable on the Campaign.
1416623488

Edited 1416623523
It was probably the one you couldn't get to work. As for the mimic... you can make a rollable table and create a token from that. Then you can right click and choose sides to select which form the mimic takes.
Ok. I don't think I messed with any variable called "turnorder" or anything like that. But I'll remember to shy away from that in the future. As for the rollable table, I haven't heard of that yet and will have to check it out.
1416780530
Pat S.
Forum Champion
Sheet Author
David Q. said: Ok. I don't think I messed with any variable called "turnorder" or anything like that. But I'll remember to shy away from that in the future. As for the rollable table, I haven't heard of that yet and will have to check it out. <a href="https://wiki.roll20.net/Card_Decks_and_Rollable_Tables#Rollable_Tables" rel="nofollow">https://wiki.roll20.net/Card_Decks_and_Rollable_Tables#Rollable_Tables</a>
1416785595

Edited 1416855881
This has now happened in another campaign of mine. I am running API scripts, but none of them have "turnorder" in them. Can you tell me how you fixed it on my previous campaign? Or should I post my campaign settings link here again? Also, do you have any advice about API scripts? The only ones I'm running in this campaign are the two examples that are given the help documents (documenting injuries and patrolling guards). Yet this same problem happened again.
bump
1416872075
Pat S.
Forum Champion
Sheet Author
What were the api scripts you are running?
1416886228

Edited 1416886300
I was running four scripts. I have numbered them below. Not all comments make sense, since I just copied and pasted these and changed the code as needed, but not the comments. Here are the scripts: 1. var CONFIG = [ {barId: 1, barRatio: .5, status: "redmarker", whenLow: true}, {barId: 1, barRatio: 0, status: "dead", whenLow: true}]; on("change:token", function(obj) { CONFIG.forEach(function(opts) { var maxValue = parseInt(obj.get("bar" + opts.barId + "_max")); var curValue = parseInt(obj.get("bar" + opts.barId + "_value")); log(opts.barId + ": " + curValue + "/" + maxValue); if (!isNaN(maxValue) && !isNaN(curValue)) { var markerName = "status_" + opts.status; if (curValue &lt;= (maxValue * opts.barRatio)) { obj.set(markerName, opts.whenLow); } else { obj.set(markerName, !opts.whenLow); } } }); }); 2. on("ready", function() { //Wait until the ready event fires so we know the campaign is completely loaded. //Get a reference to our patrolling token. var patroltoken = findObjs({_type: "graphic", name: "Drake1"})[0]; //We know there is a token in the Campaign called "Orc Guard". var direction = -70; //Walk left 70 pixels. var stepstaken = 0; setInterval(function() { if(stepstaken &gt; 9) { //Switch directions! direction = direction * -1; //will "flip" the direction we're walking if (direction &gt; 1) { patroltoken.set("rotation", 360); } else { patroltoken.set("rotation", 180); } stepstaken = 0; //reset steps back to 0. } patroltoken.set("left", patroltoken.get("left") + direction); //walk! stepstaken++; }, 3000); //take an action every 5 seconds }); 3. on("ready", function() { //Wait until the ready event fires so we know the campaign is completely loaded. //Get a reference to our patrolling token. var patroltoken = findObjs({_type: "graphic", name: "Drake2"})[0]; //We know there is a token in the Campaign called "Orc Guard". var direction = 70; //Walk left 70 pixels. var stepstaken = 0; setInterval(function() { if(stepstaken &gt; 4) { //Switch directions! direction = direction * -1; //will "flip" the direction we're walking if (direction &gt; 1) { patroltoken.set("rotation", 360); } else { patroltoken.set("rotation", 180); } stepstaken = 0; //reset steps back to 0. } patroltoken.set("top", patroltoken.get("top") + direction); //walk! stepstaken++; }, 3000); //take an action every 5 seconds }); 4. on("ready", function() { //Wait until the ready event fires so we know the campaign is completely loaded. //Get a reference to our patrolling token. var patroltoken = findObjs({_type: "graphic", name: "Drake3"})[0]; //We know there is a token in the Campaign called "Orc Guard". var direction = 70; //Walk left 70 pixels. var stepstaken = 0; setInterval(function() { if(stepstaken &gt; 4) { //Switch directions! direction = direction * -1; //will "flip" the direction we're walking if (direction &gt; 1) { patroltoken.set("rotation", 360); } else { patroltoken.set("rotation", 180); } stepstaken = 0; //reset steps back to 0. } patroltoken.set("top", patroltoken.get("top") + direction); //walk! stepstaken++; }, 3000); //take an action every 5 seconds });