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

breakScreen.js Help

1613582825

Edited 1613601002
I have messaged @nick O but in the chance he is unable to reply, I am trying to use his tip for the breakScreen API. I followed all his step to the T. (as far as I can tell) I have run the !clearBreakScreenText command to clear the history after changing the text font, like he says you have to do in his video. However unlike him once I did that the whole thing stopped working. I can not figure out for the life of me what I am doing wrong. Edit: I will edit all the attempts to correct the issue as they are attempted so that people do not need to read a million posts. yes I have a Pro account, as needed. I have a token named: textLocation, as instructed on the breakScreen. I have a rollable table named: loadingMessages, again as instructed. edit:I  have moved the ribbon off the breakscreen, then reloaded the campaign and moved the ribbon back and moving the ribbon made no difference. edit: Other scripts are functioning corectly. My sandbox is listing no errors. I have watched the video like 10 times and I am so frustrated since I had it working at one point and now I cant get to work again. Obviously I am VERY green in anything to do with coding, like say macroing and API coding. So I have found videos like Nick's to be a godsend and a true help. However, I am stuck at this point. I don't know what else to do. on("ready",function(){ var isItRunning; on("change:campaign:playerpageid",function(){ var currentPage = getObj("page",Campaign().get("playerpageid")); if (currentPage.get("name")=="breakScreen"){ var textBox; var token = findObjs({ name:"textLocation", type:"graphic", pageid:Campaign().get("playerpageid") }); if (token[0] === undefined){ sendChat("API","Could not locate a token named textLocation"); return; } var textLocation = token[0]; if(!state.BreakScreen){ log("increate") textBox = createObj("text", { text:"Hello World", font_size:36, font_family:"Patrick Hand", color:"rgb(255,255,255)", layer:"objects", pageid:Campaign().get("playerpageid"), left:textLocation.get("left"), top:textLocation.get("top") }); state.BreakScreen = { module:"Break Screen", textID:textBox.get("id") } } else{ textBox = getObj("text",state.BreakScreen.textID); } var tables = findObjs({ type:"rollabletable", name:"loadingMessages" }); if (tables[0] === undefined){ sendChat("API","Unable to locate a rollable table called loadingMessages"); return; } var loadingMessagesTable = tables[0]; var messageList = findObjs({ type:"tableitem", rollabletableid:loadingMessagesTable.get("id") }); isItRunning = setInterval(function(){ var tableItem = messageList[(randomInteger(messageList.length)-1)]; textBox.set({ text:tableItem.get("name"), left:textLocation.get("left"), top:textLocation.get("top") }); },3000); } else{ clearInterval(isItRunning); } }); on("chat:message",function(msg){ if(msg.type=="api" && msg.content.indexOf("!clearBreakScreenText")==0){ textBox = getObj("text",state.BreakScreen.textID); if(textBox!==undefined){ textBox.remove(); } state.BreakScreen = undefined; } }); });
1613586529

Edited 1613586578
David M.
Pro
API Scripter
Check out this related thread from a few months ago (2nd to last post, from TheAaron). Does this solve your problem? I didn't do a text comparison to see if there were any differences in the code that you posted, but thought it might be worth a shot. 
ok so reading TheAaron's post I tried what he suggested by starting the player ribbon on another page, then I reloaded the whole game and still nothing. This is so frustrating since at one point last night it was working. This is the kind of stuff that frustrates me. I've been working on this break screen/loading page for a week. I thought the hard part would be the PhotoShop portion of it. Now that seems the easy part. 
1613589983

Edited 1613590387
David M.
Pro
API Scripter
Do other scripts work? If not, your sandbox may have crashed. i.e. is there a big region of pink text just above your API Output Console page? If so, try restarting it (either by saving a script or hitting Restart API Sandbox from the Script Library tab. Sorry, I haven't even read what this script does yet, just going for low hanging fruit.  
no. That's the first thing I check, I keep it up in a separate window so I can refresh it easily. Yes other API's are all functioning correctly.
Are you using !lclearBreakScreenText to call the script? The command should be !clearBreakScreenText -- in your original post you have an extra 'I' between the ! and clear.
1613837656
Nick O.
Forum Champion
I created a new game and put the code you posted  into that game, and the script worked properly.  In your API console, do you see the increate message that's being logged? If so, that means that you're creating a new textbox. If you don't see the message, then it means the BreakScreen variable has been set. Try adding some additional log lines, like this, and let me know what gets put in the API Output Console. This will help us track down where the issue is. on("ready",function(){ var isItRunning; on("change:campaign:playerpageid",function(){ var currentPage = getObj("page",Campaign().get("playerpageid")); if (currentPage.get("name")=="breakScreen"){ var textBox; var token = findObjs({ name:"textLocation", type:"graphic", pageid:Campaign().get("playerpageid") }); if (token[0] === undefined){ sendChat("API","Could not locate a token named textLocation"); return; } var textLocation = token[0]; if(!state.BreakScreen){ log("increate") textBox = createObj("text", { text:"Hello World", font_size:36, font_family:"Patrick Hand", color:"rgb(255,255,255)", layer:"objects", pageid:Campaign().get("playerpageid"), left:textLocation.get("left"), top:textLocation.get("top") }); state.BreakScreen = { module:"Break Screen", textID:textBox.get("id") } } else{ log("BreakScreen Exists") textBox = getObj("text",state.BreakScreen.textID); } var tables = findObjs({ type:"rollabletable", name:"loadingMessages" }); if (tables[0] === undefined){ sendChat("API","Unable to locate a rollable table called loadingMessages"); return; } var loadingMessagesTable = tables[0]; var messageList = findObjs({ type:"tableitem", rollabletableid:loadingMessagesTable.get("id") }); isItRunning = setInterval(function(){ var tableItem = messageList[(randomInteger(messageList.length)-1)]; log(tableItem) textBox.set({ text:tableItem.get("name"), left:textLocation.get("left"), top:textLocation.get("top") }); },3000); } else{ clearInterval(isItRunning); } }); on("chat:message",function(msg){ if(msg.type=="api" && msg.content.indexOf("!clearBreakScreenText")==0){ textBox = getObj("text",state.BreakScreen.textID); if(textBox!==undefined){ textBox.remove(); } state.BreakScreen = undefined; } }); });
yeah early this morning i was working on it. I created a brand new game and it worked. So I created a copy and it worked. I then added all my API's and it worked. Once going back to the original still no work so I just used the copy and its working.... I have no idea why. However, thank you very much. I appreciate your extra effort in fixing the issue.
Problem Resolved
1613841066
Nick O.
Forum Champion
Glad it's working for you!