Apps Home
|
Create an App
Amelia's Tease & Please
Author:
theplayfulbbw
Description
Source Code
Launch App
Current Users
Created by:
Theplayfulbbw
/* Willpower Duel * * Game summary: * - Two values are tracked: `round_tokens` (tokens added) and `resistance` (counts down). * - Tips increase `round_tokens` and decrease `resistance` by the tip amount. * - Pressure wins if resistance <= 0 before round_tokens reaches 100. * - Resistance wins if round_tokens >= 100 before resistance hits 0. * - After a win, a notice is sent and the round resets automatically after 10 seconds. * - A custom panel displays current values in colours and emojis of your choice. */ /* Define app settings (users/broadcaster can change these in the control panel). * - text_color_pressure: Hex colour for the "Pressure" line (no # symbol). * - text_color_resistance: Hex colour for the "Resistance" line. * - pressure_emoji: Emoji or short text to prefix the Pressure line. * - resistance_emoji: Emoji or short text to prefix the Resistance line. */ cb.settings_choices = [ { name: 'text_color_pressure', type: 'str', defaultValue: 'FF5555', // soft red label: 'Pressure line colour (hex without #)' }, { name: 'text_color_resistance', type: 'str', defaultValue: '55FF55', // soft green label: 'Resistance line colour (hex without #)' }, { name: 'pressure_emoji', type: 'str', defaultValue: '💥', label: 'Pressure emoji or prefix' }, { name: 'resistance_emoji', type: 'str', defaultValue: '🛡️', label: 'Resistance emoji or prefix' } ]; // Game state var round_tokens = 0; // Sum of all tokens tipped in the current round var resistance = 100; // Resistance value starts at 100 var round_in_progress = true; // Flag to prevent further win checks after round ends /* Helper: build the HTML for the on‑screen panel. * Uses the colour and emoji settings for a custom look. */ function buildPanel() { var html = '<div style="text-align:center; font-size:16px;">'; // Pressure line html += '<span style="color:#' + cb.settings.text_color_pressure + ';">' + cb.settings.pressure_emoji + ' Tokens: ' + round_tokens + '</span><br>'; // Resistance line html += '<span style="color:#' + cb.settings.text_color_resistance + ';">' + cb.settings.resistance_emoji + ' Resistance: ' + resistance + '</span>'; html += '</div>'; return { html: html }; } /* Called by Chaturbate whenever the panel needs to be drawn. * We return the current HTML so the site can display it. */ cb.onDrawPanel(function() { return buildPanel(); }); /* Helper: update the panel immediately after state changes. * drawPanel() tells Chaturbate to redraw the panel using the latest HTML. */ function updatePanel() { cb.drawPanel(buildPanel()); } /* Helper: reset the round. * Sets starting values and marks the round as active again. */ function resetRound() { round_tokens = 0; resistance = 100; round_in_progress = true; updatePanel(); } /* Helper: announce a winner, send a notice, and schedule a reset. * winnerName is either 'Pressure' or 'Resistance'. */ function announceWinner(winnerName) { cb.sendNotice('🎉 ' + winnerName + ' wins this round!'); round_in_progress = false; // Automatically reset after 10 seconds (10000 milliseconds) setTimeout(function() { resetRound(); }, 10000); } /* Handle tip events. * Each tip increases round_tokens and decreases resistance by the tip amount. * After updating values, check both win conditions in the correct order. */ cb.onTip(function(tipper, amount) { // Update the game state only if the round is in progress if (!round_in_progress) { return; } round_tokens += amount; resistance -= amount; updatePanel(); // refresh panel display // Check win conditions: // 1. Pressure wins if resistance <= 0 and tokens < 100 if (resistance <= 0 && round_tokens < 100) { announceWinner('Pressure'); return; } // 2. Resistance wins if tokens >= 100 and resistance > 0 if (round_tokens >= 100 && resistance > 0) { announceWinner('Resistance'); return; } // Otherwise, the game continues });
© Copyright Chaturbate 2011- 2026. All Rights Reserved.