Official Technical Specification (Stable Release)
Kobalt is a lightweight, imperative scripting language designed for text-based game engines and logic prototyping. Version 1.1.3 introduces major core improvements including PEMDAS math support and complex data nesting.
Download Kobalt v1.1.3 Suite (.zip)Kobalt follows a specific set of rules that distinguish it from other languages:
Variable and variable are two different memory addresses.Use the var keyword to initialize a variable. Variables in Kobalt can hold Numbers, Strings, Lists, or Dictionaries.
var player.hp = 100 var player.name = "Abdul" var is_active = 1 # 1 represents true, 0 represents false
The set command is used to modify existing variables or perform calculations.
set x = 10 + 5 * 2 # Result: 20 (Standard Math) set y = 100 % 3 # Modulo operator (Result: 1) set name = "Mr. " + player.name # String concatenation
Kobalt supports compound conditions using and and or operators.
if hp > 0 and stamina > 0 print "You can still fight!" elif has_potion == 1 or is_god_mode == 1 print "You survive." else print "Game Over." end
Ordered collections accessed by a numerical index (starting at 0). Version 1.1.3 adds direct mutation support.
list inventory push inventory "Sword" push inventory "Shield" set_at 0 inventory "Laser Sword" # Direct modification at index 0 var item = "" at 0 inventory item # item becomes "Laser Sword"
Collections of Key-Value pairs. Keys must be Strings. Values can now be Lists.
dict weapon_stats dict_set weapon_stats "Sword" 50 dict_get damage weapon_stats "Sword" # damage becomes 50
Iterate through code blocks based on conditions or collection items.
foreach i in inventory set msg = "- " + i print msg end
| Command | Usage | Description |
|---|---|---|
to_lower | to_lower [res] [src] | Converts text to lowercase. |
to_upper | to_upper [res] [src] | Converts text to uppercase. |
split | split [list] [src] [sep] | Splits a string into a List by separator. |
replace | replace [res] [src] [A] [B] | Replaces string A with string B. |
contains | contains [res] [src] [part] | Returns 1 if part exists in src, else 0. |
Functions now support returning values directly to variables using the set ... call syntax.
def calculate_atk base bonus var total = base + bonus return total end var my_dmg = 0 set my_dmg = call calculate_atk 10 5 # my_dmg becomes 15
write_file "save.txt" player.hp # Overwrites file append_file "log.txt" "New Action" # Adds new line list data read_file data "save.txt" # Reads entire file into a list
try to_num value user_input set res = 100 / value catch print "Error: Calculation Failed." end
| Command | Arguments | Purpose |
|---|---|---|
set_at | [index] [list] [val] | New: Modifies a list item at specific index. |
print | [value] | Outputs data to terminal. |
input | [variable] | Receives line of text from user. |
random | [var] [min] [max] | Generates a random integer. |
import | "filename.kbl" | Executes an external Kobalt script. |
file_exists | [res] [name] | Returns 1 if file exists. |
return | [value] | Exits function and optionally returns a value. |
© 2026 Kobalt Interpreter Project. All Rights Reserved.