Skip to content

Commit dab0534

Browse files
authored
RELEASE: v2.35.0
## Changelog: * Fixed issues with nested `<svg>` tags. * Fixed issues with comments within macro arguments. * Added the `<<done>>` macro. **NOTE:** This is compatible with Chapel's macro of the same name, so if you're using that you can, and should, remove it. * Updated `<<numberbox>>` to more reliably show a numeric keypad on mobile devices. * Updates to locale files: * Added `ar-EG.js` – العربية (مصر). * Added `it-IT.js` – Italiano (Italy). * Updated `de.js` – Deutsch. * Various documentation updates. * Various internal improvements.
2 parents 71ee235 + f4ad8c4 commit dab0534

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+458
-135
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013-2020, Thomas Michael Edwards <thomasmedwards@gmail.com>.
1+
Copyright (c) 2013-2021, Thomas Michael Edwards <thomasmedwards@gmail.com>.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

dist/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013-2020, Thomas Michael Edwards <thomasmedwards@gmail.com>.
1+
Copyright (c) 2013-2021, Thomas Michael Edwards <thomasmedwards@gmail.com>.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

dist/format.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/core/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Returns a deep copy of the given value.
1111

1212
<p role="note"><b>Note:</b>
13-
Only the primitives, generic objects, some JavaScript natives (specifically: <code>Array</code>, <code>Date</code>, <code>Map</code>, <code>RegExp</code>, and <code>Set</code>), and DOM node objects are supported by default. Unsupported object types, either native or custom, will need to implement <code>.clone()</code> method to be properly supported by the <code>cone()</code> function—when called on such an object, it will simply defer to the local method; see the <a href="#guide-tips-non-generic-object-types"><em>Non-generic object types (a.k.a. classes)</em> guide</a> for more information.
13+
Only the primitives, generic objects, some JavaScript natives (specifically: <code>Array</code>, <code>Date</code>, <code>Map</code>, <code>RegExp</code>, and <code>Set</code>), and DOM node objects are supported by default. Unsupported object types, either native or custom, will need to implement <code>.clone()</code> method to be properly supported by the <code>clone()</code> function—when called on such an object, it will simply defer to the local method; see the <a href="#guide-tips-non-generic-object-types"><em>Non-generic object types (a.k.a. classes)</em> guide</a> for more information.
1414
</p>
1515

1616
#### History:

docs/core/macros.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ The versions that forward to a specific passage are largely unnecessary, as you
18181818

18191819
<span id="macros-dom-warning"></span>
18201820
<p role="note" class="warning"><b>Warning:</b>
1821-
All DOM macros require the elements to be manipulated to be on the page. As a consequence, you cannot use them directly within a passage to modify elements within said passage, since the elements they are targeting are still rendering, thus not yet on the page. You must, generally, use them with a interactive macro—e.g., <a href="#macros-macro-link"><code>&lt;&lt;link&gt;&gt;</code> macro</a>—or within the <a href="#special-passage-passagedone"><code>PassageDone</code> special passage</a>. Elements that are already part of the page, on the other hand, present no issues.
1821+
All DOM macros require the elements to be manipulated to be on the page. As a consequence, you cannot use them directly within a passage to modify elements within said passage, since the elements they are targeting are still rendering, thus not yet on the page. You must, generally, use them with an interactive macro—e.g., <a href="#macros-macro-link"><code>&lt;&lt;link&gt;&gt;</code> macro</a>—the <a href="#macros-macro-done"><code>&lt;&lt;done&gt;&gt;</code> macro</a>, or within the <a href="#special-passage-passagedone"><code>PassageDone</code> special passage</a>. Elements that are already part of the page, on the other hand, present no issues.
18221822
</p>
18231823

18241824
<!-- *********************************************************************** -->
@@ -2728,6 +2728,32 @@ This macro has been deprecated and should no longer be used. See the <a href="#
27282728

27292729
<!-- *********************************************************************** -->
27302730

