Skip to content

Instantly share code, notes, and snippets.

View nommiin's full-sized avatar
🎨
profile drawn by @slimgiltsoul (Twitter)

nommiin nommiin

🎨
profile drawn by @slimgiltsoul (Twitter)
View GitHub Profile
@nommiin
nommiin / input.cpp
Last active March 1, 2026 04:43
A basic shim for adding keyboard support to Minecraft Console Edition
#include "stdafx.h"
#include <Windows64\4JLibs\inc\4J_Input.h>
#include <Common\App_enums.h>
#include <Windows.h>
C_4JInput InputManager;
void C_4JInput::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
@nommiin
nommiin / setup.ts
Last active February 15, 2026 16:32
setup.ts - A simple bun.sh script to setup a GMRT project for TypeScript usage
/*
setup.ts - v0.1
last updated: 2/15/26 @ 10:22am
developed by Nommiin
usage:
1. save as "setup.ts" to your project's directory (next to the .yyp file)
2. run the script with bun (see https://bun.sh/ for installation)
> bun run setup
3. for each .js file in your project, create a neighboring .ts file as needed
@nommiin
nommiin / spec.ts
Last active February 4, 2026 06:19
spec.ts - Convert GmlSpec.xml into JSON using bun.sh
/*
title: spec.ts
author: nommiin
description: uses HTMLRewriter to convert GmlSpec.xml file to output.json
note: reads GmlSpec.xml from runtime-2024.1400.3.948, ensure this is installed
*/
class GmlElement {
public Name: string = "";
toJSON(): Record<string, unknown> {
@nommiin
nommiin / url_parse.gml
Created September 28, 2024 20:55
Parse URL into a struct
/// @function url_parse(_url)
/// @author nommiin
/// @argument {String} _url - The URL to parse into a struct
/// @returns {Struct}
function url_parse(_url) {
var data = {
href: _url,
protocol: undefined,
hostname: undefined,
port: undefined,
@nommiin
nommiin / GMFUNCTION_NAME.gml
Created February 4, 2024 03:20
Get calling GML function as normalized-string
#macro _GMFUNCTION_NAME_ array_first(string_split_ext(_GMFUNCTION_, ["gml_Script_", "gml_Object_", "gml_GlobalScript_", "@"], true, 2))
/*
function test() {
show_message(_GMFUNCTION_NAME_); // test
function does_this() {
show_message(_GMFUNCTION_NAME_); // does_this
var a = function even_work() {
show_message(_GMFUNCTION_NAME_); // even_work
var b = function() {
@nommiin
nommiin / Exception.gml
Last active September 3, 2023 03:36
Exception class for GameMaker 2023, allows custom message or wrapping runtime errors. Allows for error script to be loaded into memory
/// @function Exception(msg, args...)
/// @description A class containing error information for the exception being thrown
/// @argument {string | YYGMLException} msg - The message to store in the exception, or GM exception to wrap
/// @argument {any} [args...] - Variables used in template string
/// @returns {Exception}
/// @notes Enable EXCEPTION_EXTENDED to include the origin GML script's content in the exception
function Exception(msg) constructor {
if (is_struct(msg) && string_pos("YYGMLException", instanceof(msg)) != 0) {
self.message = msg.message;
self.longMessage = msg.longMessage;
@nommiin
nommiin / meta.js
Last active December 11, 2022 22:53
Write macros for GameMaker with JS!
/*
Setup:
1. Create a script named "__meta"
2. Add a line containing "#autogen" anywhere (also it needs to be a comment lol)
3. Create a folder named "tools" in your project root and copy this gist's contents into a file named "meta.js"
4. Create a "pre_project_step.bat" (1) or "pre_project_step.sh" (2) script in your project root and copy the below script:
(1)
@echo off
node %YYprojectDir%\tools\meta.js
(2)
@nommiin
nommiin / imgui-gen.js
Last active December 8, 2022 19:39
A terribly hacky script that somehow makes a weird like builder pattern class thing for Imguigml
/*
This is too much work:
- Here's a link to the generated script using default settings, targeting extImGuiGML v1.100.4 (GM Beta v2022.1100.0.259)
https://gist.github.com/nommiin/bce79d83e6e2d135df11328808105e82
How to use:
1. Create a main.js in your project root (near .yyp) and copy all this into it
1a.) Feel free to modify any of the consts at the top, there's a few settings
2. Run "node main.js"
3. Open newly created "Imgui.gml" and copy into GameMaker
@nommiin
nommiin / fsm.gml
Created May 14, 2022 19:01
A simple FSM class
function StateManager( start ) constructor {
States = {};
Current = start;
CurrentRef = undefined;
BaseRef = undefined;
InstanceRef = other;
static Register = function( name, evt ) {
if (!variable_struct_exists(States, name)) {
var names = variable_struct_get_names(evt), events = {};
@nommiin
nommiin / blob.gml
Last active April 7, 2022 18:01
A simple set of classes for creating a serializable virtual filesystem for use primarily with networking
/*
blob - 4/4/2022
by Nommiin
Getting Started:
- Usage:
(HOST)
1. Create a new Blob by calling "my_blob = new Blob(<name>, [root=""])"
2. Add files to the blob by calling "my_blob.AddFile(<file>)"