KyroScript
Basics: values and variables
A script is a list of lines, run top to bottom. Each line does one thing.
✨ Tip The small examples on these pages show just the script (the part below
---). The full examples show whole command files.Variables
A variable is a name for a value. Set it with =, and use it anywhere after that.
coins = 250
name = "Ana"
ok = true
nothing = none
coins += 50 # same as coins = coins + 50Names use letters, numbers and _, and can’t start with a number. A few names are taken by the language (like user, reply or text), so pick something else, like target.
Kinds of values
- Numbers:
5,2.5,-3,1_000_000. - Text:
"in double quotes"or'in single quotes'. - Yes/no:
trueandfalse(lowercase). - Nothing:
none. - Lists:
[1, 2, 3], in order. - Maps:
{"name": "Ana", "level": 4}, values looked up by a text key. - Discord things: users, members, the server, channels, roles and messages. You read their details, like
user.name.
Text with values inside
In double quotes, anything in {…} is filled in. It can be a variable, some maths or a function call.
coins = 250
reply("Hi {user.name}! In a week you’ll have {coins * 2} coins.")
reply('Single quotes keep {braces} as they are.')⚠️ Heads up Inside
{…}, write any text in single quotes: "{join(names, ', ')}". To show a brace in double-quoted text, write \{.You can also join text with +, and it works with any value: "Level " + 5 becomes "Level 5".
Maths
+ - * / as usual, // divides and rounds down, % gives the remainder. Brackets work like in school.
total = (2 + 3) * 4 # 20
half = 7 / 2 # 3.5
whole = 7 // 2 # 3
left = 7 % 2 # 1
rounded = round(3.14159, 2) # 3.14Lists and maps
fruits = ["apple", "pear"]
append(fruits, "plum")
first = fruits[0] # positions start at 0
last = fruits[-1] # negative counts from the end
profile = {"name": "Ana", "level": 4}
profile.level += 1 # same as profile["level"]
reply(profile.missing) # a missing key is noneComments
Anything after # is a note for people and is ignored when the script runs.
Was this page helpful?