The Skript book · Chapter 6

Data Types

Skript has four kinds of value — numbers, strings, booleans and lists — and it wears its types lightly: you never declare them, you just write values, and each value knows what it is. This chapter covers the first three; lists get the next chapter to themselves.

Numbers

Whole numbers and decimals are one type, written the obvious way: 42, 3.5, -1. The four operators + - * / combine them with schoolbook precedence — multiplication and division before addition and subtraction, evaluated left to right among equals:

set a to 2 + 3 * 4
set b to 10 - 4 - 3
set c to 7 / 2
log "a={a} b={b} c={c}"
output — real, executed at build time
▶ example.skript — Skode Skript · local simulation

  ● event: script                      → name: Demo
  ✎ set a                              → = 14
  ✎ set b                              → = 3
  ✎ set c                              → = 3.5
  • log                                → a=14 b=3 c=3.5

  ✔ done in 2.1ms

Note a is 14, not 20 — precedence — and b is 3, because subtraction associates left. Division produces decimals when it must; Skript does not truncate behind your back. There is no parenthesis syntax in expressions; when a formula grows past what precedence expresses clearly, split it across two set lines with a named intermediate — future readers will thank you anyway.

Remember the golden habit from Chapter 3: spaces around operators. Names in Skript may contain dots and apostrophes (lead's budget is a valid name), so without spaces the interpreter cannot tell your minus sign from your hyphen.

Strings

Strings hold text of any length in "double" or 'single' quotes, escape an inner quote with a backslash, and interpolate {names}:

set who to "world"
set msg to "Hello, {who}!"
log "{msg} ({msg} has no idea it was assembled)"
output — real, executed at build time
▶ example.skript — Skode Skript · local simulation

  ● event: script                      → name: Demo
  ✎ set who                            → = "world"
  ✎ set msg                            → = "Hello, world!"
  • log                                → Hello, world! (Hello, world! has no idea it was assembled)

  ✔ done in 2.1ms

Interpolation happens when the string is used, and set uses its right-hand side immediately, so msg above was assembled at assignment time. Joining with + you have seen; between a string and a number, + joins too, turning the number into text:

set n to 3
set badge to "attempt #" + n
log "{badge}"
output — real, executed at build time
▶ example.skript — Skode Skript · local simulation

  ● event: script                      → name: Demo
  ✎ set n                              → = 3
  ✎ set badge                          → = "attempt #3"
  • log                                → attempt #3

  ✔ done in 2.1ms

That is the whole of Skript's type coercion story in one rule: + with any string joins; everything else arithmetic wants real numbers, and complains in plain English otherwise (Chapter 13 shows the complaint).

Booleans

true and false are values like any other — storable, comparable, and usable directly as conditions:

set vip to true
if vip then
  log "the red carpet, please"
if vip is true then
  log "same check, spelled out"
if vip is not false then
  log "and its double negative, for completeness"
output — real, executed at build time
▶ example.skript — Skode Skript · local simulation

  ● event: script                      → name: Demo
  ✎ set vip                            → = true
  ✓ if vip                             → yes
  • log                                → the red carpet, please
  ✓ if vip is true                     → yes
  • log                                → same check, spelled out
  ✓ if vip is not false                → yes
  • log                                → and its double negative, for completeness

  ✔ done in 2.1ms

A bare name as a condition (if vip then) asks "is this truthy?" — false, 0, an empty string, and a missing value all fail; everything else passes. The spelled-out forms is true / is not false do exact comparison. Both styles are common; use the bare form for flags and the spelled form when the value might legitimately be several things.

What Skript deliberately does not have

It is worth saying out loud what is missing, because each absence is a decision, not an oversight:

  • No null. A name either has a value or is just a word (the unset-name rule). Automations do not need a third state of nothingness to reason about.
  • No dictionaries or objects. The event is the record; its fields are already spread out as names. When you truly need structured data, that is Skode's job — a skript orchestrates it rather than modelling it.
  • No type declarations, casts, or conversions. The one coercion rule above covers the honest cases; anything trickier is a sign the logic belongs in a Function or a connector, not a sentence.

A small language stays small by declining things. What remains — four types, one coercion rule, sentence-shaped operators — is genuinely all of Skript's data model, and you now know it in full.