Skip to content

Example Effects Driven Chat Game

Erik Bigler edited this page Apr 9, 2020 · 2 revisions

Overview

Using Firebot's effect system, you can build all sorts of complex chat and mixplay games. Here's an example setup of a "spin" gambling game.

Example !spin game setup

  1. Create custom command with trigger: !spin
  2. Effects:
  • Conditional Effects (Verify user issued command correctly and that they have enough currency)
    • If:
      • Command Args Count is less than 1
      • [Custom] $ensureNumber[$arg[1], 0] is less than 0
      • [Custom] $currency["YOUR CURRENCY NAME", $user] is less than $arg[1]
        • Effects:
          • Chat
            • Text: "Incorrect !spin usage: !spin [amount]"
            • Whisper: $user
          • Stop Effect Execution (Stop execution of these effects)
            • Check "Bubble stop execution"
  • Update Currency
    • Operation: Remove
    • Target: Single User ($user)
    • Amount: $arg[1] (removes the given amount of currency the user wagered in the command)
  • Custom Variable (Create a variable to store how many times user wins a spin)
    • Name: $user-spin-wins (uses $user to ensure this variable doesn't conflict with other users)
    • Data: 0
  • Loop Effects (Loop 3 times for 3 spins)
    • Set to loop 3 times
    • Effects:
      • Custom Variable (Store a random number between 1-100 in a variable)
        • Name: $user-spin-check
        • Data: $randomNumber[1, 100]
      • Conditional Effects (check results of random number)
        • If:
          • [Custom] $user-spin-check is less than or equal to 33 (1/3rd chance they win each spin)
          • Effects:
            • Custom Variable
              • Name: $user-spin-wins
              • Data: $math[$customVariable[$user-spin-wins] + 1] (adds 1 to the win counter)
            • Chat
              • Text: "Spin: Hit!"
              • Whisper: $user
        • Otherwise (spin wasnt successful)
          • Effects:
            • Chat
              • Text: "Spin: Miss!"
              • Whisper: $user
      • Delay (delay in between loops so it doesn't happen too fast, builds anticipation for the user)
        • Duration: 2 (seconds)
  • Custom Variable (Calculate winnings)
    • Name: $user-spin-winnings
    • Data: $math[$arg[1] * $customVariable[$user-spin-wins]] (multiply the number of wins against the wager amount)
  • Update Currency (Give winnings to user)
    • Operation: Add
    • Target: Single User ($user)
    • Amount: $customVariable[$user-spin-winnings]
  • Chat
    • Text: "$user has won $commafy[$customVariable[$user-spin-winnings]] ($customVariable[$user-spin-wins]/3 spins hit)!"
Clone this wiki locally