Skip to content

Variables Math and RNG

egyptron edited this page Sep 24, 2026 · 1 revision

Variables, Math & RNG

Awake Simple S1 provides dynamic typing (integers, strings, and booleans), a full PEMDAS arithmetic parser, and inclusive random number generation.


Variable Assignment

Variables are declared and updated using set variable:

set variable <name> = <value>

Data Types:

note: Integer
set variable player_hp = 100

note: String
set variable hero_name = "Kaelen"

note: Boolean
set variable is_alive = true

String Concatenation

Strings and variables can be merged using the + operator:

set variable score = 450
display("Player " + hero_name + " has a score of: " + score)

Arithmetic & PEMDAS Compliance

The engine evaluates complex mathematical formulas adhering strictly to order of operations:

  1. Parentheses ()
  2. Multiplication *, Division /, Modulo %
  3. Addition +, Subtraction -

Variables can be placed directly within arithmetic expressions:

set variable base_atk = 25
set variable gear_bonus = 15
set variable enemy_armor = 8

set variable total_damage = (base_atk + gear_bonus) * 2 - (enemy_armor / 2)
display("Calculated Damage: " + total_damage)

Variable Mutation

Quickly increment or decrement numeric variables:

increase variable <name> by <amount>
decrease variable <name> by <amount>

Example:

set variable gold = 50

increase variable gold by 25
decrease variable gold by 10

display("Current Gold: " + gold) note: Outputs 65

Random Number Generation (RNG)

Generates an inclusive random integer between minimum and maximum bounds:

pick random number between <min> and <max> into variable <target_variable>

Example:

pick random number between 1 and 20 into variable d20
display("Dice Roll: " + d20)

statement(start)
if variable d20 == 20 then
   display_success("NATURAL 20! Critical Hit!")
else
   display("Standard attack executed.")
statement(end)

Clone this wiki locally