RaggieScript v1.3.0
Browse Table of Contents (17 chapters)
Getting Started (2)
Language Reference (4)
Core Standard Library (3)
Windows, MSI SQL & Native FFI (3)
Wizard UI & Studio Sandboxes (3)
Diagnostics & Bytecode ISA (2)
Master Symbol Index
5 min read Module: raggiesoft.raggiescript F1: IDH_RSSC_STORESCRIPT (0x2011)

storescript.* (StoreTrainer) & crossroads.* (Story Crossroads)

RaggieScript v1.3 brings first-class, RSW702 capability-sandboxed domain profiles to two flagship RaggieSoft consumer experiences: StoreScript (use storescript;) for RaggieSoft StoreTrainer, and Story Crossroads (use crossroads;) for interactive branching novels in RaggieSoft Book Reader and https://crossroads.raggiesoft.com.


storescript.* — StoreScript Save-File & Config Trainer DSL (20 Methods)

Origin Story: Hello, StoreScript!

Long before RaggieScript unified all eight RaggieSoft Studio developer tools, Michael P. Ragsdale envisioned StoreScript as a dedicated scripting language for RaggieSoft StoreTrainer (storetrainer.raggiesoft.com—originally created in the pre-AI Visual Basic 6.0 TStore.vbp era as an offline single-player PC game save-file and trainer utility).

In RaggieScript v1.3, StoreScript is officially part of RaggieScript:

Complete storescript.* API Reference

MethodSignatureReturnDescription
storescript.profilestorescript.profile(id: string, title?: string, saveGlob?: string)mapDeclares trainer metadata ({ id, title, saveGlob }) for StoreTrainer's library shelf.
storescript.backupSavestorescript.backupSave(tag?: string)stringCaptures an instant snapshot of the active save buffer and returns its backupId.
storescript.restoreBackupstorescript.restoreBackup(backupId?: string)boolRestores the active save buffer from backupId (or the most recent snapshot when omitted).
storescript.sizestorescript.size()intReturns the byte length of the active binary save buffer.
storescript.readU8storescript.readU8(offset: int)intReads an unsigned 8-bit integer (0..255) at offset (bounds-checked).
storescript.writeU8storescript.writeU8(offset: int, value: int, min?: int, max?: int)boolClamps value to [min, max] (0..255) and writes 1 byte at offset.
storescript.readI16LEstorescript.readI16LE(offset: int)intReads a signed 16-bit little-endian integer (-32768..32767) at offset.
storescript.writeI16LEstorescript.writeI16LE(offset: int, value: int, min?: int, max?: int)boolClamps value and writes a 16-bit little-endian integer at offset.
storescript.readI32LEstorescript.readI32LE(offset: int)intReads a signed 32-bit little-endian integer at offset.
storescript.writeI32LEstorescript.writeI32LE(offset: int, value: int, min?: int, max?: int)boolClamps value to [min, max] and writes a 32-bit little-endian integer at offset.
storescript.readU32LEstorescript.readU32LE(offset: int)intReads an unsigned 32-bit little-endian integer (0..4294967295) at offset.
storescript.writeU32LEstorescript.writeU32LE(offset: int, value: int, min?: int, max?: int)boolClamps value (0..4294967295) and writes an unsigned 32-bit little-endian integer (ideal for CRC-32 checksums).
storescript.readF32LEstorescript.readF32LE(offset: int)floatReads a 32-bit IEEE 754 little-endian float at offset.
storescript.writeF32LEstorescript.writeF32LE(offset: int, value: float, min?: float, max?: float)boolClamps value and writes a 32-bit IEEE 754 little-endian float at offset.
storescript.readAsciistorescript.readAscii(offset: int, maxLen: int)stringReads a null-padded fixed-width ASCII string of up to maxLen bytes at offset.
storescript.writeAsciistorescript.writeAscii(offset: int, text: string, maxLen?: int)boolWrites text at offset and zero-pads any remaining bytes up to maxLen.
storescript.findPatternHexstorescript.findPatternHex(patternHex: string, startOffset?: int)intScans the save buffer for a hex byte signature supporting ?? wildcards ("43 52 45 44 ?? ??"); returns 0-based byte offset or -1.
storescript.crc32Rangestorescript.crc32Range(startOffset?: int, length?: int)intComputes standard unsigned IEEE 802.3 CRC-32 over [startOffset, startOffset + length) so patched saves pass integrity checks!
storescript.getJsonstorescript.getJson(dotPath: string, fallback?: any)anyReads a nested key ("audio.subtitleScale") from the loaded JSON save/config document.
storescript.setJsonstorescript.setJson(dotPath: string, value: any)boolUpdates or creates a nested dot-path key inside the loaded JSON save/config document.
use storescript;

