Skip to content

Instantly share code, notes, and snippets.

@dogboydog
dogboydog / DebugEditorVariableStorage.cs
Created June 21, 2024 03:01
Modified for testing by exposing the internal variables dictionary. A simple implementation of VariableStorageBehaviour for YarnSpinner-Godot
/*
The MIT License (MIT)
Copyright (c) 2015-2017 Secret Lab Pty. Ltd. and Yarn Spinner contributors.
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 to use, copy, modify, merge, publish, distribute, sublicense,
@dogboydog
dogboydog / TilesetDisplayImageTest.js
Last active June 6, 2024 00:14
Tiled tile.displayImage test script
var TilesetImageTest = {};
TilesetImageTest.action = tiled.registerAction("TilesetImages", function (action) {
var dialog = new Dialog('Tile Image Test');
var tilesRendered = 0;
if (tiled.activeAsset != null && tiled.activeAsset.isTileset){
var set = tiled.activeAsset;
for (tile of set.tiles){
@dogboydog
dogboydog / ExampleYarnVariableStorage.cs
Created May 25, 2024 20:58
Custom variable storage for YarnSpinner-Godot . Variables that start with `$_` are saved to a separate dictionary, this is intended for variables that don't need to be saved to disk.
using System;
using System.Collections.Generic;
using System.Globalization;
using Godot;
using YarnSpinnerGodot;
/// <summary>
/// Interface to YarnSpinner that allows getting and setting of save data from
/// dialogue. Also handles temporary variables that aren't committed to save data
@dogboydog
dogboydog / WorldScripting.js
Last active January 22, 2024 16:28
Testing world scripting functionality for Tiled (map editor)
/*
* Testing world scripting functionality
*/
var WorldScripting = {};
WorldScripting.scriptAction = tiled.registerAction("WorldScripting", function (action) {
var state = {
worlds: tiled.worlds,
}
@dogboydog
dogboydog / AddProjectProperties.js
Created June 5, 2023 23:43
example tiled scripts related to the addition of custom properties to Tiled Projects https://github.com/mapeditor/tiled/pull/3667
var AddProjectProperties = {};
AddProjectProperties.action = tiled.registerAction("ProjectCustomProperties", function (action) {
tiled.project.setProperty('newString', 'hello world');
tiled.project.setFloatProperty('newRatio', 0.7);
tiled.project.setColorProperty('newColor', "#aabbaa");
});
AddProjectProperties.action.text = "Add Project Properties";
@dogboydog
dogboydog / unity_ys_csv_to_godot.py
Created July 17, 2022 19:27
given a directory with YarnSpinner-Unity csv files, convert to godot localization .csv format (python 3)
import csv
import pathlib
import os
import re
def fix_locale_code(code):
# https://docs.godotengine.org/en/stable/tutorials/i18n/locales.html
return code.replace("-", "_")
@dogboydog
dogboydog / convert.py
Last active April 6, 2024 08:04
Convert Nimbus Notes HTML to Markdown for Joplin
# -------------------------------------------------------------------------
# Nimbus note HTML export to markdown converter
# Extract all zip files containing 'note.html' and convert to markdown
#
# Setup:
# 1) install python 3 for your OS
# 2) install pandoc https://github.com/jgm/pandoc/releases/tag/2.11.4
# on Windows, the .msi will automatically add pandoc to your $PATH
# otherwise add it to your $PATH.
# 3) save this script in the directory where your HTML exports were