Bots Home
|
Create an App
My Wish List
Author:
erik913
Description
Source Code
Launch Bot
Current Users
Created by:
Erik913
function getList(){cb.settings.item1Goal>0&&cb.settings.donations1<cb.settings.item1Goal&&(items.push(cb.settings.item1),itemGoals.push(cb.settings.item1Goal),goals.push(cb.settings.donations1),madeGoal.push(0)),cb.settings.item2Goal>0&&cb.settings.donations2<cb.settings.item2Goal&&(items.push(cb.settings.item2),itemGoals.push(cb.settings.item2Goal),goals.push(cb.settings.donations2),madeGoal.push(0)),cb.settings.item3Goal>0&&cb.settings.donations3<cb.settings.item3Goal&&(items.push(cb.settings.item3),itemGoals.push(cb.settings.item3Goal),goals.push(cb.settings.donations3),madeGoal.push(0)),cb.settings.item4Goal>0&&cb.settings.donations4<cb.settings.item4Goal&&(items.push(cb.settings.item4),itemGoals.push(cb.settings.item4Goal),goals.push(cb.settings.donations4),madeGoal.push(0)),cb.settings.item5Goal>0&&cb.settings.donations5<cb.settings.item5Goal&&(items.push(cb.settings.item5),itemGoals.push(cb.settings.item5Goal),goals.push(cb.settings.donations5),madeGoal.push(0))}function donations(e,t,o){goals[e]=o+goals[e],cb.chatNotice("Thank you so much for donating to my "+items[e]+"\n"+cb.settings.gif,t,"","","bold"),goals[e]>=itemGoals[e]&&"Yes"==cb.settings.thanks&&0==madeGoal[e]&&goalMade(e)}function donateAll(e,t){cb.chatNotice("Thank you so much for donating to all of my wishes!\n"+cb.settings.gif,e,"","","bold");for(var o=0,s=0,a=0,i=0;i<goals.length;i++)goals[i]<itemGoals[i]&&o++;for(var n=Math.floor(t/o),i=0;i<goals.length;i++)if(goals[i]<itemGoals[i]){goals[i]=goals[i]+n;var l=itemGoals[i]-goals[i];s<l&&(a=i,s=l),goals[i]>=itemGoals[i]&&"Yes"==cb.settings.thanks&&0==madeGoal[i]&&goalMade(i)}goals[a]=goals[a]+t%o,goals[a]>=itemGoals[a]&&"Yes"==cb.settings.thanks&&0==madeGoal[a]&&goalMade(a)}function donateRandom(e,t){for(var o=[],s=0,a=0,i=0;i<goals.length;i++)goals[i]<itemGoals[i]&&o.push(i);var n=o[Math.floor(Math.random()*o.length)];if(cb.chatNotice("Thank you so much for donating to my "+items[n]+"\n"+cb.settings.gif,e,"","","bold"),goals[n]=goals[n]+t,goals[n]>itemGoals[n]){goalMade(n);var l=goals[n]-itemGoals[n];goals[n]=goals[n]-l;for(i=0;i<o.length;i++)if(goals[o[i]]<itemGoals[o[i]]){var m=itemGoals[o[i]]-goals[o[i]];s<m&&(a=o[i],s=m)}goals[a]=goals[a]+l,cb.chatNotice("Thank you so much for donating to my "+items[a]+"\n"+cb.settings.gif,e,"","","bold"),goals[a]>=itemGoals[a]&&"Yes"==cb.settings.thanks&&0==madeGoal[a]&&goalMade(a)}}function goalMade(e){cb.chatNotice("The donation goal for my "+items[e]+" has been met!!!\nThank you all for making my wish come true!!\n"+cb.settings.celebrate,"","",bcp.green,"bold"),madeGoal[e]=1}function donate(e,t){var o=space+e+(space+space)+e+space;cb.chatNotice("Thank you for your interest in my wish list, "+t+"!\nThese are the items that I am wishing for:\n"+space+e+space+items.join(o)+space+e+space+"\nIf you would like to donate, send a tip with the number of tokens and\nin the tipnote type 'donate x' where 'x' is one of my wishes.\nFor example: 'donate "+items[Math.floor(Math.random()*items.length)]+"' - then add any message.\nIf you feel to donate to all of my wishes type 'donate all' in the tipnote\nand your donation will be divided equally to all of my remaining wishes.\nOr, if you can't decide, simply write 'donate random' and your donation will\nbe put to a random item in my wish list. Make sure to spell my wish just\nas you see in the list or it won't work!",t,"","","bold")}function notify(){notice(),setTimeout(notify,6e4*cb.settings.time)}function notice(e){cb.chatNotice("I have a wish list with "+items.length+" item(s). If you would like see my list or how to donate\ntype '/donate' or to see my wish list progress type '/progress' in to the chat.",e,"",bcp.purple,"bold")}function init(){getList(),setTimeout(notify,6e4*cb.settings.time)}var items=[],itemGoals=[],goals=[],madeGoal=[],heart="♥",diamond="♦",star="★",smiley="☺",clover="☘",space=" ",bcp={aqua:"#00FFFF",black:"#000000",blue:"#0000FF",fuchsia:"#FF00FF",gray:"#808080",grey:"#808080",green:"#008000",lime:"#00FF00",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#FFA500",purple:"#800080",red:"#FF0000",silver:"#C0C0C0",teal:"#008080",white:"#FFFFFF",yellow:"#FFFF00"};cb.settings_choices=[{name:"item1",type:"str",minLength:1,maxLength:255,label:"Item 1"},{name:"item1Goal",type:"int",minValue:1,label:"Goal Amount. This won't be shown (2000 tokens = $100)"},{name:"donations1",type:"int",required:!1,label:"Donatations made for this item from previous shows?"},{name:"item2",type:"str",required:!1,minLength:1,maxLength:255,label:"Item 2"},{name:"item2Goal",type:"int",required:!1,label:"Goal Amount. This won't be shown (2000 tokens = $100)"},{name:"donations2",type:"int",required:!1,label:"Donatations made for this item from previous shows?"},{name:"item3",type:"str",required:!1,minLength:1,maxLength:255,label:"Item 3"},{name:"item3Goal",type:"int",required:!1,label:"Goal Amount. This won't be shown (2000 tokens = $100)"},{name:"donations3",type:"int",required:!1,label:"Donatations made for this item from previous shows?"},{name:"item4",type:"str",required:!1,minLength:1,maxLength:255,label:"Item 4"},{name:"item4Goal",type:"int",required:!1,label:"Goal Amount. This won't be shown (2000 tokens = $100)"},{name:"donations4",type:"int",required:!1,label:"Donatations made for this item from previous shows?"},{name:"item5",type:"str",required:!1,minLength:1,maxLength:255,label:"Item 5"},{name:"item5Goal",type:"int",required:!1,label:"Goal Amount. This won't be shown (2000 tokens = $100)"},{name:"donations5",type:"int",required:!1,label:"Donatations made for this item from previous shows?"},{name:"time",type:"int",minValue:1,maxValue:30,label:"Frequency of wish list notification (in minutes)?",defaultValue:10},{name:"divider",type:"choice",label:"Divider for wish list items",choice1:"Heart",choice2:"Diamond",choice3:"Star",choice4:"Smiley",choice5:"Clover",defaultValue:"Heart"},{name:"gif",type:"str",minLength:1,maxLength:255,label:"Thank you gif",defaultValue:":kisses4u"},{name:"thanks",type:"choice",label:"Show when goal is met?",choice1:"Yes",choice2:"No",defaultValue:"Yes"},{name:"celebrate",type:"str",minLength:1,maxLength:255,label:"Celebration Gif for completed goal",defaultValue:":congratulationslove"},{name:"enter",type:"choice",label:"Show donation list information on entry?",choice1:"Yes",choice2:"No",defaultValue:"No"}],cb.onTip(function(e){var t=parseInt(e.amount);null!=e.message.match(/donate/i)&&(null!=e.message.match(/all/gi)?donateAll(e.from_user,t):null!=e.message.match(/random/gi)?donateRandom(e.from_user,t):null!=e.message.match(RegExp(cb.settings.item1,"gi"))?goals[0]<itemGoals[0]&&donations(0,e.from_user,t):null!=e.message.match(RegExp(cb.settings.item2,"gi"))?goals[1]<itemGoals[1]&&donations(1,e.from_user,t):null!=e.message.match(RegExp(cb.settings.item3,"gi"))?goals[2]<itemGoals[2]&&donations(2,e.from_user,t):null!=e.message.match(RegExp(cb.settings.item4,"gi"))?goals[3]<itemGoals[3]&&donations(3,e.from_user,t):null!=e.message.match(RegExp(cb.settings.item5,"gi"))&&goals[4]<itemGoals[4]&&donations(4,e.from_user,t))}),cb.onMessage(function(e){var t="";if("/goals"==e.m&&(e["X-Spam"]=!0,e.user==cb.room_slug||e.is_mod)){for(o=0;o<items.length;o++)t=t+items[o]+" has "+goals[o]+" tokens donated.\n";cb.chatNotice("The status of each goal is:\n"+t,e.user,"",bcp.navy,"bold")}if("/progress"==e.m){for(var o=0;o<items.length;o++)t=goals[o]>=itemGoals[o]?t+"My wish for a "+items[o]+" has already come true!\n":t+"My wish for a "+items[o]+" is "+(itemGoals[o]-goals[o])+" tokens from my goal.\n";cb.chatNotice("\n"+t,e.user,"",bcp.blue,"bold"),e["X-Spam"]=!0}"/donate"==e.m&&(e["X-Spam"]=!0,"Heart"==cb.settings.divider?donate(heart,e.user):"Diamond"==cb.settings.divider?donate(diamond,e.user):"Star"==cb.settings.divider?donate(star,e.user):"Smiley"==cb.settings.divider?donate(smiley,e.user):"Clover"==cb.settings.divider&&donate(clover,e.user))}),cb.onEnter(function(e){var t=e.user;(e.is_mod||e.user==cb.room_slug)&&setTimeout(function(){cb.chatNotice("Type /goals for current donation totals. These numbers need to be remembered before ending the show and used when setting up the bot before the next show for accuracy!",t,"",bcp.red,"bold")},1500),"Yes"==cb.settings.enter&&t!=cb.room_slug&&setTimeout(function(){notice(t)},1500)}),init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.