External Data Extension
Recently I've been working on an extension that's able to get files from the 'extras' folder, such as described in this topic
. It's gone quite well; I even managed to add in a saving feature.Features:
- Get text from a file
- Modify that text
- Get a sound from a file
- Play an .swf file (on Flash)
- Save text files and .png images (on Desktop or Mobile)
All except the saving blocks work correctly on Flash; should be the same with HTML5. All except the SWF blocks work on Windows and Android, and it should be the same on everything else. (If you can test it on Mac, Linux, or iOS, please tell me how it works!)
Designed to work with Stencyl v3.3. Some blocks (especially the "save image" block) may not work with Stencyl v3.0.
- Download (3.1)
- Download (3.2)
- Download for 3.3
(includes beta HTML5 support)
- (How to Install and Update an Extension
1. Download, install and enable the correct extension (links above).
2. Inside your game, press Debug > View > View Folder for this Game
, then open up the highlighted folder.
3. Create a new folder and name it extras
4. Place any necessary files inside this folder.
5. Use the blocks to get data from the files.Using File Paths
For the text
block, you must
use the correct file extension (e.g. .txt
). For the sound
block, you must not
use a file extension. For the swf
and save image
blocks, it doesn't matter. Also, any subfolders in the path (after extras
) must be included. Examples:.../extras/test.txt
should be put into the text
block as test.txt.../extras/subfolder/test.txt
should be put into into the text
block as subfolder/test.txt.../extras/preloader.swf
can be put into into either swf
block as preloader.swf
, or just preloader.../extras/image.png
can be put into into the save image
block as image.png
, or just image.../extras/jump1.mp3
should both be put into the sound
block as jump1
Returns the text from the inputted file. If it has multiple lines in it, it may need to be processed with the following block.
Splits the text into a list by putting each line of the file into a new item.
The inputted text will have line breaks added wherever there is a \r
in the text. For example, Hello\rWorld!
will result in:Hello
Replaces each of the line breaks in the text with \r
. Useful for debugging purposes.
Removes any line breaks from the text.
Adds a new line of text to the text attribute.
Adds a line of text to the end of the file. Useful for generating logs. Doesn't work on Flash or HTML5.
Returns the text with preserved Unicode characters. This is a workaround of Stencyl's automatic Unicode-to-code-point conversion, which results in glyphs outside the ASCII range
encoding safely, but incorrectly.
Returns the line break character.
Draws a list onto the screen, item by item. The top left of the box it draws in is at the inputted x and y.
Prints a list out to the console, item by item.
Gets a sound from a .mp3 or .ogg file, depending on the platform. This block can be used just like any other sound block.
Plays an .swf file. Only works on Flash.
If you notice that it isn't playing in the correct position, or for the correct length of time, try using the other block.
NOTE: The first of these two blocks has been tested to the fullest of my ability, but I cannot confirm that it works perfectly. If you can use it with a newer SWF, please tell me how it works!
Saves a text file to the extras folder. Doesn't work on Flash or HTML5.
Saves an image as a .png to the extras folder. Doesn't work on Flash or HTML5.
Added beta HTML5 support
- append line ___ to file: ___
- unicode text: ___
Bug fix: Missing subfolders are not taken into account when saving
Images that were saved after compilation can now be accessed
Added block: image from file (already existed in the palette, but had to be recoded to use a custom function)
Actually fixed the bug with saving and loading data on mobile
- Added in one missing slash
(Hopefully!) Fixed a bug with saving and loading data on mobile
Should now save data on mobile targets (NEEDS TESTING!)
Changed "text without line breaks" to "replace line break with \r in text"
Changed "text with added line breaks" to "replace \r with line break in text"
Added block: remove line breaks from text
Bug fix: Trying to retrieve non-existing file on Flash causes a null error
- add line: _____ to ___
- save data ___ to file: ___
- save PNG ___ to file: ___
- text with added line breaks
- text without line breaks
- print list
- line break
1.0 - Initial public release (02/04/15)
- get text from file
- split text into lines
- draw list
- get sound from file
- play SWF/AVM1
If you have any questions, comments, or suggestions, feel free to post them below!