Apps Home
|
Create an App
Heads or Tails
Author:
milek252
Description
Source Code
Launch App
Current Users
Created by:
Milek252
//HEADS OR TAILS //BY MILEK252 cb.settings_choices = [ {name:'cost', type:'int', minValue:1, maxValue:999, defaultValue:25, label: 'Cost (1-999): '}, {name:'pos1', type:'str', minLength: 1, maxLength: 255, label: 'Goal #1 '}, {name:'pos2', type:'str', minLength: 1, maxLength: 255, label: 'Goal #2 '}, {name:'pos3', type:'str', minLength: 0, maxLength: 255, label: 'Goal #3 ', required: false}, {name:'pos4', type:'str', minLength: 0, maxLength: 255, label: 'Goal #4 ', required: false}, {name:'pos5', type:'str', minLength: 0, maxLength: 255, label: 'Goal #5 ', required: false}, {name:'pos6', type:'str', minLength: 0, maxLength: 255, label: 'Goal #6 ', required: false}, {name:'pos7', type:'str', minLength: 0, maxLength: 255, label: 'Goal #7 ', required: false}, {name:'pos8', type:'str', minLength: 0, maxLength: 255, label: 'Goal #8 ', required: false}, {name:'pos9', type:'str', minLength: 0, maxLength: 255, label: 'Goal #9 ', required: false}, {name:'pos10', type:'str', minLength: 0, maxLength: 255, label: 'Goal #10 ', required: false}, ]; var Number_Goal=0; var Goals= new Array(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); var Goal_List= new Array(); for(var i=0;i<10;i++) { if(Goals[i]!='') { Goal_List.push(Goals[i]); } } cb.changeRoomSubject('HEADS OR TAILS [Tip '+cb.settings.cost+', Goal: '+Goal_List[Number_Goal]+']'); cb.tipOptions(function(user) { return {options:[{label: 'Heads'}, {label: 'Tails'}], label:"Select a choice:"}; }); cb.onTip(function (tip){ if(tip['amount']>=cb.settings.cost) { var choiceTip=tip['message']; var choice=0; if(choiceTip=='Tails') choice=1; var randomNumber = Math.floor(Math.random()*(4)); cb.chatNotice('************************************'); if(randomNumber%2==0) cb.chatNotice('-------------------- HEADS --------------------','','#FFFFFF','#000000','bolder'); else cb.chatNotice('-------------------- TAILS --------------------','','#FFFFFF','#000000','bolder'); cb.chatNotice('Your choise: '+choiceTip); if(randomNumber%2==choice) { if(Number_Goal<Goal_List.length) Number_Goal++; cb.chatNotice('************************************','','#FFFF00','#0000FF'); cb.chatNotice('<<<<<<<<< YOU WIN >>>>>>>>>','','#FFFF00','#0000FF','bolder'); cb.chatNotice('************************************','','#FFFF00','#0000FF'); }else{ if(Number_Goal>0) Number_Goal--; cb.chatNotice('************************************'); cb.chatNotice('YOU LOOSE','','#FFFFFF','#000000','bolder'); cb.chatNotice(' TIP '+cb.settings.cost+' TO PLAY','','#FFFFFF','#000000','bolder'); cb.chatNotice('************************************'); } if(Number_Goal<Goal_List.length) { cb.chatNotice('Goal: '+Goal_List[Number_Goal]); if(Number_Goal==Goal_List.length-1) cb.chatNotice('Next Goal: -'); else cb.chatNotice('Next Goal: '+Goal_List[Number_Goal+1]); cb.chatNotice('************************************'); }else{ cb.chatNotice('Goal: -'); cb.chatNotice('Next Goal: -'); cb.chatNotice('************************************'); } if(Number_Goal>=Goal_List.length) { cb.changeRoomSubject('[HEADS OR TAILS] THX FOR ALL TIPERS'); cb.tipOptions(function(user) { return ; }); } else cb.changeRoomSubject('HEADS OR TAILS [Tip '+cb.settings.cost+', Goal: '+Goal_List[Number_Goal]+']'); } }); cb.onMessage(function(msg){ if(msg['m']=='/goals') { cb.chatNotice('************************************', msg['user']); if(Number_Goal<Goal_List.length) cb.chatNotice('Goal: '+Goal_List[Number_Goal], msg['user']); else cb.chatNotice('Goal: -', msg['user']); cb.chatNotice('************************************', msg['user']); cb.chatNotice(' Next Goal: ', msg['user']); for(var i=Number_Goal+1;i<Goal_List.length;i++) { cb.chatNotice(''+(i-Number_Goal)+': '+Goal_List[i], msg['user']); } if(Number_Goal>=Goal_List.length-1) cb.chatNotice('Goal: -'); cb.chatNotice('************************************', msg['user']); cb.chatNotice(' TIP '+cb.settings.cost+' TO PLAY','','#FFFFFF','#000000','bolder'); cb.chatNotice(' Good Luck And Have Fun ', msg['user']); cb.chatNotice('************************************', msg['user']); cb.chatNotice('by Milek252', msg['user']); } }); cb.onEnter(function(user) { cb.chatNotice('Welcome ' + user['user'] + '!',user['user'],'#FFFFFF','#FF0000'); cb.chatNotice('Heads or Tails by Milek252', user['user'],'#FFFFFF','#FF0000'); cb.chatNotice('If you win model execute the current goal and will be set next goal, but if you lose, will be set previous goal.(Type \'/goals\' to get a goal listing)', user['user'],'#FFFFFF','#FF0000'); cb.chatNotice(' TIP '+cb.settings.cost+' TO PLAY', user['user'],'#FFFFFF','#FF0000','bolder'); cb.chatNotice(' Good Luck And Have Fun ', user['user'],'#FFFFFF','#FF0000'); });
© Copyright Chaturbate 2011- 2026. All Rights Reserved.