Apps Home
|
Create an App
CrazyGoalz
Author:
antihackerz
Description
Source Code
Launch App
Current Users
Created by:
Antihackerz
/******************************************************* * Title: CrazyGoalz * Created By: acrazyguy * Reposted By: antihackerz * Version: 1.4 (2015.08.24) * Build: .018 *******************************************************/ /** * Also try: CrazyTicket, CrazyLotto, CrazyTorture, CrazyNote **/ /********** App Data **********/ var app = { name : "'CrazyGoalz'", /* Script name */ type : 'App', /* Script type: bot|app */ version : '1.4', /* Internal: Script version number */ build : '.018', /* Internal: Script build number */ date : '2015.08.24', /* 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 : '#6900CC', /* 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 : '#DC0000', /* Moderator red */ HVTEXT : '#D80A00', /* 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 : '#144D8C', /* 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 dashLine = "------------------------------------------------------------"; cb.settings_choices = [ { name: 'info', type: 'str', defaultValue: "https://dl.dropboxusercontent.com/u/887730/Using_CrazyGoalz.pdf", label: "How to use CrazyGoalz PDF", required: false }, { 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: 'war', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: "Enable 'Goal War'? (If 'Yes', fill in all fields)" }, { name: 'tmenu', type: 'choice', choice1: 'Menu', choice2: 'Tip Note', defaultValue: 'Tip Note', label: "Choose whether viewers will vote with the Tip Menu or by typing the voting word in a tip note. If you choose 'Menu', viewers will NOT be able to send ANY tip notes. Has NO effect on a simple Tip Goal or Auto-reset goal." }, { 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: 'menu1', type: 'str', defaultValue: "HAT", label: "Tip Menu selection #1 (Required for 'Goal War')", required: false }, { name: 'goal2', type: 'int', defaultValue: 0, label: "Token amount for Goal #2 (Required for 'Goal War')", required: false }, { name: 'goal2Desc', type: 'str', defaultValue: "Eat my socks", label: "Description for Goal #2 (Required for 'Goal War')", required: false }, { name: 'menu2', type: 'str', defaultValue: "SOCKS", label: "Tip Menu selection #2 (Required for 'Goal War')", required: false } ]; 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': "'CrazyGoalz' Reset ", 'row1_value': "by CrazyWare", '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': "'CrazyGoalz' ", 'row1_value': "by CrazyWare", '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.RED,'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("'CrazyGoalz War'! THE WINNING GOAL: "+theWinner); cb.sendNotice(dashLine+"\n\u25CF THE WINNING GOAL: "+theWinner+"\n"+dashLine,'','',COLOR.RED,'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("'CrazyGoalz': GOAL ATTAINED !!"); cb.sendNotice(dashLine+"\n\u25CF GOAL ATTAINED !!\n"+dashLine,'','',COLOR.RED,'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 = dashLine+"\n\u25CF "+app.name+" by CrazyWare\n\u25CF Version: "+app.version+app.build+" ("+app.date+")\n"+dashLine; cb.sendNotice(appInfo,roomHost,'',COLOR.INFO,'bold'); progressBar(); cb.sendNotice(dashLine+"\n"+app.name+" Version "+app.version+app.build+" ("+app.date+") started.\n"+dashLine,'','',COLOR.INFO,'bold'); if (FLAG.war) { cb.changeRoomSubject("'CrazyGoalz': War! 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("'CrazyGoalz' Auto-Reset "+cb.settings.goal1+": "+cb.settings.goal1Desc); } else { cb.changeRoomSubject("'CrazyGoalz': "+cb.settings.goal1Desc+" @ "+cb.settings.goal1); } } /*** Okay, let's have some fun! ***/ init(); /* ..gspp.. .d$$S$$S$$Sb. dS$$S$$S$PS$$Sb :$$S$S^^'";TSS$$; SSP' T$$SS; $$ `^^', :$ ggd: :.=-. .-=.:SSS ; <$>` <$> $$$$ : SS$$ ' -. $$S; ' .--. s$$S _ `. `--' .$$S$; .-"" "-._.-'`.__.' $$$S; : :S$$S ; :l "-. '^S$$b /`-. ;: " .--""""""^-. :"-. "" : /) ; ;`- : /: : :`- `. \ / '-.t `+.__ `. ;/ .-' -.; ; "-. "-. : .-" --: ; ;. "^:" .-""-.`.; : -^"`. "-.+' \/ ; `. "- ; : .^. / \ .-" "-. .' `._.-" "-._.-": ; : ; : : : ; \ ; ; : ; ; : ; : : / ; : \ ; ; : : ; ; : : : ; 0 ; ; ; : : : : ; /""--..__ ; : : ""--..__ ; ; "-. --..__ ""--..__: :`-._ "-._ "" _; ; "-._ """---...---""" :**/
© Copyright Freesexcam 2011- 2024. All Rights Reserved.