ZScript

1 program Added 2025-11-12T08:37:19Z Model: google/gemini-2.5-proTemp: 0.4 Evidence Report issue View issues
Aliases: —
Provenance: commit c40ca6ad08 · authored 2025-11-12T09:37:19+01:00 · model google/gemini-2.5-pro

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

F-Script (0.46)ReScript (0.46)SGScript (0.46)TiScript (0.46)TUSCRIPT (0.46)

LLM-contributed programs

GZDoom Auto-Save Handler

Provenance: commit c40ca6ad08 · authored 2025-11-12T09:37:19+01:00 · model google/gemini-2.5-pro · Temp 0.4
code.zs · added: 2025-11-12T08:37:19Z
/*
    Auto-save script for GZDoom
    by JP LeBreton

    To use:
    - copy this file into your GZDoom directory
    - add the following to your gzdoom.ini file, in the [Global.Autoload] section:
        Path=autosave.zs
    - when you start a game, the script will be active
    - saves to a slot named "autosave"
    - by default, saves every 5 minutes

    To configure:
    - in the GZDoom console (~ key), type e.g.:
        autosave_interval 10
    - this will set the save interval to 10 minutes
    - this setting will be saved to your .ini file

*/

class AutoSaveHandler : StaticEventHandler
{
    // save interval in minutes
    private CVar autoSaveInterval;

    // time of last save, in tics
    private int lastSaveTime;

    override void OnRegister()
    {
        // register our CVar
        autoSaveInterval = CVar.Get(
            "autosave_interval",      // cvar name
            5,                        // default value
            CVAR_ARCHIVE              // flags
            );
    }

    override void WorldTick()
    {
        // don't run in menus
        if (gamestate != GS_LEVEL)
        {
            return;
        }

        // don't run if player is dead
        let p = players[consoleplayer];
        if (!p || !p.mo || p.health <= 0)
        {
            return;
        }

        // time since last save, in minutes
        let timeSinceLastSave = (gametic - lastSaveTime) / (35.0 * 60.0);

        if (timeSinceLastSave >= autoSaveInterval.GetFloat())
        {
            Console.Printf("Auto-saving...");
            SendNetworkEvent("AutoSave");
            lastSaveTime = gametic;
        }
    }

    override void NetworkProcess(ConsoleEvent e)
    {
        if (e.Name == "AutoSave")
        {
            Game.Save("autosave", "Auto-save");
        }
    }
}

Contribute — propose a file extension

Tell us where to find evidence about ZScript (mapped to pl/zscript). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/ZScript/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← ZRL Zsh →