Skip to content

Commit

Permalink
v2.5.2
Browse files Browse the repository at this point in the history
closes #36
closes #35
  • Loading branch information
ChapelR committed Mar 31, 2020
1 parent c4b8002 commit f9fd4d2
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 253 deletions.
10 changes: 5 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Chapel's Custom Macro Collection (v2.5.1)
## Chapel's Custom Macro Collection (v2.5.2)

- [Try the demo!](https://macros.twinelab.net/demo)
- [Downloads](./download ':ignore')
Expand All @@ -16,12 +16,12 @@
- [The Fading Macro Set](./fading-macros.md)
- [The CSS Macro](./css-macro.md)
- [The Notify Macro](./notify-macro.md)
- [The Fullscreen Macros](./fullscreen-macros.md)
- ~~The Fullscreen Macros~~ **(removed)**
- [The Meter Macro Set](./meter-macros.md)
- [The Speech Box System](./speech-box-system.md)
- **User Interaction and Events**
- [The Event Macros](./event-macros.md)
- [The Continue Macro Set](./continue-macro.md) **(updated!)**
- [The Continue Macro Set](./continue-macro.md)
- [The Swap Macro Set](./swap-macro-set.md)
- [The Mouseover Macro](./mouseover-macro.md)
- [The Message Macro](./message-macro.md)
Expand All @@ -31,7 +31,7 @@
- [The Articles (A/An) Macros](./articles.md)
- **Utilities and Other**
- [The Done Macro](./done-macro.md)
- [The File System Macro Set](./file-system-macros.md)
- [The File System Macro Set](./file-system-macros.md) **(updated!)**
- [The First Macro](./first-macro.md)
- [Dice Roller and Fairmath Functions](./operations-api.md)

Expand All @@ -44,7 +44,7 @@ If you opt to get the files from GitHub, It is highly recommended that you insta
> [!WARNING]
> To install these macros, you will need to be using the most recent version of SugarCube 2 in most cases, and this is almost never the version that comes with Twine 2. See [SugarCube's website](http://www.motoslave.net/sugarcube/2/#downloads) for updating / installation instructions.
- For **Twine 2** users: copy and paste the JavaScript code into your [story JavaScript area](https://twinery.org/wiki/twine2:adding_custom_javascript_and_css). Some macros may also require CSS code, which goes in your story stylehseet.
- For **Twine 2** users: copy and paste the JavaScript code into your [story JavaScript area](https://twinery.org/wiki/twine2:adding_custom_javascript_and_css). Some macros may also require CSS code, which goes in your story stylesheet.

- For **Twine 1**, you'll need to copy and paste the JavaSCript portions into a script-tagged passage, and the CSS portions (if any) into a stylesheet-tagged passage. You can create new passages and add the tags yourself, or right-click on a blank spot in the editor and select new script here and new stylesheet here to generate each passage.

Expand Down
14 changes: 14 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@
> [!NOTE]
> I'm going to start keeping a changelog for these macros because keeping track of them is becoming a nightmare. The overall version numbers are not really helpful for tracking what's happening on a macro-by-macro basis, but I'm trying to stick to major version bumps meaning breaking changes in any macro, or complete refactors of the whole collection, like what v2.0.0 was. Minor version updates indicate new macros have been added. Patch version updates means individual macro updates and bug fixes, or documentation, website, or demo updates.
### March 31, 2020 (v2.5.2)

- **[Retired]** Removed the fullscreen macros.
- As of v2.31.0, SugarCube 2 now has a [built-in `Fullscreen` API](http://www.motoslave.net/sugarcube/2/docs/#fullscreen-api).
- **[Update]** Added a synthetic event to the `<<import>>` macro, `:import-macro`, that fires when the data is finished loading, or when said loading fails.
- **[Docs]** Updated docs.
- Removed the fullscreen macro docs and marked it as removed in the contents.
- Added the `:import-macro` synthetic event to the file system macro docs.
- **[Demo]** Updated demo.
- Removed fullscreen macro demo.
- Updated to SugarCube v2.31.0.
- Updated bundled macros.
- **[Meta]** Removed fullscreen macros from download utility.

### March 29, 2020 (v2.5.1)

- **[Update]** Fixed the `<<cont>>` macro so that expired event handlers are properly removed.
Expand Down
111 changes: 51 additions & 60 deletions docs/demo/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/download/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'The Fading Macro Set' : 'fading-macro-set',
'The First Macro' : 'first-macro',
'File System Macros' : 'fs',
'Fullscreen Macros' : 'fullscreen',
// 'Fullscreen Macros' : 'fullscreen',
'The Message Macro' : 'message-macro',
'The Meters Macro Set' : 'meters',
'The Mouseover Macro' : 'mouseover',
Expand Down
14 changes: 13 additions & 1 deletion docs/file-system-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ The `<<export>>` macro is a way to save a little bit of data on your user's hard

The `<<import>>` macro can be used to import some data you've previously saved to the user's hard disk. This macro will create a button that, when clicked, will prompt the user to select a file. That file will be read and the data stored in the indicated variable. You can also import SugarCube 2 saved data and access it without loading it, such as to create an episodic game, or let users import characters or choices into sequels. To import SugarCube 2 saves, use the `base64` data type option, and take a look at [the Save API](http://www.motoslave.net/sugarcube/2/docs/api-save.html) to get a handle on the data structure.

> [!NOTE]
> If the data is not able to be successfully loaded or any errors are encountered, the data sent to the variable will be `null`.
**Arguments**:

* **variableName**: The name of a variable, passed in quotes. The data pulled from the file will be saved to this variable.
Expand All @@ -52,4 +55,13 @@ The `<<import>>` macro can be used to import some data you've previously saved t
<<import '$player' 'json' 'Import Player Info'>>
<<import '$oldGame' 'base64' 'Import Saved Data'>>
```
```

### Events

The `:import-macro` synthetic event is fired after the data is loaded, whether the load was successful or not. This event object has the following properties:

- `success` ( *boolean* ) Whether the data was successfully loaded without errors; `true` if the load completed successfully, `false` if any errors were encountered.
- `data` ( *any* ) The loaded data, converted from Base64 or JSON as appropriate.
- `raw` ( *string* ) The raw file data.
- `storyVar` ( *string* ) The string name of the variable, including sigil, that the data was stored in.
67 changes: 0 additions & 67 deletions docs/fullscreen-macros.md

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-macros-for-sugarcube-2",
"version": "2.5.0",
"version": "2.5.2",
"description": "Collection of custom macros and systems for Twine/SugarCube2.",
"main": "build.js",
"directories": {
Expand Down
23 changes: 21 additions & 2 deletions scripts/fs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// fs.js v1.0.0; for SugarCube 2, by chapel
// fs.js v1.1.0; for SugarCube 2, by chapel

(function () {

Expand Down Expand Up @@ -128,9 +128,28 @@
var data = readData(dataType, target.result);

saveToState(data, storyVar);


$(document).trigger({
type : ':import-macro',
success : true,
data : clone(data),
raw : target.result,
storyVar : storyVar
});

} catch (err) {
return bail(err);

saveToState(null, storyVar);

$(document).trigger({
type : ':import-macro',
success : false,
data : null,
raw : null,
storyVar : storyVar
});

}
});

Expand Down
112 changes: 0 additions & 112 deletions scripts/fullscreen.js

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/minified/fs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions scripts/minified/fullscreen.min.js

This file was deleted.

0 comments on commit f9fd4d2

Please sign in to comment.