Apps Home
|
Create an App
PAPP
Author:
itsme3
Description
Source Code
Launch App
Current Users
Created by:
Itsme3
/*Variables*/ /*a_quiet_guy Sep 2016*/ cb.settings_choices = [ {name: 'goal', type: 'int', minValue: 1, maxValue: 32767, label: "Set tips number for single goal"}, {name: 'start_tip', type: 'int', minValue: 0, maxValue: 32767, label: "Set start tip (restart at fixed point)", defaultValue: 0}, {name: 'room_subject', type: 'str', default: '', label: 'Type here the text to append into che room subject', required: false}, { name: 'notice_wait_time', type: 'choice', label: 'In minutes, how often should the app advertise itself? (0 means never)', choice1: 1, choice2: 11, choice3: 17, choice4: 23, choice5: 27, choice6: 34, choice7: 59, choice8: 0, defaultValue: 11 }, {name: 'goal_1', type: 'str', default: '', label: '1st goal target', required: false}, {name: 'goal_2', type: 'str', default: '', label: '2nd goal target', required: false}, {name: 'goal_3', type: 'str', default: '', label: '3rd goal target', required: false}, {name: 'goal_4', type: 'str', default: '', label: '4th goal target', required: false}, {name: 'goal_5', type: 'str', default: '', label: '5ht goal target', required: false}, {name: 'goal_tip_1', type: 'int', minValue: 0, maxValue: 32767, label: "1st target is at goal", defaultValue: 0, required: false}, {name: 'goal_tip_2', type: 'int', minValue: 0, maxValue: 32767, label: "2nd target is at goal", defaultValue: 0, required: false}, {name: 'goal_tip_3', type: 'int', minValue: 0, maxValue: 32767, label: "3rd target is at goal", defaultValue: 0, required: false}, {name: 'goal_tip_4', type: 'int', minValue: 0, maxValue: 32767, label: "4th target is at goal", defaultValue: 0, required: false}, {name: 'goal_tip_5', type: 'int', minValue: 0, maxValue: 32767, label: "5th target is at goal", defaultValue: 0, required: false} ]; var goal = cb.settings['goal']; var total_tipped = parseInt(cb.settings['start_tip']); var max_tip = 0; var goal_number = 0; var max_tip_user = 'None'; var last_req = 'No Requests'; var goals = [cb.settings['goal_1'], cb.settings['goal_2'], cb.settings['goal_3'], cb.settings['goal_4'], cb.settings['goal_5']]; var tip_goals = [parseInt(cb.settings['goal_tip_1']), parseInt(cb.settings['goal_tip_2']), parseInt(cb.settings['goal_tip_3']), parseInt(cb.settings['goal_tip_4']), parseInt(cb.settings['goal_tip_5'])]; /* ------------------------- Greet New Users ------------------------- */ cb.onEnter(function(user) { var msg = 'Hi ' + user['user'] + '. Welcome to my room, if you like, you could follow me or support me ;)'; msg += '\nBefore you ask me something, read my page! :)' cb.sendNotice(msg, user['user'], '#D4D2ED', '#194264', 'normal'); /*Light blue*/ advertise(user['user'], true); }); /* ------------------------- ------------------------- ------------------------- */ /* ------------------------- On Meggage Action ------------------------- */ cb.onMessage(function (msg) { if (msg['m'].match(/\/goals/i)) { msg['X-Spam'] = true; advertise(msg['user'], false); } return msg; }); /* ------------------------- ------------------------- ------------------------- */ /* ------------------------- On Tip Action ------------------------- */ cb.onTip(function (tip) { TipGreat(tip); TipRequest(tip); TipGoal(tip); cb.drawPanel(); }); /* ------------------------- ------------------------- ------------------------- */ /* ------------------------- Draw Panel Below Video ------------------------- */ cb.onDrawPanel(function(user) { var msg3 = 'https://goo.gl/UmJBYH'; var msg1 = 'Received / Goals ( Tips x Goal ): ' + parseInt(total_tipped%goal) + ' / ' + parseInt(total_tipped/goal) + ' ( ' + goal + ' )'; if(user['user'] == cb.room_slug) { msg1 = 'Received / Goals ( Total ): ' + parseInt(total_tipped%goal) + ' / ' + parseInt(total_tipped/goal) + ' ( ' + total_tipped + ' )'; msg3 = last_req; } return { 'template': '3_rows_11_21_31', 'row1_value': '' + msg1 + '', 'row2_value': 'Highest Tip: ' + max_tip_user + ' ( ' + max_tip + ' )', 'row3_value': '' + msg3 + '' }; }); /* ------------------------- ------------------------- ------------------------- */ TipGreat = function(tip) { var new_tip = parseInt(tip['amount']); total_tipped += new_tip; if (new_tip > max_tip) { max_tip = new_tip; max_tip_user = tip['from_user']; } var message = ''; if (new_tip > 10000) { cb.sendNotice( tip['from_user'] + '.. :D are you craxy?!? Thanks a lot!!', tip['from_user'], '', '#B80934', 'bold'); /*Red*/ } else { if (new_tip > 1000) { cb.sendNotice('Thank you!!' + ' I suppose that ' + + tip['from_user'] + ' like the show!!', tip['from_user'], '', '#C79DD7', 'bold'); /*Purple*/ } else { if (new_tip > 100) { cb.sendNotice('Thank you' + tip['from_user'] + ', I like that!!', tip['from_user'], '', '#57CFD2', 'bold'); /*Strange Blue*/ } else { if (new_tip > 10) { cb.sendNotice('Thank you ' + tip['from_user'] + '!', tip['from_user'], '', '#FA8072', 'bold'); /*Orange*/ } else { cb.sendNotice(';)', tip['from_user'], '', '#52D46A', 'bold'); /*Green*/ } } } } } TipRequest = function(tip) { } TipGoal = function(tip) { var i = goal_number; while(i < 5) { var tip = tip_goals[i] if(total_tipped >= (tip * goal) && tip != 0) { if((i + 1) < 5 && tip_goals[i + 1] != 0) { var sub = goals[i + 1] + ' at goal ' + tip_goals[i + 1] + ' '; cb.changeRoomSubject(sub + cb.settings['room_subject']); } else { var sub = 'Let\'s play '; cb.changeRoomSubject(sub + cb.settings['room_subject']); } cb.sendNotice('Reach goal ' + (goal_number + 1) + ' ***** ' + goals[i] + ' ***** ', '', '#FFF2E5', '#FF7F00', 'bold'); goal_number++; } i++; } } advertise = function(username, flag) { var msg = ''; if (username == null || flag == true) { msg = 'I\' m playing with goals type /goals for see the remaining goals'; } else { var i = goal_number; msg = 'I have this goals remaning: '; if(goal_number >= 5) { msg = 'All Goal was reached'; cb.settings.notice_wait_time = 0; } while(i < 5) { if(tip_goals[i] != 0) { msg = msg + '\n' + (i + 1) + '. ' + goals[i] + ' at goal ' + tip_goals[i] + ' -- [' + ((tip_goals[i] * goal) - total_tipped) + ' tokens left]'; } i++; } } cb.sendNotice(msg, username, '#FFF2E5', '#FF7F00', 'normal'); if (parseInt(cb.settings.notice_wait_time) != 0) cb.setTimeout(advertise, parseInt(cb.settings.notice_wait_time) * 60000); } advertise(null, false);
© Copyright Chaturbate 2011- 2024. All Rights Reserved.