Skip to content

Getting started | Local literal variables

Andrzej edited this page Oct 18, 2025 · 5 revisions

What are literal variables?

Literal variables store values that represent data that can be written down like text or numbers (exceptions apply)

How to create a literal variable?

Important

Naming convention for literal variables follows the same rules as player variables do, so:

✅ $literally1984
✅ $releaseTheEpsteinFiles
❌ $Stupid
❌ $69
❌ $site_02_report

1) Specifying the value directly

$myVariable = "Hello, World!"
$myVar2 = 2137
$var3 = true

2) Getting the result from a method

$value = RandomNum 1 10 int

Check the info about the RandomNum method! It states: This method returns a number value, which can be saved or used directly.; this is how we save this value!

3) Getting the result from an expression

$name = {@sender nickname}

We have not yet explored expressions, but it's pretty obvious that we get the nickname of @sender and save it to the $name variable.

Example script using variables

This script will return the amount of players there are playing as SCPs.

# save the amount of SCPs by using the `AmountOf` method and `@scps` global variable
$amount = AmountOf @scps

# here we reply to the sender, by returning the variable value
Reply $amount

Important

Literal variables have one thing in common, they can be represented as text, so the Reply method can accept these as a valid reply message.

Clone this wiki locally