Apps Home
|
Create an App
Cam Quest2
Author:
camquest
Description
Source Code
Launch App
Current Users
Created by:
Camquest
/* CamQuest v0.2 More colorful interactive tip adventure app for Chaturbate. */ cb.settings_choices = [ { name: 'theme', type: 'choice', choice1: 'Fantasy Dungeon', choice2: 'Space Mission', choice3: 'Haunted Hotel', defaultValue: 'Fantasy Dungeon', label: 'Quest Theme' }, { name: 'goal_tokens', type: 'int', minValue: 10, maxValue: 9999, defaultValue: 250, label: 'Tokens Needed Per Quest Stage' }, { name: 'announce_minutes', type: 'int', minValue: 1, maxValue: 30, defaultValue: 5, label: 'Auto Announce Every X Minutes' } ]; var totalTips = 0; var stageTips = 0; var currentStage = 0; var lastTipper = 'None yet'; var lastEvent = 'The quest is waiting to begin.'; var voteOpen = false; var voteOne = 0; var voteTwo = 0; var voters = {}; function getGoal() { return parseInt(cb.settings.goal_tokens, 10) || 250; } function getStyle() { if (cb.settings.theme === 'Space Mission') { return { icon: 'π', bg: '#06172E', bg2: '#102A54', specialBg: '#20124D', winBg: '#083B3B', dangerBg: '#3A0E1F', text: '#EAF6FF', accent: '#7DF9FF', sparkle: 'β¦' }; } if (cb.settings.theme === 'Haunted Hotel') { return { icon: 'π―οΈ', bg: '#19051F', bg2: '#2B0B35', specialBg: '#3D143F', winBg: '#26320A', dangerBg: '#3A0713', text: '#FFF3D6', accent: '#FFB000', sparkle: 'β§' }; } return { icon: 'π', bg: '#160B2E', bg2: '#26104D', specialBg: '#40206B', winBg: '#143B20', dangerBg: '#4A1111', text: '#FFF7E8', accent: '#FFD166', sparkle: 'β¦' }; } function sendQuestNotice(title, body, kind, toUser) { var s = getStyle(); var bg = s.bg; if (kind === 'status') { bg = s.bg2; } else if (kind === 'special') { bg = s.specialBg; } else if (kind === 'win') { bg = s.winBg; } else if (kind === 'danger') { bg = s.dangerBg; } cb.sendNotice( s.sparkle + ' ' + title + ' ' + s.sparkle + '\n' + body, toUser || '', bg, s.text, 'bold' ); } function makeBar(current, goal) { var totalBlocks = 12; var filled = Math.floor((current / goal) * totalBlocks); if (filled > totalBlocks) { filled = totalBlocks; } var bar = ''; var i; for (i = 0; i < filled; i += 1) { bar += 'β'; } for (i = filled; i < totalBlocks; i += 1) { bar += 'β'; } return bar; } function getStages() { if (cb.settings.theme === 'Space Mission') { return [ { name: 'Launch Pad', goal: 'Fuel the rocket', win: 'The rocket launches into the stars!', vote1: 'Visit the Moon Base', vote2: 'Enter the Asteroid Cave' }, { name: 'Moon Base', goal: 'Repair the airlock', win: 'The Moon Base doors open.', vote1: 'Search the lab', vote2: 'Follow the signal' }, { name: 'Alien Ruins', goal: 'Activate the crystal gate', win: 'The ancient alien gate glows to life.', vote1: 'Step through', vote2: 'Scan the ruins' } ]; } if (cb.settings.theme === 'Haunted Hotel') { return [ { name: 'Hotel Lobby', goal: 'Unlock the elevator', win: 'The elevator unlocks with a spooky ding.', vote1: 'Go to the Penthouse', vote2: 'Go to the Basement' }, { name: 'Basement Hall', goal: 'Light the old lantern', win: 'The lantern flickers on.', vote1: 'Open the red door', vote2: 'Follow the whisper' }, { name: 'Penthouse Suite', goal: 'Find the silver key', win: 'The silver key appears under the rug.', vote1: 'Escape the hotel', vote2: 'Enter the mirror room' } ]; } return [ { name: 'Village Gate', goal: 'Open the old gate', win: 'The old gate creaks open.', vote1: 'Enter the forest', vote2: 'Enter the cave' }, { name: 'Crystal Cave', goal: 'Wake the crystal', win: 'The crystal begins to glow.', vote1: 'Touch the crystal', vote2: 'Search deeper' }, { name: 'Dragon Chamber', goal: 'Defeat the tiny dragon', win: 'The tiny dragon has been defeated!', vote1: 'Claim treasure', vote2: 'Befriend dragon' } ]; } function getStage() { var stages = getStages(); return stages[currentStage % stages.length]; } function progressText() { var s = getStyle(); var stage = getStage(); var goal = getGoal(); return s.icon + ' Theme: ' + cb.settings.theme + '\nπ Chapter: ' + stage.name + '\nπ― Quest: ' + stage.goal + '\n' + makeBar(stageTips, goal) + ' ' + stageTips + '/' + goal + '\nπ Last Hero: ' + lastTipper + '\nπ¬ Type /quest to see this again'; } function announceStatus(toUser) { sendQuestNotice('CAMQUEST STATUS', progressText(), 'status', toUser); } function startVote() { var stage = getStage(); voteOpen = true; voteOne = 0; voteTwo = 0; voters = {}; sendQuestNotice( 'THE ROOM MUST CHOOSE', 'π³οΈ Vote for the next path!\n\n' + 'Type /vote 1 β ' + stage.vote1 + '\n' + 'Type /vote 2 β ' + stage.vote2 + '\n\n' + 'Voting closes in 60 seconds.', 'special', '' ); cb.setTimeout(closeVote, 60000); } function closeVote() { if (!voteOpen) { return; } voteOpen = false; var stage = getStage(); var winner; if (voteOne > voteTwo) { winner = stage.vote1; } else if (voteTwo > voteOne) { winner = stage.vote2; } else { winner = 'Tie! The path is chosen by fate.'; } currentStage += 1; stageTips = 0; lastEvent = 'Vote result: ' + winner; sendQuestNotice( 'NEW CHAPTER UNLOCKED', 'β Vote Result: ' + winner + '\n\n' + progressText(), 'win', '' ); cb.drawPanel(); } function unlockStage() { var stage = getStage(); lastEvent = stage.win; sendQuestNotice( 'QUEST COMPLETE', 'β¨ ' + stage.win + ' β¨\n\nThe next path is opening...', 'win', '' ); startVote(); cb.drawPanel(); } function randomMiniEvent(username) { var events = [ 'found a hidden key π', 'triggered a mystery sparkle β¨', 'opened a secret drawer ποΈ', 'summoned a tiny helper π§', 'activated bonus quest energy β‘', 'found a strange glowing map πΊοΈ', 'woke up something ancient ποΈ' ]; var pick = events[Math.floor(Math.random() * events.length)]; lastEvent = username + ' ' + pick + '!'; sendQuestNotice( 'RANDOM EVENT', 'π² ' + username + ' ' + pick + '!', 'special', '' ); } cb.onStart(function(user) { sendQuestNotice( 'CAMQUEST HAS BEGUN', 'Welcome to the adventure.\n\n' + 'Tip to move the quest forward.\n' + 'Type /quest to view progress.\n' + 'When a chapter is complete, the room votes on the next path.', 'special', '' ); announceStatus(); var minutes = parseInt(cb.settings.announce_minutes, 10) || 5; function autoAnnounce() { announceStatus(); cb.setTimeout(autoAnnounce, minutes * 60 * 1000); } cb.setTimeout(autoAnnounce, minutes * 60 * 1000); }); cb.onTip(function(tip) { var amount = parseInt(tip.amount, 10) || 0; var username = tip.is_anon_tip ? 'Anonymous' : tip.from_user; var goal = getGoal(); totalTips += amount; stageTips += amount; lastTipper = username + ' +' + amount; sendQuestNotice( 'QUEST POWER ADDED', 'π° ' + username + ' added ' + amount + ' tokens!\n\n' + makeBar(stageTips, goal) + ' ' + stageTips + '/' + goal, 'status', '' ); if (amount >= 100) { randomMiniEvent(username); } if (stageTips >= goal && !voteOpen) { unlockStage(); } cb.drawPanel(); }); cb.onMessage(function(msg) { var text = msg.m.toLowerCase(); if (text === '/quest') { announceStatus(msg.user); msg['X-Spam'] = true; return msg; } if (text === '/resetquest') { if (msg.user === cb.room_slug || msg.is_mod) { totalTips = 0; stageTips = 0; currentStage = 0; lastTipper = 'None yet'; lastEvent = 'Quest was reset.'; voteOpen = false; voteOne = 0; voteTwo = 0; voters = {}; sendQuestNotice( 'QUEST RESET', 'π CamQuest has been reset to chapter one.', 'danger', '' ); cb.drawPanel(); } msg['X-Spam'] = true; return msg; } if (text === '/vote 1' || text === '/vote1') { if (voteOpen && !voters[msg.user]) { voteOne += 1; voters[msg.user] = true; sendQuestNotice( 'VOTE LOCKED', msg.user + ' voted for option 1.\n\n' + 'Current vote: Option 1 = ' + voteOne + ' | Option 2 = ' + voteTwo, 'special', '' ); } msg['X-Spam'] = true; return msg; } if (text === '/vote 2' || text === '/vote2') { if (voteOpen && !voters[msg.user]) { voteTwo += 1; voters[msg.user] = true; sendQuestNotice( 'VOTE LOCKED', msg.user + ' voted for option 2.\n\n' + 'Current vote: Option 1 = ' + voteOne + ' | Option 2 = ' + voteTwo, 'special', '' ); } msg['X-Spam'] = true; return msg; } return msg; }); cb.tipOptions(function(user) { return { label: 'Choose your CamQuest action:', options: [ { label: 'Explore the area' }, { label: 'Use a magic item' }, { label: 'Trigger mystery event' }, { label: 'Help the quest goal' }, { label: 'Boss attack' } ] }; }); cb.onDrawPanel(function(user) { var s = getStyle(); var stage = getStage(); var goal = getGoal(); return { template: 'image_template', layers: [ { type: 'text', text: s.icon + ' CAMQUEST', top: 3, left: 8, width: 260, color: s.accent, 'font-size': 13, 'font-style': 'normal' }, { type: 'text', text: 'Chapter: ' + stage.name, top: 25, left: 8, width: 260, color: '#ffffff', 'font-size': 11 }, { type: 'text', text: makeBar(stageTips, goal) + ' ' + stageTips + '/' + goal, top: 47, left: 8, width: 260, color: s.accent, 'font-size': 11 } ] }; }); cb.drawPanel();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.