Apps Home
|
Create an App
Beat the king
Author:
anoxxx
Description
Source Code
Launch App
Current Users
Created by:
Anoxxx
// vars var total_tipped = 0; var high_tip_username = null; var high_tip_amount = 0; var dark_blue = null; var possibles = new Array(); var cep = 4; var d1 = 0; var d2 = 0; var d3 = 0; var d4 = 0; var d5 = 0; var game_score = 0; var cep_calc = 0; var tippers = new Array(); var cep_change = 0; cb.settings_choices = [ {name: 'game_score_goal', type: 'int', minValue: 1, default: 1011}, {name: 'goal_description', type: 'str', minLength: 1, maxLength: 255, default: 'Toss darts at the center of the board by tipping to reach game score goal. At goal, I will do something interesting'} ]; // handlers cb.onMessage(function (msg) { if (msg['user'] == 'elle_sterling') { msg['background'] = "#FF69B4"; } if (msg['user'] == 'steedj') { msg['background'] = "#90EE90"; msg['c'] = "#000000"; } if (msg['user'] == 'ellelover') { msg['background'] = "#00BFFF"; } if (msg['user'] == 'snowpup_1011') { msg['background'] = "#A2E3E8" msg['c'] = "#0000FF"; } if (msg['user'] == 'muddywaters1') { msg['c'] = "#000000"; } if(msg['tipped_recently'] == true && msg['in_fanclub'] == true) { dark_blue = msg['user']; } if(msg['m'] == "/list" && msg['user'] == "elle_sterling") { msg['X-Spam'] = true; cb.chatNotice(dark_blue + " is a dark blue fan club member", msg['user']); } if(msg['m'] == "/list" && msg['user'] == "snowpup_1011") { msg['X-Spam'] = true; cb.chatNotice(dark_blue + " is a dark blue fan club member", msg['user']); } if(msg['m'] == "/list" && msg['user'] == "muddywaters1") { msg['X-Spam'] = true; cb.chatNotice(dark_blue + " is a dark blue fan club member", msg['user']); } if(msg['m'] == "/cep") { msg['X-Spam'] = true; cb.chatNotice("On a scale of 1 to 5 with 5 being least accurate, your accuracy is now " + tippers[tippers.indexOf(msg['user']) + 1], msg['user']); } if(msg['m'] == "/change") { msg['X-Spam'] = true; cb.chatNotice(cep, msg.user); } if(msg['m'] == "/rules") { msg['X-Spam'] = true; cb.chatNotice("Goal is met when the game score is at least" + cb.settings.game_score_goal+". Take shots at the center of the target which does not yet exist in a graphical form and the game score will change based upon how far you are from the center. Max value, of course, to bullseyes and you can miss the board which decreases the game score. Your accuracy will improve as you continue to tip. Type /cep to see your current level of accuracy.", msg.user); } return msg; }); cb.onTip(function(tip) {total_tipped += tip['amount']; cb.chatNotice("Tip message: "+tip['message'],'snowpup_1011'); cb.chatNotice("Tip message: "+tip['message'],'muddywaters1'); if (tippers.indexOf(tip['from_user']) != -1) {cep ==tippers[ tippers.indexOf(tip['from_user'])+1]} else {tippers.push(tip['from_user'], 5); cep = 5} //cep_calc = Math.floor(Math.random()*100); //if(cep_calc <11) //{cep == 5} //else if(cep_calc>10 && cep_calc<31) //{cep == 4} //else if(cep_calc>30 && cep_calc<71) //{cep == 3} //else if(cep_calc>70 && cep_calc<91) //{cep == 2} //else if(cep_calc>90) //{cep == 1}; if(cep = 5) {d1 = Math.abs(Math.floor(Math.random()*10)-5); d2 = Math.abs(Math.floor(Math.random()*10)-5); d3 = Math.max(d1,d2); } else if(cep = 4) {d1 = Math.floor(Math.random()*8)+1; d2 = Math.floor(Math.random()*8)+1; d1 == Math.abs(d1-5); d2 == Math.abs(d2-5); d3 = Math.max(d1,d2); } else if(cep = 3) {d1 = Math.floor(Math.random()*6)+2; d2 = Math.floor(Math.random()*6)+2; d1 == Math.abs(d1-5); d2 == Math.abs(d2-5); d3 = Math.max(d1,d2); } else if(cep = 2) {d1 = Math.floor(Math.random()*4)+3; d2 = Math.floor(Math.random()*4)+3; d1 == Math.abs(d1-5); d2 == Math.abs(d2-5); d3 = Math.max(d1,d2); } else if(cep = 1) {d1 = Math.floor(Math.random()*2)+4; d2 = Math.floor(Math.random()*2)+4; d1 == Math.abs(d1-5); d2 == Math.abs(d2-5); d3 = Math.max(d1,d2); } if(d3>4) {game_score -= tip['amount']; cb.chatNotice("Oh, sorry, "+tip['from_user']+", your dart missed the board completely and lowered the game score. The good news is, your accuracy may be better next time."); } if(d3==4) {game_score += tip['amount']/4; cb.chatNotice("Four from the bullseye "+tip['from_user']+". Try again!")}; if(d3==3) {game_score += tip['amount']/3; cb.chatNotice("Three away from the bullseye "+tip['from_user']+". Tip again!")}; if(d3==2) {game_score += tip['amount']/2; cb.chatNotice("Not bad, "+tip['from_user']+". Only two from the center of the board!")}; if(d3==1) {game_score += tip['amount']; cb.chatNotice("Very close, "+tip['from_user']+"!")}; if(d3==0) {game_score += tip['amount']*2; cb.chatNotice("A BULLSEYE by "+tip['from_user']+". The game score gets a nice increase!")}; if (cep>1) {cep_change = Math.floor(Math.random()*100); if (cep_change < 25) {tippers[tippers.indexOf(tip['from_user'])+1] -=1}; cep -=1; cb.chatNotice(d1); cb.chatNotice(d2); cb.chatNotice("cep "+cep); cb.chatNotice("change "+cep_change); } update_subject(); if (tip['amount'] > high_tip_amount) { high_tip_amount = tip['amount'] high_tip_username = tip['from_user'] } cb.drawPanel(); }); cb.onDrawPanel(function(user) { if(game_score < cb.settings.game_score_goal) {return { 'template': '3_rows_of_labels', 'row1_label': 'Game Score / Goal :', 'row1_value': '' + Math.round(game_score)+ ' / ' + cb.settings.game_score_goal, 'row2_label': 'Highest Tip:', 'row2_value': format_username(high_tip_username) + ' (' + high_tip_amount + ')', 'row3_label': 'Tokens Received:', 'row3_value': +total_tipped }} else {return { 'template': '3_rows_of_labels', 'row1_label': 'GAME OVER :', 'row1_value': '' + cb.settings.game_score_goal, 'row2_label': 'Highest Tip:', 'row2_value': format_username(high_tip_username) + ' (' + high_tip_amount + ')', 'row3_label': 'Tokens Received:', 'row3_value': +total_tipped }} }); // helper functions function update_subject() { if (game_score >= cb.settings.game_score_goal) { var new_subject = "GOAL COMPLETE! Thank you everyone"; cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject); } else {var new_subject = cb.settings.goal_description + ". A board is under development. For now, just use your imagination. Type /rules for more information or /cep to check your current level of accuracy"; cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject) } } function tips_remaining() { var r = cb.settings.tokens - total_tipped; if (r < 0) { return 0; } else { return r; } } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } function init() { update_subject(); } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.