Apps Home
|
Create an App
Whac-a-Tip
Author:
rubzombie
Description
Source Code
Launch App
Current Users
Created by:
Rubzombie
// startof CBSv2 module - not for re-compilation (function(a,k){function g(a){this.message=a}g.prototype=Error();g.prototype.name="InvalidCharacterError";a.btoa||(a.btoa=function(a){a=String(a);for(var f,b,n=0,c=k,q="";a.charAt(n|0)||(c="=",n%1);q+=c.charAt(63&f>>8-n%1*8)){b=a.charCodeAt(n+=.75);if(255<b)throw new g('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');f=f<<8|b}return q});a.atob||(a.atob=function(a){a=String(a).replace(/=+$/,"");if(1==a.length%4)throw new g('"atob" failed: The string to be decoded is not correctly encoded.'); for(var f=0,b,n,c=0,q="";n=a.charAt(c++);~n&&(b=f%4?64*b+n:n,f++%4)?q+=String.fromCharCode(255&b>>(-2*f&6)):0)n=k.indexOf(n);return q})})("undefined"===typeof exports?this:exports,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="); (function(a){var k=cb.onMessage,g=null,u=null,f,b="#"+(cb.settings.hasOwnProperty("slot")?cb.settings.slot:"")+"CBSv2",n=/^\/#[0-3]CBSv2\//;cb.log("CBS::v2::CB app/bot data Save/restore::20170923.009::Release");cb.onMessage=function(c){if("function"!==typeof c)throw new TypeError(c+" is not a function");k(function(k){var d=k.m.replace(/\s*/g,"").split("/");if(3<d.length&&""===d[0]&&d[1]===b){if(g&&u&&k.user===cb.room_slug){var p=d[2];if(4===d.length)d[3]="?",k.m=d.join("/");else if(6===d.length){if(!(f|| {}).hasOwnProperty(p)){var q=g();f={};f[p]=a.btoa(a.unescape(a.encodeURIComponent(q)));q||cb.log("onSave returned no data.")}f.hasOwnProperty(p)&&(q=parseInt(d[3],10),p=f[p].slice(q,q+512),d[4]=p,d[5]=p.length,k.m=d.join("/"))}else 7===d.length&&("0"===d[3]&&(f={},f[p]=""),f.hasOwnProperty(p)&&(d[3]=f[p].length,d[6]=d[4].length,k.m=d.join("/"),d[4]?f[p]+=d[4]:(q=a.decodeURIComponent(a.escape(a.atob(f[p]))),u(q),cb.chatNotice("Previously Saved Data Restored.",cb.room_slug))))}k["X-Spam"]=!0}else n.test(k.m)&& (k["X-Spam"]=!0);return c(k)});return c};cb.onRestore=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return u=a};cb.onSave=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return g=a};cb.onMessage(function(a){return a})})("undefined"===typeof exports?this:exports); // endof CBSv2 module - not for re-compilation var b="Easy;;Not So Easy;;Hard;;;;Extreme".split(";"),c=0,d=null,g={},h=0,k=0,l=0,m=0,n=0,p=0,q=0,r=null,s={template:"3_rows_11_21_31",row1_label:"...",row1_value:"Whac-a-Tip",row2_label:"...",row2_value:"...",row3_label:"...",row3_value:"Hit the Whac-a-Tip to win a prize!"};function t(a){return!(""===a||void 0===a||null===a)}function w(){var a=cb.room_slug;return a?a+"'s":"the"}function x(a){return"#"+a.toLowerCase().replace(/[^a-z0-9_]+/g,"-")+" "} function y(a,e){e&&"string"===typeof e&&e.length?cb.sendNotice("Whac-a-Tip: "+a,e,"#dc5500","#ffffff","bold"):cb.sendNotice("Whac-a-Tip: "+a,"","#d5ebf8","#6900cc","bold")} function z(){q&&(s.row1_value="Whac-a-Tip Total : "+q);null===d&&(d=cb.settings.hasOwnProperty("slot")&&cb.settings.slot);c||(n=c=cb.settings.tip_bias||10,m=n+100-10);p||(p=b.indexOf(cb.settings.gameplay)+2||2);var a;a="";r?"Game over!"!==s.row3_value&&(s.row2_value=[r,"wins!"].filter(t).join(" "),s.row3_value="Game over!",a=["Game over!",r,"hit",w(),x("Whac-a-Tip"),h,"and wins the",x(cb.settings.prize||""),"prize!"].filter(t).join(" ")):(h?(l=l<n?0:l,k=k>m?0:k,a=!0):(h=n+Math.floor(Math.random()* (m-n+1)),y("For Broadcaster-eyes Only: "+h,cb.room_slug),a=0+Math.floor(Math.random()*(p-0+1)),(l=h-a)<n?(l=n,k=l+p):(k=l+p)>m&&(k=m,l=k-p),a=!1),a=a?[l||"",k||""].filter(t).join(" / "):l+" .. "+k,s.row2_value!==a&&(s.row2_value=a),a=["Hit",w(),x("Whac-a-Tip"),a,"and win the",x(cb.settings.prize||""),"prize.",cb.settings.specials?"[ "+cb.settings.specials+" ]":""].filter(t).join(" "));d||cb.drawPanel();z.hasOwnProperty("subject")||(cb.log("Whac-a-Tip: by: rubzombie, version: 08/01/2014.2, dedication: for aly"), z.subject="");a&&z.subject!==a&&(d?y(a):cb.changeRoomSubject(a),z.subject=a)}cb.settings_choices=[{label:"Whac-a-Tip Prize (e.g. Private show)",maxLength:511,minLength:1,name:"prize",type:"str"},{defaultValue:10,label:"Whac-a-Tip Minimum Tip",minValue:10,name:"tip_bias",required:!1,type:"int"}]; cb.settings_choices.push(new (Function.prototype.bind.apply(function(a,e,v,A){var f,u=arguments.length-4;if(1<u&&-1<Array.prototype.slice.call(arguments).indexOf(A,4))for(f=0;f<u;f++)this["choice"+(f+1)]=arguments[f+4];else for(u++,f=0;f<u;f++)this["choice"+(f+1)]=arguments[f+3];this.defaultValue=A;this.label=a;this.name=e;null===v||v||(this.required=!!v);this.type="choice"},[null,"Gameplay","gameplay",!1].concat(["Not So Easy"],b.filter(t))))); cb.settings_choices.push({label:"Whac-a-Tip Specials (e.g. #topless @200, #naked @500, #play @1000)",minLength:1,name:"specials",required:!1,type:"str"}); cb.onTip(function(a){var e=a.amount;a=a.from_user;q+=e;r?g.hasOwnProperty(a)||(y("Hudson: Game over, man! Game over!",a),g[a]=!0):e===h?(r=a,y("!! Hit !!")):e-1===h?(l=h,k=2>k-h?0:h+2,y("!! Near-miss !! Whac-a-Tip frozen for the next /tip")):e+1===h?(l=2>h-l?0:h-2,k=h,y("!! Near-miss !! Whac-a-Tip frozen for the next /tip")):(h=0,y("!! Miss !! /tip to hit the *NEW* Whac-a-Tip"));z()});cb.onDrawPanel(function(){return s});cb.onMessage(function(a){r&&r===a.user&&!d&&(a.m="\u2606 : "+a.m);return a}); z();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.