Bots Home
|
Create an App
Ryan's streamlined dice
Author:
warppipe
Description
Source Code
Launch Bot
Current Users
Created by:
Warppipe
cb.settings_choices = [ {name: "price", type: "int", label: "Price per roll", defaultValue: 33}, {name: "max_rolls", type: "int", label: "Maximum number of rolls", defaultValue: 3}, {name: 'bg_color', type: 'str', label: 'Background Color', defaultValue: '#AFEEEE'}, {name: 'txt_color', type: 'str', label: 'Text Color', defaultValue: '#800080'}, {name: "prize2", type: "str", label: "Result 2"}, {name: "prize3", type: "str", label: "Result 3"}, {name: "prize4", type: "str", label: "Result 4"}, {name: "prize5", type: "str", label: "Result 5"}, {name: "prize6", type: "str", label: "Result 6"}, {name: "prize7", type: "str", label: "Result 7"}, {name: "prize8", type: "str", label: "Result 8"}, {name: "prize9", type: "str", label: "Result 9"}, {name: "prize10", type: "str", label: "Result 10"}, {name: "prize11", type: "str", label: "Result 11"}, {name: "prize12", type: "str", label: "Result 12"}, {name: "delay", type: "int", label: "Minutes between notices", defaultValue: 4}, ] var start_divider = '\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F\u001F' var end_divider = '\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E\u001E' cb.onTip(function(tip){ if(tip['amount'] % cb.settings['price'] == 0 && tip['amount'] <= cb.settings['price'] * cb.settings['max_rolls']){ var tip_quantity = tip['amount'] / cb.settings['price']; var i for(i=0; i < tip_quantity; i++){ var die1 = Math.floor(Math.random()*6)+1; var die2 = Math.floor(Math.random()*6)+1; var result = die1 + die2; cb.sendNotice(':dw_dice_' + die1 + ' :dw_dice_' + die2 + ' \n' + tip['from_user'] + ' rolls ' + result + ' and wins ' + cb.settings['prize' + result] + '!', '', cb.settings['bg_color'], cb.settings['txt_color'], 'bold'); }; }; }) cb.onMessage(function(msg){ if (msg['m'] == '!dice'){ var results_text = constructMenuText(); cb.sendNotice(results_text, msg['user'], cb.settings['bg_color'], cb.settings['txt_color'], 'bold') msg['X-Spam'] = true; msg['m'] = '[Roll the Dice Details Requested]' }; }) function notifier(){ cb.sendNotice(start_divider + '\nRoll the Dice for ' + cb.settings.price + ' tokens!\nEnter !dice for more information\n' + end_divider, '', cb.settings['bg_color'], cb.settings['txt_color'], 'bold') cb.setTimeout(notifier, cb.settings.delay * 60000) } function constructMenuText(){ var building_string = start_divider + '\nPossible Prizes:\n' var i = 0 for(i = 2; i <= 12; i++){ building_string += i + ': ' + cb.settings['prize'+i] + '\n' } building_string += 'You may roll the dice up to ' + cb.settings.max_rolls + ' times in one tip (' + (cb.settings.max_rolls*cb.settings.price) + ' tokens)\n' + end_divider return building_string } notifier()
© Copyright Chaturbate 2011- 2026. All Rights Reserved.