===== πŸ“Š Variables ===== **Variables** are like little boxes that store information for your bot. They help bots remember numbers, items, or player progress. ---- ==== πŸ”‘ What is a Variable? ==== - A variable is a value your bot can keep track of. \\ - Think of it like a note the bot writes down: β€œscore = 5” or β€œcoins = 10.” \\ - Bots can then check or change that note during interactions. \\ ---- ==== 🧩 Types of Variables ==== There are two main kinds of variables: * **Bot Variables** - Belong to the bot itself. - Shared across all players who interact with that bot. - Example: β€œBot score = 10” (everyone sees the same score). * **Player Variables** - Belong to each individual player. - Different players can have different values. - Example: β€œPlayer coins = 5” (each player has their own coin count). \\ ---- ==== βž• Changing Variables ==== Bots can change variables using actions: - **Set** – Give the variable a specific value (e.g., score = 0). \\ - **Increment** – Add 1 to the variable (e.g., score becomes 6). \\ - **Decrement** – Subtract 1 from the variable (e.g., lives become 2). \\ - **Add/Subtract** – Change the variable by a chosen number (e.g., coins +10). \\ - **Random** – Set the variable to a random number within a range. \\ ---- ==== ❓ Checking Variables ==== Conditions let bots check variables: - = (equals to) – Is the variable the same as a number? \\ - > (greater than) – Is the variable bigger than a number? \\ - < (less than) – Is the variable smaller than a number? \\ - >= (greater than or equal to) – Is the variable at least a number? \\ - <= (less than or equal to) – Is the variable no more than a number? \\ Example: β€œIf player coins >= 10 β†’ Give ticket.” \\ ---- ===== Summary ===== Variables are the memory of your bot. They let bots: * Keep track of scores, coins, or progress * Change values during interactions * Check values to decide what happens next Use [[bots:actions|Actions]] to change variables and [[bots:conditions|Conditions]] to check them.