Experimenting with the Block Enhancement Tool Set extension by Justin


  • Posts: 1618
Justin made a toolset extension with which you can enhance your Engine Extensions.

Today, I experimented with it.

Source: https://github.com/polydes/enhanced-block-defs

Actions in Stencyl:
* Extensions : Extension Repositories : Add repository
*  New Repository: http://www.polydes.com/repo
* Extensions : Toolset Extension Manager : Enable the Enhanced Block Definitions

This extension is not visible in the Dashboard under Extensions.

When enabled you can use extra functionality in your Engine Extensions.

As a demonstration I created an engine Extension:
* mkdir  %AppData%\Stencyl\stencylworks\engine-extensions\EnhancedBlocksTest
Using notepad (++) create these:

Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

spec="%1 listener %2 for enhanced event %0"
code='EnhancedBlocksTest.#1EventListener(#0, EnhancedBlocksTest._customEvent_#2);'
<dropdown order="0">
<c text="Test" code="MyType.Test1"/>
<dropdown order="1">
<c text="add" code="add"/>
<c text="remove" code="remove"/>
<text order="2"/>


The magic is in : EnhancedBlocksTest.#1EventListener(#0, EnhancedBlocksTest._customEvent_#2);'
Where the #0 through #2 are replaced by the toolset extension.

Note the tag: "EventAddremoveListener"
You have to have the same tag in the blocks-enhancements.xml file. That xml file is used by the toolset extension.
the blocks-enhancements.xml file has a relation with the blocks.xml !!

Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>



<code order="2"/>


Code: [Select]
class EnhancedBlocksTest {

public static function addEventListener(type:MyType, fn:Void->Void):Void{
trace("ADD Listener: The Type is :"+type);
trace("ADD Listener: The function is : "+fn);
if(fn != null) fn();
public static function removeEventListener(type:MyType, fn:Void->Void):Void{
trace("REMOVE Listener: The Type is :"+type);
trace("REMOVE Listener: The function is : "+fn);
public static function _customEvent_hello(){
trace("CustomEvent HELLO Called");

Code: [Select]
abstract MyType(String)
var Test1 = "TEST1";


Code: [Select]
<?xml version="1.0" encoding="utf-8"?>


Code: [Select]

Put an icon in the folder: %AppData%\Stencyl\stencylworks\engine-extensions\EnhancedBlocksTest\icon.png

Restart Stencyl

through settings enable the EnhancedBlocksTest extension and you can now use the new block:

* [add/remove]  listener [hello] for enhanced event [Test]

Which will produce the following haxe code : EnhancedBlocksTest.addEventListener(MyType.Test1, EnhancedBlocksTest._customEvent_hello);

Running this it will output the trace information in your log viewer or browser console.

I used static class but this is not a requirement!

Personally I have to figure out how and when I will use this in my own engine extensions but it is a cool addition !!!

Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.