Bots Home
|
Create an App
notice1
Author:
staringatstars
Description
Source Code
Launch Bot
Current Users
Created by:
Staringatstars
// cb settings cb.settings_choices = [ {name: 'rmt1', label: '------------------------------------------------------------------------------------------------- The time in mins between each display of the 1st notice, if 0 no notice will be displayed', type: 'int', minValue: 0, maxValue: 1000000, required: false, defaultValue: 0}, {name:'rMsg1l1', type:'str', required: false, label:"1st rotating notice text :- 1st line of text ",}, {name:'rMsg1l2', type:'str', required: false, label:"2nd line of text ",}, {name:'rMsg1l3', type:'str', required: false, label:"3rd line of text ",}, {name:'rMsg1l4', type:'str', required: false, label:"4th line of text ",}, {name:'rMsg1l5', type:'str', required: false, label:"5th line of text ",}, {name:'rtc1', type:'str', required: false, label:'1st Notice Text colour in html code eg: #494949'}, {name:'rnc1', type:'str', required: false, label:'1st Notice background colour in html code eg: #494949'}, {name: 'rmt2', label: '------------------------------------------------------------------------------------------------- The time in mins between each display of the 2nd notice, if 0 no notice will be displayed', type: 'int', minValue: 0, maxValue: 1000000, required: false, defaultValue: 0}, {name:'rMsg2l1', type:'str', required: false, label:"2nd rotating notice text:- 1st line of text ",}, {name:'rMsg2l2', type:'str', required: false, label:"2nd line of text ",}, {name:'rMsg2l3', type:'str', required: false, label:"3rd line of text ",}, {name:'rMsg2l4', type:'str', required: false, label:"4th line of text ",}, {name:'rMsg2l5', type:'str', required: false, label:"5th line of text ",}, {name:'rtc2', type:'str', required: false, label:'2nd Notice Text colour in html code eg: #494949'}, {name:'rnc2', type:'str', required: false, label:'2nd Notice background colour in html code eg: #494949'}, {name: 'rmt3', label: '------------------------------------------------------------------------------------------------- The time in mins between each display of the 3rd notice, if 0 no notice will be displayed', type: 'int', minValue: 0, maxValue: 1000000, required: false, defaultValue: 0}, {name:'rMsg3l1', type:'str', required: false, label:"3rd rotating notice text:- 1st line of text ",}, {name:'rMsg3l2', type:'str', required: false, label:"3rd line of text ",}, {name:'rMsg3l3', type:'str', required: false, label:"3rd line of text ",}, {name:'rMsg3l4', type:'str', required: false, label:"4th line of text ",}, {name:'rMsg3l5', type:'str', required: false, label:"5th line of text ",}, {name:'rtc3', type:'str', required: false, label:'3rd Notice Text colour in html code eg: #494949'}, {name:'rnc3', type:'str', required: false, label:'3rd Notice background colour in html code eg: #494949'}, {name: 'rmt4', label: '------------------------------------------------------------------------------------------------- The time in mins between each display of the 4th notice, if 0 no notice will be displayed', type: 'int', minValue: 0, maxValue: 1000000, required: false, defaultValue: 0}, {name:'rMsg4l1', type:'str', required: false, label:"4th rotating notice text:- 1st line of text ",}, {name:'rMsg4l2', type:'str', required: false, label:"2nd line of text ",}, {name:'rMsg4l3', type:'str', required: false, label:"3rd line of text ",}, {name:'rMsg4l4', type:'str', required: false, label:"4th line of text ",}, {name:'rMsg4l5', type:'str', required: false, label:"5th line of text ",}, {name:'rtc4', type:'str', required: false, label:'4th Notice Text colour in html code eg: #494949'}, {name:'rnc4', type:'str', required: false, label:'4th Notice background colour in html code eg: #494949'}, ]; // Global variables //stettings variables for the max number of notices and lines var noNotices = 4; var noLines = 5; // other variables var noticeList = []; var timeShift = 15000; // set this to 15000 for time in mins, make smaller to speed up for testing var timeNext = 0; var model = cb.room_slug; function sortNL() { noticeList.sort(function(a, b) { var x = a[0]; var y = b[0]; return x - y; }); } function reTime(time) { var x = 1; noticeList[0][0] = noticeList[0][4]; for (var i = 1; i < noticeList.length; i++) { noticeList[i][0] = noticeList[i][0] - time; if (noticeList[i][0] == 0) { noticeList[i][0] = x; x++; if (noticeList[i][0] < 1) { cb.chatNotice('error'); } } } noticeList.sort(function(a, b) { var x = a[0]; var y = b[0]; return x - y; }); } function runNot() { timeNext = noticeList[0][0]; var t = timeNext*timeShift; cb.setTimeout(notLoop,t); // } function notLoop() { notice(); reTime(timeNext); timeNext = noticeList[0][0]; var t = timeNext*timeShift; cb.setTimeout(notLoop,t); // } function notice() { cb.chatNotice(noticeList[0][1],'',noticeList[0][2],noticeList[0][3],'bold'); } function grabSettings() { var i = 0; while (i < noNotices) { i++; var time = (cb.settings['rmt'+i] * 4); if (!(time == 0)) { var n = 1; var tempText = ''; tempText = cb.settings['rMsg'+i+'l1']; while (n < noLines) { n++; if (cb.settings['rMsg'+i+'l'+n]) { if (!(tempText == 0)) {tempText +=' \n ';} tempText += cb.settings['rMsg'+i+'l'+n]; } } var textCol = cb.settings['rtc'+i]; var backCol = cb.settings['rnc'+i]; var tempList = [time,tempText,backCol,textCol,time]; if (!(tempText == 0)) { noticeList[noticeList.length] = tempList; } } } noticeList.sort(function(a, b) { var x = a[0]; var y = b[0]; return x - y; }); } // initiate bot grabSettings(); runNot();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.