Debugging Tool [v1.0]

MrD69

  • Posts: 235
Debugging Extension
An extension for the Stencylworks game engine that adds better functionality for debugging

My number one complaint with Stencyl is the lack of features to allow for in game testing, so I made this extension to an in game console to your project!

Download Here: https://github.com/ess4654/Stencyl-Debugging-Extension



Enable Debugging


(MUST BE CALLED FIRST) This block will enable/disable the debugging functionality. Debugging console can be turned on and off with the use of the key set with Debug Console Key. This block will prevent the key from opening the console.

Is Debugging


This will return whether or not the debugging console is open.

Set Console Key


This block will set the key that opens the console and toggles in game debug mode.

Set Console Text


Change the text that the console will use.

Print Console to Screen


This block must be called in Drawing function to show console contents on the screen. Note: Check Key State block does npt need to be used when this block is added to code. To use debug features without the console use the Check Key State block instead.

Console Log


Print anything in console.

Clear Console


Clears the console of any logged items.

Show Frames Per Second


Toggles the Frames Per Second output in console. Default is true.

Show Number of Actors


This block can show both the number of actors currently on screen and the number of actors in the scene in the console window.

Check Key State


This block will check the state of the debugging keys without opening the console window. If Print Console to Screen Block is used in Drawing function, this block does not need to be used to get keyboard updates.

Set Debug Key


Debugging allows for up to 10 hotkeys assigned. The state of each key can be checked using the state block and will always return false if the debugging console is closed. Note: If you require the use of more then 10 keys for debugging purposes, please message me and I can add additional keys to the extension.

Get Debug Key State


This will return the state of one of the 10 hotkeys. Useful for doing stuff in game to test while debugging console is open.

A few examples of a good use for this block are:
• A button to unlock all powerups in a level

• A key to make player invincible to enemies

• Increase/Decrease time in a game with a countdown clock

• Fly through level with 8 way movement

Formatted Coordinate


Returns a nicley formatted X, Y Coordinate with a text field for naming.

Formatted Vector


Returns a nicley formatted X, Y, Z Vector with a text field for naming.

Key Value


Returns a nicley formatted Key Value pair.

Logic Condenser


Useful shortcut for setting values that is faster then an if else statement. If the boolean value is true, the first value is returned otherwise the last value will be returned.

Print List


Print each item of a list to the console with index value.

Print 2D Array


Given a valid 2D list, the contents will be printed to the console.

Last Updated April 1, 2020 v1.0
-------------------------------------------------------------------------------------------------------------------------
Additional Notes: Debug Drawing will always be on if the console is open. The use of in game block can disable it.

Contact Me: thejoblesscoder@gmail.com

Extension is Open Sourced and Licensed under MIT open source standards.

« Last Edit: April 01, 2020, 03:21:59 pm by MrD69 »
Games: Arrow Mania, Breakout/Outbreak, Water Drop

MrD69

  • Posts: 235
Let me know if you have any suggestions for addition blocks to add :D
Games: Arrow Mania, Breakout/Outbreak, Water Drop

rob1221

  • *
  • Posts: 9473
The attached extension needs a separate containing folder to work correctly when imported from Stencyl.  Also when I test on HTML5 I get a FPS reading of 0 (OpenFL bug maybe?)

MrD69

  • Posts: 235
I added the folder to a sub folder and re uploaded so it should import correctly into stencyl. I also fixed the bug with the FPS display it now displays in HTML5
Games: Arrow Mania, Breakout/Outbreak, Water Drop

yoplalala

  • *
  • Posts: 1632
Just explored your your github code by curiousity

For the logic condenser  instead of using some code you can use a block

Code: [Select]
<block tag="if-then-else"
spec="if %0 then %1 else %2"
code="(if (~) ~ else ~)"
help="Returns one of the two inputs, depending on the boolean."
type="normal"
color="yellow"
returns="anything">
<fields>
<boolean order="0"/>
<anything order="1"/>
<anything order="2"/>
</fields>
</block>

"?    :"     also work in haxe . so     code="( ~ ? ~ : ~)"   should also work

MrD69

  • Posts: 235
Hey thanks for the suggestion. I also decided to migrate the turnary block over to a separate extension for extended logic condensers.
https://github.com/ess4654/Stencyl-Better-Logic
Games: Arrow Mania, Breakout/Outbreak, Water Drop