Stencyl 3.4.0 is now out. Get it now!

Extra Utils Extension [1.3.1]

ETHproductions

  • *
  • Posts: 400
Extra Utilities Extension

This is a little extension I (originally) wrote in an hour, with a few blocks I've found myself wanting several times. If you have a block you'd like to have handy, tell me and I'll see if I can add it in. :)

I know that all of the blocks (unless marked otherwise) work on Flash and Windows, and they should work on everything else. (If you can test this extension on Mac, Linux or Mobile, please tell me how it works!)
Designed to work with Stencyl v3.1. Some blocks may not work with Stencyl v3.0 or below.

Features
- if ___ then ___ else ___
- ___ is an actor/a number/text...
- get/set scene value
- exit game (Desktop & Mobile)
- copy to clipboard (Flash)
- save/load game with custom name
- repeat (x: __ y: __ ) times
and a few more...

- Download (3.1)
- Download (3.2)
- Download for 3.3

(How to Install and Update an Extension)


Blocks



Works just like the if/otherwise wrappers, but returns a value instead of running code. For example:



Can be shortened to:



You can even use multiple if/then blocks inside of each other, which works the same way as using if/elseif/else blocks.




Another little shortcut block I wanted. (a = either b or c) is equivalent to (a = b or a = c).




Returns whether the input is of the selected type.

Note: There are some limitations with this block.
Animations and controls are both stored internally as strings (i.e. text), so "abc" will return true with both.
Also, colors are stored as integers, so 0 counts as a valid color (black).
Shaders are not included at all because anything will return true as a shader.
The map option will always return false, due to an unresolved bug.





This block turns any number into an integer (whole number) using Std.int.




These two blocks are fairly self-explanatory. 'blank text' gives completely blank text (equivalent to ""). 'null' gives null, which means 'empty' in haXe.




NOTE: These blocks are hidden in the 3.2+ versions. I was planning another extension which would incorporate them, but this has been put on hold for now.

Gets and sets the update speed, in milliseconds, that the game engine is running at. For coders, this is equivalent to Engine.STEP_SIZE. The default number is 10 (100 fps). Set to a lower value to simulate fast-forward, such as in the Tower Defense games, and a higher value to slow the game down. Does not work with values less than 1.




These blocks work just like the actor value blocks, but stores the values in the scene. This allows you to access values, no matter how many actors you have. (Secret: this actually stores the values as actor values, but on the permanent actor representing the camera.)




Exits (closes) the game on Desktop and Mobile. Doesn't work on Flash.




Sets the system clipboard, accessed with Ctrl+V. Unfortunately, only works on Flash.

 


Saves/loads the game's save file with a custom name (the default is 'mySave'). Useful for having multiple save files, or default Game Attribute settings.




Works just like the built-in loop block, but works over a 'grid'. This allows you to easily create grid-based structures, or loop over sections of the scene with the Tile API.

Version History
Code: [Select]
1.3.1 (02/15/15)
Several blocks now have icons on them, to match the built-in blocks.
Fixed a few unsupported features in the 3.1 version.

1.3 (02/14/15)
Added a 3.3 version, and mostly fixed in the 'anything is' block.
Added blocks:
- get/set scene value
- exit game (Desktop & Mobile)
- copy to clipboard (Flash)
- repeat (x: __ y: __ ) times

1.2 (12/12/14)
Updated to 3.2.
- if/then/else block changed to yellow
- save/load succeeded block combined into save/load wrapper

1.1 (11/04/14)
Added blocks:
- ___ is an actor/a number/text...
- __ as int

1.0 - Initial release (10/02/14)
Blocks:
- if ___ then ___ else ___
- ___ = either  ___ or ___
- blank text/null
- get/set update speed (step size)
- save/load game with custom name

If you have any questions, problems, or suggestions, feel free to post them! :)
ETH

« Last Edit: September 15, 2015, 07:17:25 am by ETHproductions »
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

PhaserRave

  • *
  • Posts: 81
These look great, thanks! I'll have to try them out soon. I'm especially interested in the last two.
"I refuse to answer that question on the grounds that I don't know the answer." -Zaphod Beeblebrox

Photon

  • Posts: 2698
Quote
Another little shortcut block I wanted. (a = b or c) is equivalent to (a = b or a = c).

Just want to point out that the syntax of your block doesn't necessarily line up with typical Boolean algebra. "a = b or c" would normally be translated as "(a == b) or c" where "a = b" and "c" are the two condition of the or-statement. See the difference?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

ETHproductions

  • *
  • Posts: 400
Thanks, guys! I've changed the syntax for that block to 'if ___ = either ___ or ___'. Does that make more sense?
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

yoplalala

  • *
  • Posts: 1338
Quote
NOTE: These blocks are hidden in the 3.2+ versions. I have another extension coming out soon that will replace them.

I was wondering .. By what will you replace them ? Is another trick than the camera actor value ?

ETHproductions

  • *
  • Posts: 400
@yoplalala: Sorry, I was talking about the "update speed" blocks, not the "scene value" blocks. I had another extension in progress that was supposed to be able to rotate and zoom the camera, as well as set the update speed. However, as it turned out, these other two features will not be fully possible without some modifications to the engine. (I am aware of letmethink's amazing zoom/rotation example, but I'd like to have more control over the camera.) I will try to make these modifications in the next couple of weeks.
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

yoplalala

  • *
  • Posts: 1338
Sorry I'm the one who totally misread ...

But good luck for you new extension. It looks great but sounds difficult !

letmethink

  • *
  • Posts: 2515
I have started making engine modifications to get zooming out to work, so I could point you in the right direction of what you need to edit for zooming out to work engine side.
~Letmethink

Donni11

  • *
  • Posts: 2084
I'm aware this topic is old,

@ETHproductions, is there anyway to have this ability of the block for desktop ?


ETHproductions

  • *
  • Posts: 400
@Donni11: I'm sorry, which block do you mean?
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.


ETHproductions

  • *
  • Posts: 400
I don't think that's possible on desktop or mobile targets, at least not without a native extension. It may be possible with HTML5, using the clipboard.js library. I'll look into adding that to the extension when I get a chance.
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.