2731+
### `<<done>> … <</done>>` {#macros-macro-done}
2732+
2733+
Silently executes its contents when the incoming passage is done rendering and has been added to the page. Generally, only really useful for running code that needs to manipulate elements from the incoming passage, since you must wait until they've been added to the page.
2734+
2735+
<p role="note" class="tip"><b>Tip:</b>
2736+
If you need to run the same code on multiple passages, consider using the <a href="#special-passage-passagedone"><code>PassageDone</code> special passage</a> or, for a JavaScript/TwineScript solution, a <a href="#events-navigation-event-passagedisplay"><code>:passagedisplay</code> event</a> instead. They serve the same basic purpose as the <code>&lt;&lt;done&gt;&gt;</code> macro, but are run each time passage navigation occurs.
2737+
</p>
2738+
2739+
#### History:
2740+
2741+
* `v2.35.0`: Introduced.
2742+
2743+
#### Arguments: *none*
2744+
2745+
#### Examples:
2746+
2747+
```
2748+
@@#spy;@@
2749+
2750+
<<done>>
2751+
<<replace "#spy">>I spy with my little eye, a crab rangoon.<</replace>>
2752+
<</done>>
2753+
```
2754+
2755+
<!-- *********************************************************************** -->
2756+
27312757
### `<<goto passageName>>`<br>`<<goto linkMarkup>>` {#macros-macro-goto}
27322758

27332759
Immediately forwards the player to the passage with the given name. May be called either with the passage name or with a link markup.
@@ -2736,6 +2762,10 @@ Immediately forwards the player to the passage with the given name. May be call
27362762
In most cases, you will not need to use <code>&lt;&lt;goto&gt;&gt;</code> as there are often better and easier ways to forward the player. For example, a common use of <a href="#macros-macro-link"><code>&lt;&lt;link&gt;&gt;</code></a> is to perform various actions before forwarding the player to another passage. In that case, unless you need to dynamically determine the destination passage within the <code>&lt;&lt;link&gt;&gt;</code> body, <code>&lt;&lt;goto&gt;&gt;</code> is unnecessary as <code>&lt;&lt;link&gt;&gt;</code> already includes the ability to forward the player.
27372763
</p>
27382764

2765+
<p role="note" class="warning"><b>Warning:</b>
2766+
Using <code>&lt;&lt;goto&gt;&gt;</code> to automatically forward players from one passage to another with no input from them will both create junk moments within the story history and make it extremely difficult for players to navigate the history. It is <strong><em>strongly</em></strong> recommended that you look into other methods to achieve your goals instead—e.g., <a href="#config-api-property-navigation-override"><code>Config.navigation.override</code></a>.
2767+
</p>
2768+
27392769
<p role="note" class="warning"><b>Warning:</b>
27402770
<code>&lt;&lt;goto&gt;&gt;</code> <strong><em>does not</em></strong> terminate passage rendering in the passage where it was encountered, so care must be taken to ensure that no unwanted state modifications occur after its call.
27412771
</p>

docs/core/twinescript.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ Any supported object type may itself contain any supported primitive or object t
8989
Neither ES5 property attributes—which includes getters/setters—nor symbol properties are directly supported in generic objects stored within story variables. If you need such features, then you'll need to use a non-generic object (a.k.a. a class).
9090
</p>
9191

