Apps Home
|
Create an App
Stdflrs app
Author:
tripper234
Description
Source Code
Launch App
Current Users
Created by:
Tripper234
/* Guess The Number */ // vars var total_tipped = 0; var last_tip_username = null; var high_tip_username = null; var high_tip_amount = 300; var low_tip_username = null; var low_tip_amount = 1; var last_tip_username = null; var last_tip_amount = 0; var numberGuessedCorrectly = false; cb.settings_choices = [ {name: 'Guess_The_Number', type: 'int', minValue: 1, maxValue: 300}, {name: 'Prize', type: 'str', minLength: 1, maxLength: 511, default: "Naked With Dildo Play!!!"} ]; // handlers cb.onTip(function(tip) { total_tipped += tip['amount'] last_tip_user = tip['from_user'] if (tip['amount'] == cb.settings.Guess_The_Number) { last_tip_username = tip['from_user'] numberGuessedCorrectly = true } else if (tip['amount'] > cb.settings.Guess_The_Number) { if (tip['amount'] < high_tip_amount) { high_tip_amount = tip['amount'] high_tip_username = tip['from_user'] } high_tip_username = tip['from_user'] high_tip_amount = tip['amount'] } else if (tip['amount'] < cb.settings.Guess_The_Number) { if (tip['amount'] > low_tip_amount) { low_tip_amount = tip['amount'] low_tip_username = tip['from_user'] } last_tip_username = tip['from_user'] last_tip_amount = tip['amount'] } update_App(); cb.drawPanel(); }); cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Tips Received:', 'row1_value': total_tipped, 'row2_label': 'Guess The Number Between 1-300:', 'row2_value': format_username(low_tip_username) + '(' + low_tip_amount + ')', 'row3_label': 'Guess The Correct Number And Win The Prize:', 'row3_value': format_username(high_tip_username) + '(' + high_tip_amount + ')' }; }); // helper functions function update_App() { if (numberGuessedCorrectly == true) { var new_subject = "We have a winner!. " + last_tip_username + " has guessed the correct number, " + cb.settings.Magic_Number + "! \nThe winner gets: " + cb.settings.Prize + "."; } else { var new_subject = "Guess Stdflr's magic number." + " Stdflr's current Low Number: " + low_tip_amount + "." + " Stdflr's current High Number: " + high_tip_amount + "." + " \nThe winner gets: " + cb.settings.Prize + "."; } cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject) } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } function init() { update_App(); } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.