Extension Not Updating

Hadrian

  • Posts: 4
Hello, I am trying to modify captaincomic's excellent HUD Console extension.
(Link: https://community.stencyl.com/index.php/topic,35554.0.html)

Anytime I make a change to the .hx file in my stencyl workspace/engine-extensions folder nothing changes. Same if I zip and re-import the extension. It will update the block pallet if I change the blocks.xml file. I can tell because I modified the startup printing to say "foo" in the middle of the text yet the output stays the same.

When I use one of the blocks that I added it says "Class has no field log" (log is the name of the function I am trying to call)

I have attached the .hx and .XML files that I have modified in case they might be of help. I also attached the erroring code. The custom block is at the bottom of the image.

This is my first time dabbling in stencyl engine extensions, so if this is a super dumb question I apologize.
Thanks in advance, Hadrian.

Justin

  • *
  • Posts: 4663
What you're doing is correct, but you've actually stumbled on a particularly tricky engine extension to modify. That engine extension is a little bit odd. The extension's blocks.xml file does not actually match the extension's Console.hx class.

First, at the top of the Console.hx file, you have the package of the class. This should match the folder structure.

Code: [Select]
package com.fermmmtools.debug;

With that package, you would expect the file to be found here:

Code: [Select]
hud-console/
    com/
        fermmmtools/
            debug/
                Console.hx

However, the class is instead found in the root folder of the engine extension.

Code: [Select]
hud-console/
    Console.hx

Ok, so that's odd.. but what's stranger is this: the blocks in blocks.xml use a Console class in a completely different package.

Code: [Select]
<block
tag="create-console"
spec="create console"
code="com.nmefermmmtools.debug.Console.create();"
type="action"
returns="void"
color="gray"/>

Note that the package here is not "com.fermmmtools.debug", but instead "com.nmefermmmtools.debug".


com.nmefermmmtools.debug actually matches a haxelib that's built-in to Stencyl, and has been included since the earliest Stencyl 3.0 previews. Before Stencyl 4.1, You can find it at Stencyl/plaf/haxe/lib/debug-console/1,00. captaincomic's hud-console extension is actually using this class that's included in Stencyl by default, and not the class included in the engine extension's own sources.

I can only guess about what happened, but I think that captaincomic wanted to expose a number of extra blocks using functionality from that class that Stencyl didn't use. So he copied a slightly different version of the class into his extension, created the blocks he wanted to be available (using the built-in class by mistake), and then tested it, and everything worked fine. There are some slight differences between the two classes, but nothing particularly noticeable, so the fact that the class contained in the engine extension's sources wasn't being used was easy to miss.



Ok, so you want to make changes to the Console.hx class on your side? Here's what you need to do:

1. Fix the blocks.xml files to point to com.fermmmtools.debug.Console, and move the Console.hx file to hud-console/com/fermmmtools/debug/Console.hx.
2. The Console file actually doesn't compile as-is, so you can just replace it with the file found at Stencyl/plaf/haxe/lib/debug-console/1,00/com/nmefermmmtools/debug/Console.hx. Or you can fix the compilation errors. If you replace the whole class, remember to change the package name to com.fermmmtools.debug, and reapply any changes you might have made to the class.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Hadrian

  • Posts: 4
THANK YOU SO MUCH!
I had been stuck on this for a while, and It makes a lot more sense now. THANK YOU!

Thanks Justin for answering all my questions.