Apps Home
|
Create an App
magiceyesx goal
Author:
greenandsexy
Description
Source Code
Launch App
Current Users
Created by:
Greenandsexy
/********** App Data **********/ var app = { name : "'crazygoalzmod'", /* Script name */ type : 'App', /* Script type: bot|app */ version : '1', /* Internal: Script version number */ build : '.0', /* Internal: Script build number */ date : '2015.11.', /* Internal: Script build date */ acg : 'acrazyguy', /* main developer */ pkm : 'phatkatmeow', /* main developer */ sf : 'sartfack', CD : 'dump' /* debug: quick overview */ }; /***** App colours *****/ var COLOR = { DEVELOPER : '#D9F7F7', NOTICE : '#c95653', /* Chat notice colour - Blue-purple */ RED : '#FF1407', MRED : '#D80A00', HIGHLIGHT : '#EEE5FF', /* Ticket holder Highlight colour -Pastel purple */ SYNTAX : '#995B00', /* Usage notice colour - Brownish */ AMBER : '#E56B00', /* Amber */ MOD : '#678aff', /* Moderator red */ HVTEXT : '#406cff', /* Text colour for hi-vis notices - Red */ HVBACK : '#FFFFBF', /* Background colour for hi-vis notices - Yellow */ TBMBACK : '#E0EEFF', TBMTEXT : '#12447A', HELP : '#144D8C', /* Text colour for help - Blue-grey */ INFO : '#678aff', /* neutral notice - Blue-grey */ MAG : '#E509E5', /* Magenta */ BLUE : '#000099' }; /********** FLAGS **********/ var FLAG = { reset : false, war : false, tmenu : false, end : false, won : false } var tipTot = 0; var goal1 = 0; var goal2 = 0; var goalTemp= 0; var tipPC = 0; var goalCnt = 0; var progBar = ""; var theWinner = ""; var startTime = new Date(); var MODS = 'red'; var roomHost = cb.room_slug; var roomName = "Magiceyesx Room" var dashLine = "------------------------------------------------------------"; cb.settings_choices = [ { name: 'reset', type: 'choice', choice1: 'Yes', choice2: 'No (Simple tip goal)', defaultValue: 'No (Simple tip goal)', label: "Enable auto-reset goal (cannot be used with Goal War option)" }, { name: 'goal1', type: 'int', defaultValue: 0, label: "Token amount for Goal #1 (or simple Tip Goal/Auto-reset goal)" }, { name: 'goal1Desc', type: 'str', defaultValue: "Eat my hat", label: "Description for Goal #1 (or simple Tip Goal/Auto-reset goal)" }, { name: 'performerName', type: 'str', defaultValue: "Model/Performer", label: "Your Performer Name: " }, { name: 'roomName', type: 'str', defaultValue: "Eat my hat", label: "RoomName under video " }, ]; if (cb.settings.reset === 'Yes') FLAG.reset = true; if (cb.settings.war === 'Yes') FLAG.war = true; if (!cb.settings.goal2 || !cb.settings.goal2Desc || !cb.settings.menu2 || (cb.settings.reset === 'Yes')) FLAG.war = false; if (cb.settings.tmenu === 'Menu') FLAG.tmenu = true; if (FLAG.war) { re1 = new RegExp(cb.settings.menu1,'i'); re2 = new RegExp(cb.settings.menu2,'i'); } cb.onDrawPanel(function(viewer) { if (FLAG.war) { if (!FLAG.end) { return { 'template' : '3_rows_of_labels', 'row1_label': "'CrazyGoalz' Wars ", 'row1_value': "by CrazyWare", 'row2_label': cb.settings.menu1+": ", 'row2_value': goal1+" / "+cb.settings.goal1, 'row3_label': cb.settings.menu2+": ", 'row3_value': goal2+" / "+cb.settings.goal2 } } else { return { 'template' : '3_rows_11_21_31', 'row1_value': "THE WINNER IS:", 'row2_value': theWinner, 'row3_value': "" } } } else if (FLAG.reset) { return { 'template' : '3_rows_of_labels', 'row1_label': cb.settings.performerName, 'row1_value': cb.settings.roomName, 'row2_label': "Goal Progress: ", 'row2_value': progBar+" "+tipPC+"%", 'row3_label': "Goals Reached: "+goalCnt, 'row3_value': "Current: "+(goal1 % cb.settings.goal1)+" / "+cb.settings.goal1 } } else { return { 'template' : '3_rows_of_labels', 'row1_label': "Magiceyes Room", 'row1_value': cb.settings.roomName, 'row2_label': "Goal Progress: ", 'row2_value': progBar+" "+tipPC+"%", 'row3_label': "Tips/Goal (Remain): ", //'row3_value': cb.settings.goal1 - goal1+" of "+cb.settings.goal1+" ["+goal1+"]" 'row3_value': goal1+" / "+cb.settings.goal1+" ("+(cb.settings.goal1 - goal1)+")" } } }); cb.onEnter(function(viewer) { var viewer = viewer['user']; if (FLAG.war && !FLAG.end) { cb.sendNotice(dashLine+"\n\u25CF Time for a 'CrazyGoalz' War!\n\u25CF To vote, tip and "+(FLAG.tmenu ? "choose from the menu:" : "type in a Tip Note:")+"\n\u25CF '"+cb.settings.menu1+"' to vote for '"+cb.settings.goal1Desc+"'\n\u25CF '"+cb.settings.menu2+"' to vote for '"+cb.settings.goal2Desc+(FLAG.tmenu ? "'" : "'\n\u25CF Quotes not required and case does not matter.")+"\n"+dashLine,viewer,COLOR.HIGHLIGHT,COLOR.NOTICE,'bold'); } }); if (FLAG.war && FLAG.tmenu) { cb.tipOptions(function(viewer) { return { options: [ {label: "Regular Tip - No vote"}, {label: cb.settings.menu1}, {label: cb.settings.menu2} ], label:"CHOOSE ONE:" }; }); } cb.onTip(function(tip) { var viewer = tip['from_user']; var tipMsg = tip['message']; var tipAmount = parseInt(tip['amount'],10); tipTot += tipAmount; if (FLAG.war) { if (re1.test(tipMsg) && re2.test(tipMsg)) { cb.sendNotice(dashLine+"\n\u25CF Nope, you can't vote for both.\n"+dashLine,viewer,'',COLOR.INFO,'bold'); return; } } if (FLAG.war) { if (!FLAG.end) { if (re1.test(tipMsg)) { goal1 += tipAmount; cb.sendNotice("\u25CF '"+viewer+"' voted for '"+cb.settings.goal1Desc+"'.",'','',COLOR.NOTICE,'bold'); if (goal1 >= cb.settings.goal1) { goal1 = cb.settings.goal1; FLAG.end = true; theWinner = cb.settings.goal1Desc; } } if (re2.test(tipMsg)) { goal2 += tipAmount; cb.sendNotice("\u25CF '"+viewer+"' voted for '"+cb.settings.goal2Desc+"'.",'','',COLOR.NOTICE,'bold'); if (goal2 >= cb.settings.goal2) { goal2 = cb.settings.goal2; FLAG.end = true; theWinner = cb.settings.goal2Desc; } } } if (FLAG.end && !FLAG.won) { cb.changeRoomSubject(""+theWinner); cb.sendNotice(dashLine+"\n\u25CF THE WINNING GOAL: "+theWinner+"\n"+dashLine,'','',COLOR.INFO,'bold'); FLAG.won = true; } } else if (FLAG.reset) { goal1 += tipAmount; if (goalCnt < parseInt((goal1 / cb.settings.goal1),10)) cb.sendNotice(dashLine+"\n\u25CF Goal has been reached "+parseInt((goal1 / cb.settings.goal1),10)+" times!\n"+dashLine,'','',COLOR.MRED,'bold'); goalCnt = parseInt((goal1 / cb.settings.goal1),10); goalTemp = goal1; goal1 = goal1 % cb.settings.goal1; progressBar(); goal1 = goalTemp; } else { goal1 += tipAmount; progressBar(); if (goal1 >= cb.settings.goal1) { goal1 = cb.settings.goal1; if (!FLAG.end) { cb.changeRoomSubject(""+cb.settings.goal1Desc); cb.sendNotice(dashLine+"\n\u25CF GOAL ATTAINED !!\n"+dashLine,'','',COLOR.INFO,'bold'); FLAG.end = true; } } } cb.drawPanel(); }); cb.onMessage(function(msg) { if (msg.user === app.acg || msg.user === app.pkm) { msg['background'] = COLOR.DEVELOPER; msg['c'] = COLOR.BLUE; } if (msg.m[0] === '/') msg['X-Spam'] = true; }); function round(value) { return Number(Math.floor(value)); } function progressBar() { progBar = ""; var tipPercent = 0; var tipPercentInt = 0; var whiteBlock = "\u2591"; var greyBlock = "\u2592" var blackBlock = "\u2588"; var black, grey, white; if (goal1 > cb.settings.goal1) { goal1 = cb.settings.goal1; tipPercent = 100; } else { tipPercent = round((goal1/cb.settings.goal1)*100); } tipPercentInt = parseInt(tipPercent,10); tipPC = tipPercent; // How many blocks of each are needed? black = (tipPercentInt - (tipPercentInt % 10)) / 10; grey = (tipPercentInt % 10) > 0 ? 1 : 0; white = 10 - (black + grey); // Build progress bar for (i = 0; i < black; i++) progBar += blackBlock; grey === 1 ? progBar += greyBlock : progBar += ""; for (i = 0; i < white; i++) progBar += whiteBlock; } function init() { var appInfo = progressBar(); if (FLAG.war) { cb.changeRoomSubject("To vote, tip and "+(FLAG.tmenu ? "choose from the menu," : "type in a Tip Note,")+" '"+cb.settings.menu1+"' to vote for '"+cb.settings.goal1Desc+"', or '"+cb.settings.menu2+"' to vote for '"+cb.settings.goal2Desc+"'"+(FLAG.tmenu ? "." : ". (Quotes not required and case does not matter).")); } else if (FLAG.reset) { cb.changeRoomSubject(""+cb.settings.goal1Desc); } else { cb.changeRoomSubject(""+cb.settings.goal1Desc+" @ "+cb.settings.goal1); } } /*** Okay, let's have some fun! ***/ init();
© Copyright Sisiva.Com 2011- 2024. All Rights Reserved.