const meta = storescript.profile("cedar-run-tactics", "Cedar Run Tactics — Save Utility", "*.sav");

fn applyCreditsBoost(requestedCredits: int) : map {
    const snap = storescript.backupSave("pre-credits");
    const sigOffset = storescript.findPatternHex("43 52 45 44 ?? ??");
    if (sigOffset < 0) {
        return { ok: false, reason: "Signature not found" };
    }

    // Write clamped 32-bit little-endian credits right after the 6-byte header
    storescript.writeI32LE(sigOffset + 6, requestedCredits, min: 0, max: 999999);

    // Recompute IEEE CRC-32 over payload bytes [4..size) and store at offset 0
    const crc = storescript.crc32Range(4, storescript.size() - 4);
    storescript.writeU32LE(0, crc);
    return { ok: true, backupId: snap, newCredits: storescript.readI32LE(sigOffset + 6), crc32: crc };
}

crossroads.* — RaggieSoft Story Crossroads Interactive Novel Engine (8 Methods)

RaggieSoft Story Crossroads (crossroads.raggiesoft.com, in-universe Architects: Rowan & Iris Hawthorne) is RaggieSoft's independent interactive-fiction imprint. A single use crossroads; .rssc file executes natively inside RaggieSoft Book Reader (.NET) and compiles via raggiescript.exe transpile-es2022 (or RsscEs2022Transpiler.TryTranspile) into a zero-eval() ES2022 JavaScript module for the web!

MethodSignatureReturnTargetsDescription
crossroads.visitcrossroads.visit(nodeId: string)intC++20, .NET, ES2022Marks narrative route node nodeId visited and returns the updated visit count (1 on first visit).
crossroads.visitedcrossroads.visited(nodeId: string)boolC++20, .NET, ES2022Returns true if the reader has previously visited nodeId.
crossroads.visitCountcrossroads.visitCount(nodeId: string)intC++20, .NET, ES2022Returns how many times the reader has visited nodeId.
crossroads.setFlagcrossroads.setFlag(key: string, value?: any)boolC++20, .NET, ES2022Stores a persistent branching narrative flag (value defaults to true).
crossroads.getFlagcrossroads.getFlag(key: string, fallback?: any)anyC++20, .NET, ES2022Reads narrative flag key (or fallback, default false).
crossroads.adjustStatcrossroads.adjustStat(statKey: string, delta: int, min?: int, max?: int)intC++20, .NET, ES2022Adds delta to statKey, clamps within [min, max], and returns the updated value.
crossroads.offerOptioncrossroads.offerOption(label: string, targetNode: string, enabled?: bool, note?: string)boolC++20, .NET, ES2022Registers an interactive route option card ({ label, target, enabled, note }) for the current scene.
crossroads.optionscrossroads.options()arrayC++20, .NET, ES2022Returns all offered route option maps for the active Story Crossroads scene.
use crossroads;

fn evaluateKeystoneBridgeScene(hasLanternKey: bool) : array {
    const visits = crossroads.visit("cpi-keystone-bridge-dusk");
    if (hasLanternKey) {
        crossroads.setFlag("unlockedArchivistVault", true);
    }
    crossroads.offerOption(
        "Inspect the Ironstone keystone inscription with Iris",
        "cpi-pendleton-archive",
        true,
        visits > 1 ? "Revisit with new clues" : "First inspection"
    );
    crossroads.offerOption(
        "Unlock the lower Commonwealth Mall lantern passage",
        "cpi-lantern-vault",
        crossroads.getFlag("unlockedArchivistVault", false) == true,
        "Requires the Archivist's brass lantern key"
    );
    return crossroads.options();
}
Indexed API Calls & Symbols on This Page (4):