Apps Home
|
Create an App
ZebraWheel
Author:
mrgoogles
Description
Source Code
Launch App
Current Users
Created by:
Mrgoogles
// Ripped off PonyWheel, // removed "sorry announcement", // renamed app to ZebraWheel, // removed traces to Caylin's room // clean up some code (not enough) // For Sammie :) http://chaturbate.com/sammiecee/ // var cb = {}; // jslint var total_tipped=0; var multiMessage='Disabled!'; var lastspinby='nobody'; var GoalTipTracking=[]; var RewardsTracking=[]; var RewardsTrackingCount=0; var times_goal_reached=0; var last_time_goal_reached=null; var current_goal_tipped=0; cb.settings_choices=[ { name:'autogoalresetactive',type:'choice',label:'Auto-Reset Tip Goal',choice1:'Enabled',choice2:'Disabled',defaultValue:'Disabled' }, { name:'tokens',type:'int',minValue:1,defaultValue:100,label:'Token Goal' }, { name:'goal_description',type:'str',minLength:1,maxLength:255,label:'Goal Description' }, { name:'goalspinsebrawheel',type:'choice',label:'Spin ZebraWheel at every goal',choice1:'Yes',choice2:'No',defaultValue:'No' }, { name:'tokensprogress',type:'int',minValue:0,defaultValue:0,label:'Tokens in Jar from start' }, { name:'skiptipamounts',type:'str',minLength:0,maxLength:1024,label:'Tip amounts not to count (eg. \'599,666,999,1234,5000\')',required:false }, { name:'sebrawheelactive',type:'choice',label:'ZebraWheel of Fortune',choice1:'Enabled',choice2:'Disabled',defaultValue:'Disabled' }, { name:'announcewheelonenter',type:'choice',label:'Announce ZebraWheel when blues enter the room',choice1:'Yes',choice2:'No',defaultValue:'No' }, { name:'cost_per_spin',type:'int',minValue:1,maxValue:999,defaultValue:50,label:'Cost per Spin of the ZebraWheel (1-999)' }, { name:'advertise_in_chat',type:'int',minValue:0,maxValue:999,defaultValue:10,label:'How often to advertise ZebraWheel: (min) (0=never)' }, { name:'multispin_count',type:'int',minValue:1,maxValue:999,defaultValue:5,label:'How many Multi-Spins to allow? (1-999)' }, { name:'wheelemailtxt',type:'str',minLength:1,maxLength:255,label:'Text to ask for email:',defaultValue:'USERNAME please write your email-address in a 1 token tip-note' }, { name:'pos1',type:'str',minLength:1,maxLength:255,label:'Reward 1',required:false }, { name:'pos1action',type:'choice',label:'Reward 1 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos2',type:'str',minLength:1,maxLength:255,label:'Reward 2',required:false }, { name:'pos2action',type:'choice',label:'Reward 2 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos3',type:'str',minLength:1,maxLength:255,label:'Reward 3',required:false }, { name:'pos3action',type:'choice',label:'Reward 3 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos4',type:'str',minLength:0,maxLength:255,label:'Reward 4',required:false }, { name:'pos4action',type:'choice',label:'Reward 4 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos5',type:'str',minLength:0,maxLength:255,label:'Reward 5',required:false }, { name:'pos5action',type:'choice',label:'Reward 5 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos6',type:'str',minLength:0,maxLength:255,label:'Reward 6',required:false }, { name:'pos6action',type:'choice',label:'Reward 6 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos7',type:'str',minLength:0,maxLength:255,label:'Reward 7',required:false }, { name:'pos7action',type:'choice',label:'Reward 7 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos8',type:'str',minLength:0,maxLength:255,label:'Reward 8',required:false }, { name:'pos8action',type:'choice',label:'Reward 8 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos9',type:'str',minLength:0,maxLength:255,label:'Reward 9',required:false }, { name:'pos9action',type:'choice',label:'Reward 9 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos10',type:'str',minLength:0,maxLength:255,label:'Reward 10',required:false }, { name:'pos10action',type:'choice',label:'Reward 10 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos11',type:'str',minLength:0,maxLength:255,label:'Reward 11',required:false }, { name:'pos11action',type:'choice',label:'Reward 11 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos12',type:'str',minLength:0,maxLength:255,label:'Reward 12',required:false }, { name:'pos12action',type:'choice',label:'Reward 12 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos13',type:'str',minLength:0,maxLength:255,label:'Reward 13',required:false }, { name:'pos13action',type:'choice',label:'Reward 13 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos14',type:'str',minLength:0,maxLength:255,label:'Reward 14',required:false }, { name:'pos14action',type:'choice',label:'Reward 14 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos15',type:'str',minLength:0,maxLength:255,label:'Reward 15',required:false }, { name:'pos15action',type:'choice',label:'Reward 15 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos16',type:'str',minLength:0,maxLength:255,label:'Reward 16',required:false }, { name:'pos16action',type:'choice',label:'Reward 16 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos17',type:'str',minLength:0,maxLength:255,label:'Reward 17',required:false }, { name:'pos17action',type:'choice',label:'Reward 17 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos18',type:'str',minLength:0,maxLength:255,label:'Reward 18',required:false }, { name:'pos18action',type:'choice',label:'Reward 18 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos19',type:'str',minLength:0,maxLength:255,label:'Reward 19',required:false }, { name:'pos19action',type:'choice',label:'Reward 19 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos20',type:'str',minLength:0,maxLength:255,label:'Reward 20',required:false }, { name:'pos20action',type:'choice',label:'Reward 20 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos21',type:'str',minLength:0,maxLength:255,label:'Reward 21',required:false }, { name:'pos21action',type:'choice',label:'Reward 21 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos22',type:'str',minLength:0,maxLength:255,label:'Reward 22',required:false }, { name:'pos22action',type:'choice',label:'Reward 22 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos23',type:'str',minLength:0,maxLength:255,label:'Reward 23',required:false }, { name:'pos23action',type:'choice',label:'Reward 23 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos24',type:'str',minLength:0,maxLength:255,label:'Reward 24',required:false }, { name:'pos24action',type:'choice',label:'Reward 24 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos25',type:'str',minLength:0,maxLength:255,label:'Reward 25',required:false }, { name:'pos25action',type:'choice',label:'Reward 25 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos26',type:'str',minLength:0,maxLength:255,label:'Reward 26',required:false }, { name:'pos26action',type:'choice',label:'Reward 26 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos27',type:'str',minLength:0,maxLength:255,label:'Reward 27',required:false }, { name:'pos27action',type:'choice',label:'Reward 27 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos28',type:'str',minLength:0,maxLength:255,label:'Reward 28',required:false }, { name:'pos28action',type:'choice',label:'Reward 28 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos29',type:'str',minLength:0,maxLength:255,label:'Reward 29',required:false }, { name:'pos29action',type:'choice',label:'Reward 29 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos30',type:'str',minLength:0,maxLength:255,label:'Reward 30',required:false }, { name:'pos30action',type:'choice',label:'Reward 30 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos31',type:'str',minLength:0,maxLength:255,label:'Reward 31',required:false }, { name:'pos31action',type:'choice',label:'Reward 31 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos32',type:'str',minLength:0,maxLength:255,label:'Reward 32',required:false }, { name:'pos32action',type:'choice',label:'Reward 32 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos33',type:'str',minLength:0,maxLength:255,label:'Reward 33',required:false }, { name:'pos33action',type:'choice',label:'Reward 33 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos34',type:'str',minLength:0,maxLength:255,label:'Reward 34',required:false }, { name:'pos34action',type:'choice',label:'Reward 34 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' }, { name:'pos35',type:'str',minLength:0,maxLength:255,label:'Reward 35',required:false }, { name:'pos35action',type:'choice',label:'Reward 35 action',choice1:'No Action',choice2:'Track Reward',choice3:'Request email in tip note',choice4:'Track and Request email',defaultValue:'No Action' } ]; //if ((cb.room_slug!="caylin")&&(cb.room_slug!="palmiotest")&&(cb.room_slug!="palmiotest4")) { //sorryannouncement() //} var temp = [cb.settings.pos1,cb.settings.pos2,cb.settings.pos3,cb.settings.pos4,cb.settings.pos5,cb.settings.pos6,cb.settings.pos7,cb.settings.pos8,cb.settings.pos9,cb.settings.pos10,cb.settings.pos11,cb.settings.pos12,cb.settings.pos13,cb.settings.pos14,cb.settings.pos15,cb.settings.pos16,cb.settings.pos17,cb.settings.pos18,cb.settings.pos19,cb.settings.pos20,cb.settings.pos21,cb.settings.pos22,cb.settings.pos23,cb.settings.pos24,cb.settings.pos25,cb.settings.pos26,cb.settings.pos27,cb.settings.pos28,cb.settings.pos29,cb.settings.pos30,cb.settings.pos31,cb.settings.pos32,cb.settings.pos33,cb.settings.pos34,cb.settings.pos35]; var tempp = [cb.settings.pos1action,cb.settings.pos2action,cb.settings.pos3action,cb.settings.pos4action,cb.settings.pos5action,cb.settings.pos6action,cb.settings.pos7action,cb.settings.pos8action,cb.settings.pos9action,cb.settings.pos10action,cb.settings.pos11action,cb.settings.pos12action,cb.settings.pos13action,cb.settings.pos14action,cb.settings.pos15action,cb.settings.pos16action,cb.settings.pos17action,cb.settings.pos18action,cb.settings.pos19action,cb.settings.pos20action,cb.settings.pos21action,cb.settings.pos22action,cb.settings.pos23action,cb.settings.pos24action,cb.settings.pos25action,cb.settings.pos26action,cb.settings.pos27action,cb.settings.pos28action,cb.settings.pos29action,cb.settings.pos30action,cb.settings.pos31action,cb.settings.pos32action,cb.settings.pos33action,cb.settings.pos34action,cb.settings.pos35action]; var rewards = []; var rewardsaction = []; var i; for(i=0; i<temp.length; i++) { if (temp[i]!='') { rewards.push(temp[i]); rewardsaction.push(tempp[i]); } } function repeatStr(string, counter) { var temp='', x; for(x=1; x <= counter; x++) { temp += string; } return temp; } function updatepanel() { cb.setTimeout(updatepanel,20000); cb.drawPanel(); } function advert() { var lsb=lastspinby.substring(0,14); var out=''; // out+=cb.room_slug+'\'s ZebraWheel [by palmio, edit by mrgoogles]'+' \u00bb Last Spin by: '+lsb+'\n'; out+=cb.room_slug+'\'s ZebraWheel'+' \u00bb Last Spin by: '+lsb+'\n'; out+='Tip '+cb.settings.cost_per_spin+' to Play \u2022 Type \'/rewards\' to see rewards'; cb.chatNotice(out,'','','#0000ff','normal'); cb.setTimeout(advert,(cb.settings.advertise_in_chat*60000)); } function getNumberString(number) { var numberString=null; if (number==1) { numberString="1st"; } else if (number==2) { numberString="2nd"; } else if (number==3) { numberString="3rd"; } else { numberString=""+number+"th"; } return numberString; } function tips_remaining() { var r = cb.settings.tokens-current_goal_tipped; if (r<0) { return 0; } return r; } function sleep(milliseconds) { var start=new Date().getTime(); var i; for(i=0; i<1e7; i++) { if ((new Date().getTime()-start)>milliseconds) { break; } } } //function sorryannouncement() { //cb.chatNotice('Sorry, the ZebraWheel was made for Caylin\'s room, it has become very room specific, please make your own Application','','','#ff0000','bold'); //cb.setTimeout(sorryannouncement,20000); //} function update_subject() { var new_subject=cb.settings.goal_description+" ["+tips_remaining()+" tokens remaining]"; cb.changeRoomSubject(new_subject); } function showStartupMessage(userName) { if (cb.settings.sebrawheelactive!='Enabled') { return; } var lsb=lastspinby.substring(0,14), out='', x; out+=repeatStr('\u2014',31)+'\n'; // out+="ZebraWheel [by palmio, edit by mrgoogles]"+'\n'; out+="ZebraWheel"+'\n'; out+=repeatStr('\u2014',31)+'\n'; out+='\u203a'+' Spin Cost: '+cb.settings.cost_per_spin+' tokens'+'\n'; out+='\u203a'+' Multi-Spin: '+multiMessage+'\n'; out+='\u203a'+' Last Spin by: '+lsb+'\n'+'\n'; for(x=0; x < rewards.length; x++) { out+=' Reward '+(x+1)+': '+rewards[x]+'\n'; } out+=repeatStr('\u2014',31)+'\n'; out+=' Good Luck and Have Fun. '+'\n'; out+=repeatStr('\u2014',31); if (userName.length>0) { cb.chatNotice(out,userName); } else { cb.chatNotice(out); out='You ('+cb.room_slug+') can type \'/spin UserName\' to force a spin'+'\n'; out+='You and Mods can type \'/rewards all\' to send Rewards List to all users'+'\n'; out+='You and Mods can type \'/help\' or \'/phelp\' or \'/apphelp\' to get a list of available commands'+''; cb.chatNotice(out,cb.room_slug,'','#ff0000','bold'); } } function showStartupMessageNew(userName) { if (cb.settings.sebrawheelactive!='Enabled') { return; } var out=''; out+=repeatStr('\u2014',31)+'\n'; //out+='\u203a '+"ZebraWheel [by palmio, edit by mrgoogles]"+'\n'; out+='\u203a '+"ZebraWheel"+'\n'; out+=repeatStr('\u2014',31)+'\n'; out+='\u203a '+'Spin Cost: '+cb.settings.cost_per_spin+' tokens'+'\n'; out+='\u203a '+'Type \'/rewards\' to see rewards'+'\n'; out+=repeatStr('\u2014',31); if (userName.length>0) { cb.chatNotice(out, userName); } else { cb.chatNotice(out,'','','','bold'); out='You ['+cb.room_slug+'] can type \'/spin UserName\' to force a spin'+'\n'; out+='You and Mods can type \'/rewards all\' to send Rewards List to all users'+'\n'; out+='You and Mods can type \'/help\' or \'/phelp\' or \'/apphelp\' to get a list of available commands'+''; cb.chatNotice(out,cb.room_slug,'','#ff0000','bold'); } } function trackReward(userName, rewardwon) { RewardsTrackingCount+=1; RewardsTracking[RewardsTrackingCount]=rewardwon+" ["+userName+"]"; cb.chatNotice('Tracking Reward. type \'/tracklist\' to list the tracking list.',cb.room_slug,'','#0000FF','bolder'); } function spinWheel(userName, forced) { if ((cb.settings.sebrawheelactive!='Enabled')&&(forced!=1)) { return; } var out='', randomnumber, message; if(forced==0) { lastspinby=userName; } if (userName=='forced') { userName=cb.room_slug; } out+=repeatStr('\u2014',30)+'\n'; out+='\u203a'+' Spinning the ZebraWheel for '+userName+'\n'; randomnumber=Math.floor(Math.random()*(rewards.length)); out+='\u203a'+' Stopped on: '+rewards[randomnumber]+'\n'; out+=repeatStr('\u2014',30); cb.chatNotice(out,'','#dfffb2','','bold'); if ((rewardsaction[randomnumber]=="Request email in tip note")||(rewardsaction[randomnumber]=="Track and Request email")) { if (userName!=cb.room_slug) { message=cb.settings.wheelemailtxt.replace('USERNAME',userName); cb.chatNotice(message,userName,'','#FF0000','bolder'); cb.chatNotice('\'Request email\'-message have been sent to '+userName,cb.room_slug,'','#0000FF','normal'); } } if ((rewardsaction[randomnumber]=="Track Reward")||(rewardsaction[randomnumber]=="Track and Request email")) { trackReward(userName,rewards[randomnumber]); } } function trackListRewards() { var out="", i; for(i=1; i < RewardsTracking.length; i++) { if (RewardsTracking[i] !== undefined) { out+='#'+i+': '+RewardsTracking[i]+'\n'; } } if (out!='') { out=repeatStr('\u2014',30)+'\n'+'Rewards Tracking'+'\n'+repeatStr('\u2014',30)+'\n'+out; out+='\n'+'To remove #154 type \'/untrack 154\'.'+'\n'+repeatStr('\u2014',30); cb.chatNotice(out,cb.room_slug,'','','normal'); } else { cb.chatNotice("Tracking list is empty!",cb.room_slug,'','#0000FF','bold'); } } function trackRemove(id) { if (RewardsTracking[id] !== undefined) { RewardsTracking[id]=undefined; cb.chatNotice('#'+id+' removed from tracking.',cb.room_slug,'','#0000FF','bolder'); trackListRewards(); } else { cb.chatNotice('#'+id+' does not exist.',cb.room_slug,'','#FF0000','bolder'); } } function orderByTipsDescending(a, b) { if (a.tips == b.tips) { return 0; } if (a.tips < b.tips) { return 1; } return -1; } function goalSpins(gospin) { var i, userSpinnerName, userSpinnerTips; for(i=1; i<=gospin; i++) { GoalTipTracking.sort(orderByTipsDescending); userSpinnerName=GoalTipTracking[0].name; userSpinnerTips=GoalTipTracking[0].tips; if (userSpinnerTips<cb.settings.tokens) { GoalTipTracking.splice(0,1); } else { for(i in GoalTipTracking) { if (GoalTipTracking.hasOwnProperty(i)) { if (GoalTipTracking[i].name==userSpinnerName) { GoalTipTracking[i].tips-=cb.settings.tokens; } } } } spinWheel(userSpinnerName, 0); } } function tipAddRemove(amount, action) { if (amount<1) { cb.chatNotice('command failed (illegal amount!)',cb.room_slug,'','#FF0000','bold'); return; } if (action=='remove') { current_goal_tipped-=amount; cb.chatNotice(amount+' tokens subtracted from room goal',cb.room_slug,'','#FF0000','bold'); } if (action=='add') { current_goal_tipped+=amount; cb.chatNotice(amount+' tokens added to room goal',cb.room_slug,'','#FF0000','bold'); } while(current_goal_tipped>=cb.settings.tokens) { current_goal_tipped-=cb.settings.tokens; times_goal_reached+=1; last_time_goal_reached=new Date(); } while(current_goal_tipped<0) { current_goal_tipped+=cb.settings.tokens; times_goal_reached-=1; } if (times_goal_reached<0) { current_goal_tipped=0; times_goal_reached=0; } update_subject(); cb.drawPanel(); } function showHelp(type, userName) { var out=""; out+=repeatStr('\u2014',31)+'\n'; // out+=cb.room_slug+'\'s ZebraWheel [by palmio, edit by mrgoogles]'+'\n'; out+=cb.room_slug+'\'s ZebraWheel [by mrgoogles]'+'\n'; out+=repeatStr('\u2014',31)+'\n'; if (type=="broadcaster") { out+='\'/spin UserName\' to force a spin'+'\n'; out+='\'/addtokens xxx\' to add xxx tokens to the total room goal'+'\n'; out+='\'/addtokens -xxx\' to remove xxx tokens from the total room goal'+'\n'; out+='\'/tracklist\' to list the tracked rewards'+'\n'; out+='\'/untrack xxx\' to remove #xxx from the tracking list'+'\n'; } out+='\'/rewards all\' to send Rewards List to all users'+'\n'; out+='\'/help or \'/phelp\' or \'/apphelp\' to get a list of available commands'+'\n'; out+=repeatStr('\u2014',31); cb.chatNotice(out,userName,'','#FF0000','bold'); } function goalReached(silent) { var out=''; var gospin=0; last_time_goal_reached=new Date(); var curr_times_reached=Math.floor(current_goal_tipped/cb.settings.tokens); var i; for(i=0; i < curr_times_reached; i++) { times_goal_reached++; current_goal_tipped-=cb.settings.tokens; if (out.length>0) { out+='\n'; } out+="Goal was reached for the "+getNumberString(times_goal_reached)+" time!"; if (cb.settings.goalspinsebrawheel=='Yes') { gospin+=1; } } if (silent=='silent') { out=''; gospin=0; } if (out.length>0) { cb.chatNotice(out,'','','','bolder'); if (gospin>0) { goalSpins(gospin); } } } function trackGoalTipper(userName, tipAmount) { if (cb.settings.goalspinsebrawheel!='Yes') { return; } var amountchanged=0; var i; for (i in GoalTipTracking) { if (GoalTipTracking.hasOwnProperty(i)) { if (GoalTipTracking[i].name==userName) { GoalTipTracking[i].tips+=tipAmount; amountchanged=1; } } } if (amountchanged==0) { GoalTipTracking.push({name:userName, tips:tipAmount}); } } if (cb.settings.multispin_count > 1) { multiMessage='Enabled! x ' + cb.settings.multispin_count; } if (rewards.length == 0) { cb.settings.sebrawheelactive = "Disabled"; } cb.onTip(function(tip) { var skiptip=0, tipJar, userName, skiparray, i, spinCount, tipped; if (cb.settings.skiptipamounts.length>0) { skiparray=[]; skiparray=cb.settings.skiptipamounts.split(','); for(i=0; i < skiparray.length; i++) { if (tip.amount == parseInt(skiparray[i],10)) { skiptip = 1; } } if (skiptip) { cb.chatNotice('Tip from ' + tip.from_user + ' [' + tip.amount + '] did not count towards room goal, as per your settings.',cb.room_slug,'','#ff0000','bold'); } } if ((cb.settings.sebrawheelactive=='Enabled')&&(skiptip==0)) { tipJar=tip.amount; userName=tip.from_user; spinCount=0; while (tipJar>=cb.settings.cost_per_spin) { if (spinCount<(cb.settings.multispin_count)) { spinWheel(userName,0); sleep(250); } tipJar-=cb.settings.cost_per_spin; spinCount++; } total_tipped += parseInt(tip.amount, 10); cb.drawPanel(); if (spinCount > 0) { cb.chatNotice('Thank you '+userName+', for playing '+cb.room_slug+'\'s ZebraWheel',userName,'','#0000FF','bolder'); } } if ((cb.settings.autogoalresetactive=='Enabled')&&(skiptip==0)) { tipped=tip.amount; if ((spinCount>0)&&(cb.settings.goalspinsebrawheel=='Yes')&&(cb.settings.sebrawheelactive=='Enabled')) { current_goal_tipped+=cb.settings.cost_per_spin*spinCount; tipped-=cb.settings.cost_per_spin*spinCount; if (current_goal_tipped>=cb.settings.tokens) { goalReached('silent'); } } if ((cb.settings.goalspinsebrawheel=='Yes')&&(cb.settings.sebrawheelactive=='Enabled')&&(cb.settings.autogoalresetactive=='Enabled')) { trackGoalTipper(tip.from_user, tipped); } current_goal_tipped+=tipped; if (current_goal_tipped>=cb.settings.tokens) { goalReached(); } update_subject(); cb.drawPanel(); } }); cb.onEnter(function(user) { if ((cb.settings.announcewheelonenter=='Yes')&&(cb.settings.sebrawheelactive=='Enabled')) { if (user.has_tokens) { showStartupMessageNew(user.user); } } }); cb.onMessage(function(msg) { var userName=msg.user; if ((cb.settings.sebrawheelactive=='Enabled')&&((msg.m=='/rewards')||(msg.m=='/reward'))) { showStartupMessage(userName); } else if ((cb.settings.sebrawheelactive=='Enabled')&&((msg.m=='/rewards all')&&((msg.is_mod)||(userName==cb.room_slug)))) { showStartupMessage(''); cb.chatNotice('You sent the Rewards List to everybody',userName,'','#0000FF','bolder'); msg.m='Sending the Rewards List to everybody'; } else if ((msg.m.substring(0,5)=='/spin')&&(userName==cb.room_slug)) { if (msg.m.length>6) { var forceduser=msg.m.substr(6); spinWheel(forceduser,1); } else { spinWheel('forced',1); } msg.m='Spinning the ZebraWheel'; } else if (((msg.m=='/help')||(msg.m=='/apphelp')||(msg.m=='/phelp')||(msg.m=='/pwhelp'))&&((msg.is_mod)||(userName==cb.room_slug))) { if (msg.user==cb.room_slug) { showHelp('broadcaster',userName); } else { showHelp('moderator',userName); } msg['X-Spam']=true; } else if ((msg.m.substring(0,11)=='/addtokens ')&&(userName==cb.room_slug)) { msg['X-Spam']=true; if (msg.m.substring(0,12)=='/addtokens -') { if (msg.m.length>12) { tipAddRemove(parseInt(msg.m.substr(12),10),'remove'); } else { cb.chatNotice('/addtokens command failed (no amount?)',userName,'','#FF0000','bold'); } } else { if (msg.m.length>11) { tipAddRemove(parseInt(msg.m.substr(11),10),'add'); } else { cb.chatNotice('/addtokens command failed (no amount?)',userName,'','#FF0000','bold'); } } } else if ((msg.m.substring(0,9)=='/untrack ')&&(userName==cb.room_slug)) { msg['X-Spam']=true; if (msg.m.length>9) { trackRemove(parseInt(msg.m.substr(9),10)); } } else if ((msg.m.substring(0,10)=='/tracklist')&&(userName==cb.room_slug)) { msg['X-Spam']=true; trackListRewards(); } else { return msg; } }); cb.onDrawPanel(function(user) { if ((cb.settings.sebrawheelactive=='Enabled')&&(cb.settings.autogoalresetactive!='Enabled')) { var lsb=lastspinby.substring(0,14); return { 'template':'3_rows_of_labels','row1_label':'Spin Cost / Total Tips: ','row1_value':cb.settings.cost_per_spin+' / '+total_tipped,'row2_label':'Last Spin by:','row2_value':lsb,'row3_label':'Multi-Spin:','row3_value':multiMessage }; } if (cb.settings.autogoalresetactive=='Enabled') { if (times_goal_reached==0) { return { 'template':'3_rows_of_labels','row1_label':'Received / Goal (Total):','row1_value':''+current_goal_tipped+' / '+cb.settings.tokens+' ('+((times_goal_reached*cb.settings.tokens)+current_goal_tipped)+')','row2_label':'Hit Goal For:','row2_value':''+times_goal_reached+' times','row3_label':'Last Reached:','row3_value':'Never' }; } return { 'template':'3_rows_of_labels','row1_label':'Received / Goal (Total):','row1_value':''+current_goal_tipped+' / '+cb.settings.tokens+' ('+((times_goal_reached*cb.settings.tokens)+current_goal_tipped)+')','row2_label':'Hit Goal For:','row2_value':''+times_goal_reached+' times','row3_label':'Last Reached:','row3_value':''+Math.floor(((new Date()).getTime()-last_time_goal_reached.getTime())/60000)+' minutes ago' }; } }); if (cb.settings.sebrawheelactive=='Enabled') { showStartupMessageNew(''); if (cb.settings.advertise_in_chat>0) { cb.setTimeout(advert,(cb.settings.advertise_in_chat*60000)); } } if (cb.settings.autogoalresetactive=='Enabled') { if (cb.settings.tokensprogress>0) { current_goal_tipped+=cb.settings.tokensprogress; if (current_goal_tipped>=cb.settings.tokens) { goalReached('silent'); } } update_subject(); updatepanel(); }
© Copyright Chaturbate 2011- 2026. All Rights Reserved.