Skip to content

Instantly share code, notes, and snippets.

@hogart
hogart / dlg-macro.twee
Last active April 15, 2020 23:07
dlg-macro.twee
Script [script]
(function () {
'use strict';
/* globals version, Macro, jQuery */
if (!version || !version.title || 'SugarCube' !== version.title || !version.major || version.major < 2) {
throw new Error('<<dlg>> macro requires SugarCube 2.0 or greater, aborting load');
}
function getOrCreate(id) {
@hogart
hogart / date-time.twee
Last active November 3, 2019 17:01
date-time widget with nice blinking minutes
::StoryInit
<<set
$gameDate = Date("2019-07-14T07:00Z");
>>
<<set
window.GameDays = [
"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
];
>>
@hogart
hogart / twine-bgmusic.twee
Last active October 15, 2019 14:45
twine-bgmusic
::StoryTitle
twine-bgmusic
::PassageReady
<<if !$masterPlaying && passage() !== 'YOUR-START-PASSAGE'>>
<<bgsound>>
<</if>>
::_setup-sound
<!-- <<include [[_setup-sound]]>> in StoryInit -->
@hogart
hogart / fix.twee
Created September 24, 2019 21:43
Фикс для SugarCube >= 2.29, который не принимает названия игр без латиницы
::StorySubtitle
НазваниеВашейИгры
::Style[stylesheet]
#story-title {
display: none;
}
#story-subtitle {
margin: 0;
font-size: 162.5%;
@hogart
hogart / twine-achievements.twee
Last active April 29, 2021 22:43
twine-achievements
::StoryTitle
twine-achievements
::StoryAbout
This is Twee 3 code. Learn more here: [[https://twinery.org/cookbook/terms/terms_twee.html]].
Icon used ("icon-achievement" passage): [[https://game-icons.net/1x1/skoll/achievement.html]]. You ''must'' properly credit the original, or use your own image.
Features:
* displays notification in lower-right corner when achievement is awarded
@hogart
hogart / set-win-keyboards.ps1
Last active September 10, 2019 12:46
#keyboard #win10 #power-shell
$1 = New-WinUserLanguageList en-US
$1.Add("ru-RU")
Set-WinUserLanguageList $1 -Force
@hogart
hogart / abbr.js
Created October 20, 2018 09:11
compiled abbr macro
(function () {
// usage: <<abbr "text" "long explanation">>
'use strict';
/* globals version, Macro, jQuery */
if (!version || !version.title || 'SugarCube' !== version.title || !version.major || version.major < 2) {
throw new Error('<<abbr>> macro requires SugarCube 2.0 or greater, aborting load');
}
version.extensions.abbr = { major: 1, minor: 2, revision: 1 };
@hogart
hogart / geo.js
Last active January 23, 2018 00:50
const EARTH_RADIUS = 6378137;
function toDeg(angle) {
return angle * 180 / Math.PI;
}
function toRad(angle) {
return angle * Math.PI / 180;
}
@hogart
hogart / tracery-sample.json
Last active February 27, 2017 22:50
if-ru tracery
{
"encounter": ["Я встретил #animal"],
"animal": ["серого волка", "#color# медведя", "#color# зайца"],
"color": ["черного", "белого"]
}
[[Intro]]:
Some bla-bla.
+++Read on
More bla-bla, also take a look at this [additional info].
+++Read on further
Even more bla-bla.