92+
<div role="note" class="warning"><b>Warning:</b>
93+
<p>Functions, including non-instance methods, are not directly supported within story variables because of a few issues.</p>
94+
<ol>
95+
<li>A function's scope <strong><em>cannot</em></strong> be restored. Thus, if your function depends upon its scope, then it will not work properly when revived from sessions or saves.</li>
96+
<li>Function behavior is immutable. Thus, storing them within story variables is generally wasteful.</li>
97+
</ol>
98+
<p>Methods of class instances are not affected by either issue, as they're never actually stored within story variables, being on their classes' prototypes.</p>
99+
</div>
100+
92101
Unsupported object types, either native or custom, can be made compatible by implementing `.clone()` and `.toJSON()` methods for them—see the [*Non-generic object types (a.k.a. classes)* guide](#guide-tips-non-generic-object-types) for more information.
93102

94103

docs/guides/guide-state-sessions-and-saving.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Running that, you'll see `$x is 0` and `$y is 1`. Now, load the saved story fro
8686

8787
## Refreshing and Restarting {#guide-state-sessions-and-saving-refreshing-and-restarting}
8888

89-
Whenever your story is first started or, *for any reason*, restarted—e.g., the browser window/tab was refreshed/reloaded—it undergoes its startup sequence. Several things occur **each and every time startup happens**, regardless of whether or not a playthrough session will be restored, an autosave loaded, a regular save loaded, or the starting passage run. First, the CSS, JavaScript, and Widget sections are processed. Next, the `StoryInit` special passage is processed. Finally, one of three things happen (in order): the existing playthrough session is restored, if it exists, else the autosave is loaded, if it exists and is configured to do so, else the starting passage is run.
89+
Whenever your story is first started or, *for any reason*, restarted—e.g., the browser window/tab was refreshed/reloaded—it undergoes its startup sequence. Several things occur **each and every time startup happens**, regardless of whether or not a playthrough session will be restored, an autosave loaded, or the starting passage run. First, the CSS, JavaScript, and Widget sections are processed. Next, the `StoryInit` special passage is processed. Finally, one of three things happen (in order): the existing playthrough session is restored, if it exists, else the autosave is loaded, if it exists and is configured to do so, else the starting passage is run.
9090

9191
Some users have the false impression that `StoryInit` is not run when the story is restarted when the playthrough session is restored or autosave is loaded. Code like `<<set $y to 1>>` *seems* to have no effect because the startup state is replaced by the of the incoming state, **but they are still executed by the engine**. You can see this effect by changing data *outside* the state. For example, let's return to the example above and change it again:
9292

docs/guides/guide-test-mode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ To enable test mode from the story editor/map screen while starting at a specifi
5656
To enable test mode while starting at a specific passage, right-click on a passage and select the *Test Play From Here* context menu item.
5757

5858
<p role="note"><b>Note:</b>
59-
Unfortunately, due to limitations in the current release of Twine&nbsp;1, the <em>Build</em> menu's <em>Test Play</em> menu item is not able to trigger test mode. You may, however, simply use the <em>Test Play From Here</em> context menu item on the `Start` passage to achieve the same result.
59+
Unfortunately, due to limitations in the current release of Twine&nbsp;1, the <em>Build</em> menu's <em>Test Play</em> menu item is not able to trigger test mode. You may, however, simply use the <em>Test Play From Here</em> context menu item on the <code>Start</code> passage to achieve the same result.
6060
</p>
6161

6262
### Manually

docs/table-of-contents.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
* [`<<removeplaylist>>`](#macros-macro-removeplaylist)
9999
* [`<<waitforaudio>>`](#macros-macro-waitforaudio)
100100
* [Miscellaneous Macros](#macros-miscellaneous)
101+
* [`<<done>>`](#macros-macro-done)
101102
* [`<<goto>>`](#macros-macro-goto)
102103
* [`<<repeat>>`](#macros-macro-repeat)
103104
* [`<<stop>>`](#macros-macro-stop)

locale/README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ For the template that should be used as the basis of localizations, see the `l10
88

99
## Contributors
1010

11-
* 简体中文 (`chs.js`) – Liyro Pen.
12-
* Deutsch (`de.js`) – Phil Strahl.
13-
* Español (Castellano) (`es-ES.js`) – Gerardo Galán.
14-
* Español (*UNKNOWN*) (`es-UNKNOWN.js`) – Raúl Castellano.
15-
* Français (`fr.js`) – Marc Cornette, Pierre Kessler.
16-
* Polski (`pl.js`) – ciupac.
17-
* Português (Brazil) (`pt-BR.js`) – Janos Biro.
18-
* Português (Portugal) (`pt-PT.js`) – Magma.
19-
* Ру́сский (`ru.js`) – Konstantin Kitmanov.
20-
* Türkçe (`tr.js`) – Guena Varia.
11+
* `ar-EG.js` – العربية (مصر), by: Mustafa Rawi.
12+
* `chs.js` – 简体中文, by: Liyro Pen.
13+
* `de.js` – Deutsch, by: Phil Strahl, Grausicht.
14+
* `es-ES.js` – Español (Castellano), by: Gerardo Galán.
15+
* `es-UNKNOWN.js` – Español (*UNKNOWN*), by: Raúl Castellano.
16+
* `fr.js` – Français, by: Marc Cornette, Pierre Kessler.
17+
* `it-IT.js` – Italiano (Italy), by: Karime Chehbouni.
18+
* `pl.js` – Polski, by: ciupac.
19+
* `pt-BR.js` – Português (Brazil), by: Janos Biro.
20+
* `pt-PT.js` – Português (Portugal), by: Magma.
21+
* `ru.js` – Ру́сский, by: Konstantin Kitmanov.
22+
* `tr.js` – Türkçe, by: Guena Varia.

locale/ar-EG.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/***********************************************************************************************************************
2+
3+
ar-EG.js – العربية (مصر)
4+
Localization by: Mustafa Rawi
5+
6+
Copyright © 2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.
7+
Use of this source code is governed by a BSD 2-clause "Simplified" License, which may be found in the LICENSE file.
8+
9+
For more information about the guidelines used to create this localization, see:
10+
http://www.motoslave.net/sugarcube/2/docs/#guide-localization
11+
12+
***********************************************************************************************************************/
13+
14+
(function () {
15+
/* General. */
16+
l10nStrings.identity = 'لعبة';
17+
l10nStrings.aborting = 'جاري الإلغاء';
18+
l10nStrings.cancel = 'إلغاء';
19+
l10nStrings.close = 'إغلاق';
20+
l10nStrings.ok = 'موافق';
21+
22+
/* Errors. */
23+
l10nStrings.errorTitle = 'خطأ';
24+
l10nStrings.errorToggle = 'تبديل عرض واجهة الأخطاء';
25+
l10nStrings.errorNonexistentPassage = 'القطعة "{passage}" غير موجودة'; // NOTE: `passage` is supplied locally
26+
l10nStrings.errorSaveMissingData = 'خاصية الحفظ لم تجد بعض البيانات. إما أن الملف المحمل ليس ملفاً خاصة بالحفظ أو أن الملف متضرر';
27+
l10nStrings.errorSaveIdMismatch = 'ملف الحفظ من {identity} خاطئة';
28+
29+
/* Warnings. */
30+
l10nStrings._warningIntroLacking = 'متصفحك إما يفتقر إلى أو تم تعطيل ';
31+
l10nStrings._warningOutroDegraded = ', لذا فهذه {identity} تعمل في وضع محدود. يمكنك المتابعة إلا أن بعض أجزاءها قد لا تعمل بشكل صحيح.';
32+
l10nStrings.warningNoWebStorage = '{_warningIntroLacking} واجهة برمجة تطبيقات ويب للحفظ{_warningOutroDegraded}';
33+
l10nStrings.warningDegraded = '{_warningIntroLacking} بعض الخصائص المطلوبة في {identity}{_warningOutroDegraded}';
34+
35+
/* Debug bar. */
36+
l10nStrings.debugBarToggle = 'تبديل عرض شريط استكشاف الأخطاء';
37+
l10nStrings.debugBarNoWatches = '\u2014 لم يتم تحديد مراقبين \u2014';
38+
l10nStrings.debugBarAddWatch = 'إضافة مراقب';
39+
l10nStrings.debugBarDeleteWatch = 'حذف مراقب';
40+
l10nStrings.debugBarWatchAll = 'مراقبة الكل';
41+
l10nStrings.debugBarWatchNone = 'حذف الكل';
42+
l10nStrings.debugBarLabelAdd = 'إضافة';
43+
l10nStrings.debugBarLabelWatch = 'مراقبة';
44+
l10nStrings.debugBarLabelTurn = 'الدور'; // (noun) chance to act (in a game), moment, period
45+
l10nStrings.debugBarLabelViews = 'الواجهات';
46+
l10nStrings.debugBarViewsToggle = 'تبديل عرض واجهات استكشاف الأخطاء';
47+
l10nStrings.debugBarWatchToggle = 'تبديل عرض لوحة المراقبة';
48+
49+
/* UI bar. */
50+
l10nStrings.uiBarToggle = 'تبديل عرض شريط الواجهة';
51+
l10nStrings.uiBarBackward = 'تراجع عبر تاريخ {identity}';
52+
l10nStrings.uiBarForward = 'تقدم عبر تاريخ {identity}';
53+
l10nStrings.uiBarJumpto = 'قفز إلى نقطة معينة في تاريخ {identity}';
54+
55+
/* Jump To. */
56+
l10nStrings.jumptoTitle = 'قفز إلى';
57+
l10nStrings.jumptoTurn = 'دور'; // (noun) chance to act (in a game), moment, period
58+
l10nStrings.jumptoUnavailable = 'لا توجد نقاط قفز متاحة حالياً\u2026';
59+
60+
/* Saves. */
61+
l10nStrings.savesTitle = 'الحفظ';
62+
l10nStrings.savesDisallowed = 'تم تعطيل خاصية الحفظ في هذه القطعة.';
63+
l10nStrings.savesIncapable = '{_warningIntroLacking} يفتقر إلى إمكانيات مطلوبة لدعم عملية الحفظ، لذا تم تعطيلها في هذه الجلسة.';
64+
l10nStrings.savesLabelAuto = 'الحفظ التلقائي';
65+
l10nStrings.savesLabelDelete = 'حذف';
66+
l10nStrings.savesLabelExport = 'حفظ إلى جهازك\u2026';
67+
l10nStrings.savesLabelImport = 'تحميل من جهازك\u2026';
68+
l10nStrings.savesLabelLoad = 'تحميل';
69+
l10nStrings.savesLabelClear = 'حذف الكل';
70+
l10nStrings.savesLabelSave = 'حفظ';
71+
l10nStrings.savesLabelSlot = 'حاوية';
72+
l10nStrings.savesUnavailable = 'لم يمكن العثور على حاويات حفظ\u2026';
73+
l10nStrings.savesUnknownDate = 'غير معروف';
74+
75+
/* Settings. */
76+
l10nStrings.settingsTitle = 'الإعدادات';
77+
l10nStrings.settingsOff = 'معطل';
78+
l10nStrings.settingsOn = 'مفعل';
79+
l10nStrings.settingsReset = 'استرداد الافتراضيات';
80+
81+
/* Restart. */
82+
l10nStrings.restartTitle = 'إعادة تشغيل';
83+
l10nStrings.restartPrompt = 'هل ترغب حقاً في إعادة التشغيل من البداية؟ ستفقد أي تقدم حققته ولم تحفظه.';
84+
85+
/* Share. */
86+
l10nStrings.shareTitle = 'مشاركة';
87+
88+
/* Alert. */
89+
l10nStrings.alertTitle = 'تنبيه';
90+
91+
/* Autoload. */
92+
l10nStrings.autoloadTitle = 'تحميل تلقائي';
93+
l10nStrings.autoloadCancel = 'الذهاب للبداية';
94+
l10nStrings.autoloadOk = 'تحميل من الحفظ التلقائي';
95+
l10nStrings.autoloadPrompt = 'تم العثور على حفظ تلقائي. هل ترغب في تحميله أم تريد الذهاب للبداية؟';
96+
97+
/* Macros. */
98+
l10nStrings.macroBackText = 'تراجع'; // (verb) rewind, revert
99+
l10nStrings.macroReturnText = 'عودة'; // (verb) go/send back
100+
})();

locale/chs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
http://www.motoslave.net/sugarcube/2/docs/#guide-localization
1212
1313
***********************************************************************************************************************/
14+
1415
(function () {
1516
/* General. */
1617
l10nStrings.identity = '游戏';

locale/de.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
33
de.js – Deutsch
44
5-
Localization by: Phil Strahl <phil@pixelprophecy.com>.
5+
Localization by: Phil Strahl <phil@pixelprophecy.com>, Grausicht.
66
7-
Copyright © 2017–2018 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.
7+
Copyright © 2017–2021 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.
88
Use of this source code is governed by a BSD 2-clause "Simplified" License, which may be found in the LICENSE file.
99
1010
For more information about the guidelines used to create this localization, see:
1111
http://www.motoslave.net/sugarcube/2/docs/#guide-localization
1212
1313
***********************************************************************************************************************/
14+
1415
(function () {
1516
/* General. */
1617
l10nStrings.identity = 'spiel';
@@ -86,10 +87,10 @@
8687
l10nStrings.shareTitle = 'Teilen';
8788

8889
/* Autoload. */
89-
l10nStrings.autoloadTitle = 'Autmatisches Laden';
90+
l10nStrings.autoloadTitle = 'Automatisches Laden';
9091
l10nStrings.autoloadCancel = 'Gehe zum Start';
9192
l10nStrings.autoloadOk = 'Auto-Speicherstand laden';
92-
l10nStrings.autoloadPrompt = 'Ein Auto-Spiecherstand existiert bereits. Laden oder zurück an den Start?';
93+
l10nStrings.autoloadPrompt = 'Ein Auto-Speicherstand existiert bereits. Laden oder zurück an den Start?';
9394

9495
/* Macros. */
9596
l10nStrings.macroBackText = 'Zurück';

locale/es-ES.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
http://www.motoslave.net/sugarcube/2/docs/#guide-localization
1212
1313
***********************************************************************************************************************/
14+
1415
(function () {
1516
/* General. */
1617
l10nStrings.identity = 'juego';

locale/es-UNKNOWN.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
http://www.motoslave.net/sugarcube/2/docs/#guide-localization
1212
1313
***********************************************************************************************************************/
14+
1415
(function () {
1516
/* General. */
1617
l10nStrings.identity = 'juego';

locale/fr.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
http://www.motoslave.net/sugarcube/2/docs/#guide-localization
1212
1313
***********************************************************************************************************************/
14+
1415
(function () {
1516
/* General. */
1617
l10nStrings.identity = 'aventure';

0 commit comments

Comments
 (0)