Apps Home
|
Create an App
betprize
Author:
alter_nick1
Description
Source Code
Launch App
Current Users
Created by:
Alter_Nick1
// Author: alter_nick // CONST var UPDATE_FREQ = 1; // vars var seconds_left = 0; var Show_seconds_left = 0; var tick_count = 0; var activeshow = 0; var activeshowtext = 'actual'; var nextshow =1; var nextshowtext ='siguiente'; function tick() { tick_count++; if (tick_count % UPDATE_FREQ == 0) { cb.drawPanel(); } if (seconds_left == 0) { if (Show_seconds_left == 0) { seconds_left =60 * cb.settings.switchTime; activeshow = nextshow; nextshow = (nextshow +1) % cb.settings.activeshows; activeshowtext = ShowName[activeshow+1]; nextshowtext = ShowName[nextshow+1]; } else { Show_seconds_left--; } } else { seconds_left--; } cb.setTimeout(tick, 1000); } function timeString(total_seconds) { var minutes = ("00" + Math.floor(total_seconds / 60)).slice(-2); var seconds = ("00" + total_seconds % 60).slice(-2); return minutes + ":" + seconds; } function timeRemaining() { if (!cb.limitCam_isRunning()) { return timeString(seconds_left); } else { return "Show Start!"; } } function timeShow() { if (!cb.limitCam_isRunning()) { return timeString(Show_seconds_left); } else { return "Show hidden!"; } } // ------------------------------------------- // ------------------------------------------- var backgroundImage = '05b83220-1ccc-4871-9333-70f97488de00'; var tipsReceived = 3545; var highestTip = 'tipDaddy 135'; var lastTipReceived = 'big_tipper 25'; var fontSize = 11; cb.onDrawPanel(function(user) { return { "template": "image_template", "layers": [ {'type': 'image', 'fileID': backgroundImage}, { 'type': 'text', 'text': timeRemaining(), 'top': 5, 'left': 61, 'font-size': fontSize, 'color': 'orange', },{ 'type': 'text', 'text': 'HIGHEST TIP', 'top': 29, 'left': 73, 'font-size': fontSize, 'color': 'orange', },{ 'type': 'text', 'text': 'LATEST TIP RECEIVED', 'top': 52, 'left': 28, 'font-size': fontSize, 'color': 'orange', },{ 'type': 'text', 'text': tipsReceived, 'top': 5, 'left': 147, 'font-size': fontSize, 'color': 'white', },{ 'type': 'text', 'text': activeshowtext, 'top': 29, 'left': 147, 'font-size': fontSize, 'color': 'white', },{ 'type': 'text', 'text': nextshowtext, 'top': 51, 'left': 147, 'font-size': fontSize, 'color': 'white', }, ], }; }); // ------------------------------------------- // ------------------------------------------- // ------------------------------------------- // Author: beaglefarm // CONST var UPDATE_FREQ = 1; // vars var current_tips = 0; var seconds_left = 0; var last_event_label = ""; var last_event_value = ""; cb.settings_choices = [ {name:'seconds_per_token', type:'int', minValue:1, maxValue:100, defaultValue:2, label: "How many seconds cam is unhidden per token" },{ name:'tokens_to_unhide_cam', type:'int', minValue:1, maxValue:1000, defaultValue:50, label: "How many tokens to start show" },{ name:'subject', type:'str', minLength:1, maxLength:255, label: "Subject (will appear before tipping instructions)" },{ name:'switchTime', type:'int', label: 'How many minutes to switch from one prize to the next one', minValue: 1, maxValue: 60, defaultValue: 5 },{ name:'activeshows', type:'int', label: 'How many prizes do used?', minValue: 1, maxValue: 3, defaultValue: 2 },{ name:'item_1', type:'str', label:'(1º value= tips to start it) Prize 1' },{ name:'item_2', type:'str', required:false, label:'(2º value= time at the start)Prize 2' },{ name:'item_3', type:'str', required:false, label:'(3º value= time to add )Prize 3' },{ name:'dice_use', type:'choice', label: 'Use dices?', choice1:'Yes', choice2: 'No', default: 'No' },{ name:'tokens', type:'int', label: 'How much do you want to charge per roll?', minValue: 1, maxValue: 1000, defaultValue: 25 },{ name:'die_draw', type: 'choice', label: 'in case of draw wthe used who tip will', choice1: 'win', choice2:'lose', default: 'lose' },{ name:'notice_wait_time', type: 'choice', label: 'In minutes, how often should the app advertise itself?', defaultValue: 10, choice1: 5, choice2: 10, choice3: 15, choice4: 20, choice5: 25, choice6: 30 } ]; function tokensNeeded() { if (current_tips >= cb.settings.tokens_to_unhide_cam) { return cb.settings.tokens_to_unhide_cam; } else { return current_tips; } } function startShow() { cb.changeRoomSubject(cb.settings.subject + ' The show has started! Each token adds another ' + cb.settings.seconds_per_token + ' seconds to the show! Don\'t let the timer run out, or the show will be hidden!'); cb.limitCam_stop(); cb.setTimeout(tick, 1000); cb.drawPanel(); } function stopShow() { seconds_left = 0; current_tips = 0; last_event_label = ""; last_event_value = ""; cb.changeRoomSubject(cb.settings.subject + ' ' + cb.settings.tokens_to_unhide_cam + ' tokens needed to unhide cam!'); if (!cb.limitCam_isRunning()) { cb.limitCam_start(cb.settings.tokens_to_unhide_cam + ' tokens needed to unhide cam!'); } cb.drawPanel(); } function init() { for (i=0;i<=MAXSEP-1;i++) { if (cb.settings['sepchar'] == separators[i].label) { separator_char = separators[i].shortcut + ' '; } } msg = 'Bet Roulette: '; for (i=1;i<=MAXITEMS;i++) { var tmp; tmp=cb.settings['item' + i]; if (tmp) { var arr= tmp.split('--'); if (arr[1]==undefined) { cb.sendNotice('Error-You need two dashes to separate the tip amount and menu item for item no '+ i,'','',cb.settings['noticecolor'],'bold'); } else { var value0=parseInt(arr[0]); var value1=parseInt(arr[1]); var value2=parseInt(arr[2]); if (value1>0) { ShowTokens[i] = value0; ShowTime[i] =value1; ShowExtra[i]=value2; ShowName[i] =arr[2]; if (i>=3) { msg += separator_char; } msg += arr[2] + '(' + value1 + ':' + value2 + ') '; } } } } if (msg!= 'Bet Roulette: ') { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); } else { cb.sendNotice('Error-No items found','','',cb.settings['noticecolor'],'bold'); } stopShow(); startShow(); seconds_left = 30; } function output(msg) { cb.sendNotice(msg, "", "#ff69b4", "#000000"); } init(); var ShowTokens = []; var ShowTime = []; var ShowExtra= []; var ShowName = []; var players = []; var separator_char = "| "; var MAXITEMS= 20; var MAXSEP = 9; var minutes = 1; var seconds =30; var minutesact= 1; var secondsact=23; var active = 1; var numberOfShows = parseInt(cb.settings.activeshows); function showShows(username) { if (prizes.length > 0) { var msg = "##### SHOWS #####"; for (var i = 1; i <= numberOfShows; i++) { if (ShowTokens[i] >= 0) { msg += "\n" + i + " - " + ShowName[i]; } } } else { var msg = "SORRY! There are no prizes left in the list, but thank you for the tip. :thumbsup"; } cb.sendNotice(msg, username, '#DBFBFF', '#008596', 'bold'); } cb.onTip(function(tip) { current_tips += parseInt(tip['amount']); Show_seconds_left += parseInt(tip['amount']) * cb.settings.seconds_per_token; if (cb.limitCam_isRunning() && current_tips >= cb.settings.tokens_to_unhide_cam) { last_event_label = tip['from_user']; last_event_value = 'started the show!'; } else if (!cb.limitCam_isRunning()) { last_event_label = tip['from_user']; last_event_value = 'added ' + timeString(parseInt(tip['amount']) * cb.settings.seconds_per_token); } cb.drawPanel(); showShows(); });
© Copyright Chaturbate 2011- 2025. All Rights Reserved.