Skip to content

Instantly share code, notes, and snippets.

@nightcycle
nightcycle / creatorlab-script.ahk
Last active April 30, 2024 19:33
Base CreatorLab AutoHotkey Script
; General Constants
SCREEN_CENTER_X_OFFSET := 950 ; x screen px coordinate for center of screen
SCREEN_CENTER_Y_OFFSET := 550 ; y screen px coordinate for center of screen
MIN_INPUT_DELAY_MS := 80 ; the number of milliseconds to wait after pressing enter to input a value into the menu
MIN_COMMAND_DELAY_MS := 250 ; the number of milliseconds to wait after copying / pasting / deleting / changing an in-world item
MENU_OPEN_DELAY_MS := 400 ; how long to wait for the menu to finish opening
MENU_CLOSE_DELAY_MS := 400 ; how long to wait for the menu to finish opening
@nightcycle
nightcycle / tag-array.sh
Created April 17, 2024 19:49
Generate an array of tags for a muse project, just run in the vscodium integrated bash terminal (specifically bash, not powershell) "sh tag-array.sh MythNameHere" and it will generate a script called "TagArray.cs" in the appropriate myth.
#!/bin/bash
myth_name="$1"
codegen_path="Codegen/Tags.cs"
codegen_contents=$(<$codegen_path) # the contents of the codegen script
# Regular expression to match lines containing "public static readonly string".
codegen_regex="public static readonly string[[:space:]]+[[:alnum:]_]+[[:space:]]*=[[:space:]]*\"([^\"]+)\";"
# Array to hold the extracted string values.
declare -a tags_array
@nightcycle
nightcycle / benchmark.d.lua
Last active February 5, 2024 18:50
benchmark.d.lua
--!nocheck
export type BenchmarkProfiler = {
Begin: (label: string) -> (),
End: () -> (),
}
@nightcycle
nightcycle / organize-imports.luau
Last active November 17, 2023 06:23
I wrote this because Synty Studios uses texture maps for their assets, but it's more convenient to recolor the mesh directly in Roblox Studio. This splits it into multiple OBJ based on the color the UV points to.
--!strict
-- Run this in command line after you import the meshes
-- Services
-- Packages
-- Modules
-- Types
-- Constants
local SEPARATION = 1
local MAX_X_OFFSET = 50
-- Variables
@nightcycle
nightcycle / ViewportModel.luau
Created September 1, 2023 13:20
A type safe version of EgoMoose's ViewportModel class
--!strict
--[[
MIT License
Copyright (c) 2021 EgoMoose + 2023 Nightcycle
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@nightcycle
nightcycle / testEZ.d.lua
Last active September 2, 2023 21:17
luau-lsp type definition file for testEZ (.spec) scripts
export type Expectation = {
to: Expectation,
be: Expectation,
been: Expectation,
have: Expectation,
was: Expectation,
at: Expectation,
a: (typeName: string?) -> Expectation,
an: (typeName: string?) -> Expectation,
ok: () -> Expectation,
@nightcycle
nightcycle / remodel.d.lua
Created July 26, 2023 20:53
luau-lsp type file for remodel
--!nocheck
declare class RemodelInstance
Name: string
ClassName: string
Parent: RemodelInstance
function Destroy(self): ()
function Clone(self): RemodelInstance
function GetChildren(self): { RemodelInstance }
function GetDescendants(self): { RemodelInstance }
function FindFirstChild(self, name: string): RemodelInstance?
@nightcycle
nightcycle / luau.yml
Created July 26, 2023 20:49
selene luau yml file
# This is for general Luau functionality.
# Valid: math.sign(), bit32.countlz()
# Invalid (put in selene-lib/default_std/roblox_base.yml instead): CFrame.new(), Instance.new(), task.spawn()
---
base: lints/lua51
globals:
bit32.arshift:
args:
- type: number
- type: number
@nightcycle
nightcycle / lua51.yml
Last active July 26, 2023 20:45
assert ignoring lua51.yml
---
globals:
_G:
property: new-fields
_VERSION:
property: read-only
arg:
property: new-fields
assert:
args: