Apps Home
|
Create an App
tip menu configuracion español
Author:
anthony_room_
Description
Source Code
Launch App
Current Users
Created by:
Anthony_Room_
// Tip Menu App by Anthony_room_ // 4-6-13 // To Do: Cosmética: Variables de menú 'undefine' adecuadamente para la matriz listMenu de modo que no se muestren. Marcadores de posición utilizados hasta entonces // Variables var total_tips = 0; var goal_tips = 0; var last_tipper = null; var last_tip = 0; var ht_username = null; var ht_amount = 0; var goal = 0; // Settings cb.settings_choices = [{ name: 'goal', type: 'int', minValue: 0, defaultValue: 100, label: "Monto del objetivo (establecer en 0 para desactivar):" }, { name: 'reset', type: 'choice', choice1: 'Yes', choice2: 'No', label: "¿Reestablecer el objetivo cuando se cumple?" }, { name: 'goalAd', type: 'str', minLength: 0, MaxLength: 300, label: "descripción del Objetivo. Se publicará automáticamente en el chat cuando se alcance el objetivo (Opcional):", required: false }, { name: 'item1', type: 'str', minLength: 1, maxLength: 30, label: "Elemento de menú 1 (necesario):" }, { name: 'price1', type: 'int', minValue: 0, defaultValue: 10, label: "Artículo 1 Precio (obligatorio):" }, { name: 'item2', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 2 (requerido):" }, { name: 'price2', type: 'int', minValue: 0, defaultValue: 20, label: "Artículo 2 Precio (obligatorio):" }, { name: 'item3', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 3:", required: false }, { name: 'Artículo 3 Precio:', type: 'int', minValue: 0, label: "Item 3 Price", required: false }, { name: 'item4', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 4:", required: false }, { name: 'price4', type: 'int', minValue: 0, label: "Artículo 4 Precio:", required: false }, { name: 'item5', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 5:", required: false }, { name: 'price5', type: 'int', minValue: 0, label: "Artículo 5 Precio:", required: false }, { name: 'item6', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 6:", required: false }, { name: 'price6', type: 'int', minValue: 0, label: "Artículo 6 Precio:", required: false }, { name: 'item7', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 7:", required: false }, { name: 'price7', type: 'int', minValue: 0, label: "Artículo 7 Precio:", required: false }, { name: 'item8', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 8:", required: false }, { name: 'price8', type: 'int', minValue: 0, label: "Artículo 8 Precio:", required: false }, { name: 'item9', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 9:", required: false }, { name: 'price9', type: 'int', minValue: 0, label: "Artículo 9 Precio:", required: false }, { name: 'item10', type: 'str', minLength: 1, maxLength: 50, label: "Elemento de menú 10:", required: false }, { name: 'price10', type: 'int', minValue: 0, label: "Artículo 10 Precio:", required: false }, { name: 'chat_ad', type: 'int', minValue: 0, maxValue: 999, defaultValue: 10, label: 'Anuncie el Menú en Chat ____ Mins (Establecer 0 para Deshabilitar):' } ]; // Handlers cb.onTip(function(tip) { total_tips += tip['amount']; goal_tips += tip['amount']; if (tip['amount'] === cb.settings.price1) { cb.chatNotice(cb.settings.item1); } if (tip['amount'] === cb.settings.price2) { cb.chatNotice(cb.settings.item2); } if (tip['amount'] === cb.settings.price3) { cb.chatNotice(cb.settings.item3); } if (tip['amount'] === cb.settings.price4) { cb.chatNotice(cb.settings.item4); } if (tip['amount'] === cb.settings.price5) { cb.chatNotice(cb.settings.item5); } if (tip['amount'] === cb.settings.price6) { cb.chatNotice(cb.settings.item6); } if (tip['amount'] === cb.settings.price7) { cb.chatNotice(cb.settings.item7); } if (tip['amount'] === cb.settings.price8) { cb.chatNotice(cb.settings.item8); } if (tip['amount'] === cb.settings.price9) { cb.chatNotice(cb.settings.item9); } if (tip['amount'] === cb.settings.price10) { cb.chatNotice(cb.settings.item10); } update_app(); last_tip = tip['amount']; last_tipper = tip['from_user']; if (tip['amount'] > ht_amount) { ht_amount = tip['amount']; ht_username = tip['from_user']; } cb.drawPanel(); }); // Chat Commands cb.onMessage(function(msg) { if (msg['user'] == ht_username) { msg['background'] = '#CCFF99 '; } if (msg['m'] == '/menu') { cb.chatNotice('-----' + cb.room_slug + 's Tip Menu -----', msg['user']); for (var i = 0; i < listMenu.length; i++) { cb.chatNotice(listMenu[i], msg['user']); } } if (msg['m'] == '/showmenu' && msg['user'] == cb.room_slug) { cb.chatNotice('-----' + cb.room_slug + 's Tip Menu -----'); for (var i = 0; i < listMenu.length; i++) { cb.chatNotice(listMenu[i]); } } return msg; }); // Display Panels cb.onDrawPanel(function(user) { if (cb.settings.goal === 0) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Tip Menu Active!', 'row1_value': 'Type /menu to see it.', 'row2_label': 'Highest Tip:', 'row2_value': nullCheck(ht_username) + '(' + ht_amount + ')', 'row3_value': 'Tip ' + cb.settings.price1 + 'tks For "' + cb.settings.item1 + '"' }; } if (cb.settings.reset === "Yes") { return { 'template': '3_rows_12_22_31', 'row1_label': 'Goal:', 'row1_value': goal_tips + '/' + cb.settings.goal + '(' + total_tips + ')', 'row2_label': 'Tip Menu is Active!', 'row2_value': 'Type /menu to see it', 'row3_value': 'Tip ' + cb.settings.price1 + 'tks For "' + cb.settings.item1 + '"' }; } else { return { 'template': '3_rows_12_22_31', 'row1_label': 'Goal:', 'row1_value': goal_tips + '/' + cb.settings.goal, 'row2_label': 'Tip Menu is Active!', 'row2_value': 'Type /menu to see it', 'row3_value': 'Tip ' + cb.settings.price1 + 'tks For "' + cb.settings.item1 + '"' }; } }); // Makings of the Menu var menu1 = '' + cb.settings.item1 + ' For ' + cb.settings.price1 + 'tks '; var menu2 = '' + cb.settings.item2 + ' For ' + cb.settings.price2 + 'tks '; var menu3 = '--------'; var menu4 = '-------'; var menu5 = '------'; var menu6 = '-----'; var menu7 = '----'; var menu8 = '---'; var menu9 = '--'; var menu10 = '-'; if (cb.settings.price3 !== undefined) { menu3 = '' + cb.settings.item3 + ' For ' + cb.settings.price3 + 'tks '; } if (cb.settings.price4 !== undefined) { menu4 = '' + cb.settings.item4 + ' For ' + cb.settings.price4 + 'tks '; } if (cb.settings.price5 !== undefined) { menu5 = '' + cb.settings.item5 + ' For ' + cb.settings.price5 + 'tks '; } if (cb.settings.price6 !== undefined) { menu6 = '' + cb.settings.item6 + ' For ' + cb.settings.price6 + 'tks '; } if (cb.settings.price7 !== undefined) { menu7 = '' + cb.settings.item7 + ' For ' + cb.settings.price7 + 'tks '; } if (cb.settings.price8 !== undefined) { menu8 = '' + cb.settings.item8 + ' For ' + cb.settings.price8 + 'tks '; } if (cb.settings.price9 !== undefined) { menu9 = '' + cb.settings.item9 + ' For ' + cb.settings.price9 + 'tks '; } if (cb.settings.price10 !== undefined) { menu10 = '' + cb.settings.item10 + ' For ' + cb.settings.price10 + 'tks '; } var listMenu = [menu1, menu2, menu3, menu4, menu5, menu6, menu7, menu8, menu9, menu10]; // Function Junction function update_app() { if (cb.settings.goal === 0) {} else if (goal_tips >= cb.settings.goal) { goal_reached(); } } function goal_reached() { if (tips_remaining() === 0) { if (cb.settings.reset === "Yes") { reset_goal(); } else; goal += 1; { if (goal <= 1) { cb.chatNotice("Goal Reached! " + cb.settings.goalAd); } } } } function reset_goal() { goal_tips -= cb.settings.goal; goal -= 1; } function tips_remaining() { var r = cb.settings.goal - goal_tips; if (r < 0) { return 0; } else { return r; } } function nullCheck(str) { if (str === null) { return "---"; } else return str.substring(0, 15); } function chatAd() { cb.chatNotice('/// Tip Menu Is Active! Tip ' + cb.settings.price1 + 'tks for "' + cb.settings.item1 + '" Or, Type /menu to see the full menu.'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } if (cb.settings.chat_ad > 0) { cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } function init() { update_app(); } init(); // Thanks for checking out my code!
© Copyright Freesexcam 2011- 2024. All Rights Reserved.