
I saw this youtube video https://www.youtube.com/watch?v=MJSVE3gvNQs&t=320s&ab_channel=NickOlivo and wanted something like this for my session but I couldn't get it to work and I got no error message. I hope someone can help me
I saw this youtube video https://www.youtube.com/watch?v=MJSVE3gvNQs&t=320s&ab_channel=NickOlivo and wanted something like this for my session but I couldn't get it to work and I got no error message. I hope someone can help me
I tried it now and nothing is shown in the chat but now I get an error message "SyntaxError: Unexpected string" I don't know if I typed it correctly so I added a screenshot and hope it helps
If you could post the text of the code you're using (rather than an image), it would be easier for others to try and debug it with you. =D
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",log("Here"),
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:"Contrail One",
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;
}
});
});
Inside the var token, there's this line:
name:"textLocation",log("Here"),
Change that to
name:"textLocation",
yes nick told me that i should add this "log" after the name:textlocation i do not know how to do that so i just wrote it after the name:textlocation
this is the original one
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:"Contrail One",
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;
}
});
});
so the player banner is on the break screen and the token "textLocation" is on the break screen but nothing happens (I use code from github again)
With the API running, and while personally on the break page, try moving the player ribbon to another page, then move it back to the break page.
No worries, it's a very subtle bug. Basically, the script only activates when the ribbon is moved to the break page. If the ribbon has always started there, it will never activate the script. Probably the script needs a bit of startup logic that kicks of the functionality if the api script starts and the ribbon is already on the page.