STONKS-9800
Stock Market Simulator
Modding STONKS-9800 (Catspeak)
This page explains how to create and load simple mods for STONKS-9800 using Catspeak scripts (.meow files).
Basic scripting knowledge is recommended.
The game was made using GameMaker, so knowledge of this engine will also be very helpful.
Contents
1. Quick start
- Create a
.meowfile indatafiles/mods/that returns a singlestruct. - The struct may contain callback fields that the game will call automatically (see Lifecycle callbacks).
- The mod list is read on game start. Enable/disable choices are stored in
mods/mods_config.json. - The whole Catspeak runtime is exposed through
Catspeak.interface, so advanced users can call GML scripts and access globals directly. - Also, feel free to look at my game's code using utilities such as UndertaleModTool, but I apologize in advance for the messy and ugly code in my game. I'm very sorry.
2. Minimal example
Smallest useful mod that gives the player 1 000 000 money every in-game day:
mod = {
name: "Hello mod",
description: "Smallest useful example",
// runs once when the game starts
start_game: fun () {
mods_notify("Hello!", "Mod started");
},
// runs at the beginning of each in-game day
new_day: fun () {
global.money += 1_000_000; // simple daily bonus
}
}
return mod
3. Lifecycle callbacks
These optional functions can be defined inside your mod struct:
start_game()— runs once before all loading.start_new_game()— runs once after a new game is created.after_creating_character()— after the player finishes character creation.after_game_load()— after a save file is loaded; restore your custom state here.new_day()— runs every in-game day at turnover.step()— runs every step; keep it light.draw()— main draw event (avoid heavy logic).draw_end()— draw overlays and HUD elements.draw_portrait_before(),draw_portrait_after()draw_portrait_mini_before(),draw_portrait_mini_after()- Bar events:
bar_start(),bar_step(),bar_destroy(),bar_draw() - Notification window:
window_start(),window_destroy(),window_draw() window_sprite()— allows changing Amy sprite or window sprite; for example:amy_sprite = "spr_amy".- Shareholder meetings:
meeting_start(),meeting_step(),meeting_draw()
4. Core market structure
- Up to 30 companies.
global.numberofcompanycontrols how many slots are active. - Empty slots use
global.company_liq[i] == 1. - Important arrays (index
iis company slot): global.company_name[i]— display name.global.company_field[i]— sector (0..7).global.company_price[i]— base price for reports.global.company_profit[i]— yearly profitability (0.12 = +12%).global.company_hype[i],global.company_hype_effect[i]— marketing/news impact.global.company_number_a[i]— total shares issued.global.company_limit[i],global.company_limit_kil[i]— buy limits.global.company_rezerv[i]— reserve funds.global.company_ac[i]— shares currently in circulation.global.company_stockprice[i]— capitalization generated from price, hype, and global market stats.- Defaults for a slot are filled by
generate_company(i). - After editing a company, call
company_info_reset(i)to refresh UI and reports.
5. Player & economy data
- Global economy examples:
global.rynochek(market state),global.inflation, and variousglobal.news_*fields. - Player state examples:
global.money,global.happy,global.stress,global.karma,global.prestige. - Portfolio:
global.human_finans[ii][i]holds per-human stock amounts, including the player. - Companies created by the player are marked with
global.company_create_player[i].
6. Humans & contacts
- Population counts:
global.human_kol(active humans),global.human_kol2(extra slots for events / yakuza). - Identity & visuals: names plus layered portrait sprites
(
global.human_sprite_head[i],human_sprite_hair[i],human_sprite_unique[i],human_sprite_chibi_unique[i], etc.). - Core stats:
global.human_intelligence[i],global.human_charisma[i], mood fields likeglobal.human_nastriy[i](0–100). - Employment and pay:
global.human_type[i](role), salary, work days,human_days_off[i], etc. - Finance and perks: stock ownership, yakuza flag
global.human_yakuza[i], and more. - Useful helpers:
change_friend(delta, human_id)— adjusts friendship and shows UI popups.price_human(human_id)— estimates salary needs.draw_portrait(human_id, x, y, size)— draws a layered portrait.
- Always keep human indices between
1andglobal.human_kolin mods. - Use
txt(id)for localized strings when showing messages.
7. Helper utilities for mods
mods_notify(title, text, human=0, type=0, callback=Pusto, right=false)— shows a notification window with optional portrait and confirmation callback.mods_create_company(props)— creates or revives a company slot using a property struct (name, sector, price, etc.). It refreshes statistics and investor panels automatically.mod_register_trait(struct)— registers a new character trait (see game examples for exact fields likeid,name,effects).
8. Practical patterns
- Event-driven scenarios: use
new_day()to check dates and start story events; combine withmods_notify()and traits, yakuza flags, or changes toglobal.company_profit[i]to simulate news. - Custom companies: create a story-specific company with
mods_create_company()and store the returned slot index in your mod struct. - Custom overlays: attach drawing code to
draw_end()to show HUD elements, usingtxt()for localized captions. - Save data: mods can store long-term state in
globalvariables. Initialize instart_game()and restore inafter_game_load().
9. Using delay_action
The game includes a system called delay_action, which lets you schedule actions
to run after a number of in-game days.
- Typical use inside the game:
delay_action(5, "action_name", arg0, arg1, ...) - When 5 in-game days pass,
action_nameis called with the given arguments.
To use your own mod functions with this system, you must register them first:
// Register function for delay_action
mod_register_func("my_mod.give_money", give_money)
Example function in your .meow file (note: do NOT use let):
give_money = fun (amount) {
global.money += amount
}
Then you can schedule it:
delay_action(3, "my_mod.give_money", 500000)
- Register your function before using it in
delay_action. - Use string keys like
"my_mod.give_money"; they must be unique. - Your function can have up to 7 parameters.
- Works alongside all built-in delay actions; there is no conflict with other mods.
10. Portraits
You can extend the portrait system with new parts or unique sprites.
portrait_part_register(sex, part, sprite, sprite_chibi = undefined)
Parts:"head","eyes","hair","mouth","nose","body".portrait_extra_register(sprite, sprite_chibi = undefined, _id = undefined)
Registers a full unique portrait (normal and chibi)._idmust be a unique string so it does not conflict with other mods.
With these tools you can create story events, custom companies, traits, portraits and more. Check example mods in the game files for additional reference.