Apps Home
|
Create an App
Alexandra Storm's TRICK or TREAT
Author:
porno_sec
Description
Source Code
Launch App
Current Users
Created by:
Porno_Sec
/**** * Alexandra Storm's Trick or Treat Bot * Author: porno_sec * Version: 1.1.0 (2 October 2018) * ****/ var last_player = null; var total_tipped = 0; var total_rolls = 0; var rollCost; var theRules; // set later by cb.settings.rules var row1Label = "Last Roll : "; var row2Label = "Rolled By : "; var row3Label = "Total Rolls : " var trickOrTreat = "Not Rolled Yet"; var textBackground = "#000000"; var textColor = "#FF9933"; var repeatNotice = true; var repeatNoticeText; var reminderTime = 60000; cb.settings_choices = [ {name: 'rules', type: 'str', label: "Rules to display when a user types /rules: ", minLength: 1, maxLength: 500}, {name:'roll_cost', type:'int', minValue:1, maxValue:99, defaultValue:20, label: "How much does one roll cost?"}, {name:'reminder', type:'choice', choice1:'Every 1 minute', choice2:'Every 3 minutes', choice3:'Every 5 minutes', choice4:'Never', defaultValue:'Every 1 minute', label: "How often should the bot announce the roll price?"}, ]; function getSettings() { cb.log("getSettings()"); rollCost = cb.settings.roll_cost; cb.log("rollCost = " + rollCost); switch(cb.settings.reminder) { case "Never": repeatNotice = false; break; case "Every 1 minute": reminderTime = 60000; // 60 seconds break; case "Every 3 minutes": reminderTime = 180000; // 180 seconds break; case "Every 5 minutes": reminderTime = 300000; // 300 seconds break; } //cb.log("reminderTime = " + reminderTime); theRules = cb.settings.rules; repeatNoticeText = "We're playing Alexandra Storm's TRICK or TREAT. To roll, tip " + rollCost + " tokens."; } // PRNG var seed = 83749347; function prng() { var x = Math.sin(seed++) * 10000; return x - Math.floor(x); } function coinFlip() { return (Math.floor(prng() * 2) == 0) ? 'TRICK' : 'TREAT'; } function handleTipAmount(tipAmount, msg, tipper) { cb.drawPanel(); //cb.log("handleTipAmount(tipAmount: " + tipAmount + ", msg: " + msg + ", user: " + tipper); switch(tipAmount) { case(rollCost): // Increment roll counter total_rolls += 1; //cb.changeRoomSubject(tipper + ' has chosen TRUTH!'); last_player = tipper; cb.sendNotice(last_player + " " + "has rolled the TRICK or TREAT bot!", '', textBackground, textColor, 'bold'); // Roll var trickOrTreat = coinFlip(); // Print roll results to chat with appropriate emoticon // We need to add the emoticon to the variable like this for // the chat because if we don't then it prints just the text // for the emote into the DrawPanel element when we try and // do that below. if (trickOrTreat == "TRICK") { var totOutput = "TRICK! :skullysm" } else if (trickOrTreat == "TREAT") { var totOutput = "TREAT! :alexandrapumpkin" } cb.sendNotice(totOutput, '', textBackground, textColor, 'bold'); // This part is supposed to draw the panel (under the video area) cb.onDrawPanel(function(user) { if(user == cb.room_slug) { //cb.log("the user is the room slug"); return { 'template': '3_rows_of_labels', 'row1_label': row1Label, 'row1_value': trickOrTreat, 'row2_label': row2Label, 'row2_value': last_player, 'row3_label': "Total Earnings : ", 'row3_value': total_tipped }; } else { return { 'template': '3_rows_of_labels', 'row1_label': row1Label, 'row1_value': trickOrTreat, 'row2_label': row2Label, 'row2_value': last_player, 'row3_label': row3Label, 'row3_value': total_rolls }; } }); break; default: //DEBUG: Print notice for every tip so we know the bot is at least seeing them. //cb.sendNotice("Bot not activated by this tip."); break; } } cb.onTip(function (tip) { total_tipped += parseInt(tip['amount']) //cb.log("Total Tipped: " + total_tipped); //cb.log("Amount Tipped: " + tip['amount']); //cb.log("Tipper: " + tip['from_user']); handleTipAmount(parseInt(tip['amount']), tip['message'], tip['from_user']); }); //filter messages cb.onMessage(function (msg) { switch(msg['m']) { case "/prices": if((msg['is_mod']) || (msg['user'] == cb.room_slug)) { //if the user is a moderator or the broadcaster... msg['m'] = "PRICES: " + repeatNoticeText; msg['background'] = "#000000"; msg['c'] = "#FFFFFF"; return msg; } break; case "/rules": if((msg['is_mod']) || (msg['user'] == cb.room_slug)) { //if the user is a moderator or the broadcaster... msg['m'] = "THE RULES: " + theRules; msg['background'] = "#000000"; msg['c'] = "#FFFFFF"; return msg; } break; default: if (msg['user'] == last_player) { // msg['background'] = textBackground; // msg['c'] = textColor; } return msg; break; } }); function reminder() { cb.sendNotice(repeatNoticeText, '', textBackground, textColor, 'bold'); cb.setTimeout(reminder, reminderTime) } function init() { //cb.changeRoomSubject("Welcome to Truth Or Dare!"); getSettings(); if(repeatNotice==true) { cb.setTimeout(reminder, reminderTime) } cb.sendNotice(repeatNoticeText); // make the initial announcement about game prices } // Lock bot if (cb.room_slug == "porno_sec" || cb.room_slug == "alexandrastorm") { // Start the bot init(); } else { cb.sendNotice("Error! This TRICK or TREAT bot belongs to Alexandra Storm.", '', textBackground, textColor, 'bold'); }
© Copyright Freesexcam 2011- 2024. All Rights Reserved.