Extensions and images

vvitek

  • Posts: 118
My question is: can we use image and imageInstance type in extension (in blocks.xml)?

As far as I know we can use following types when creating extension:
[void, actor, actortype, boolean, camera, color, control, font, group, number, list, anything, region, scene, sound, text, dropdown]

It'll be great to send an image and imageInstance parameters to underlying extension code to make some image manipulation, e.g. dropshadow etc.
Should I use "anything" type and cast it in the code to BitMap or BitmapData or is there a better solution? Or maybe is it planned to extend allowed data types (I mean not only images, but sounds as well)?

rob1221

  • *
  • Posts: 9424
"image" works.  I'm not sure what the type for image instances is called, but that probably works too.

Justin

  • *
  • Posts: 4310
A few types seems to be missing from that list. I suspect there may be a few that are outdated or of no use, but here are those types:

animation, filter, shader, game-attribute, blend, map, joint, image, image-instance, transition, code-block

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

vvitek

  • Posts: 118
Thank you very much, it helped me a lot.

captaincomic

  • *
  • Posts: 6109
code-block
Oh, I didn't know that we had this option. :)

Justin

  • *
  • Posts: 4310
I think that code-block actually has something to do with those fields that are found inside wrapper blocks (like the index block inside looping wrappers). Not 100% sure there. Of course anybody is free to experiment and see what happens. :)

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)

captaincomic

  • *
  • Posts: 6109
Ah, okay I though it would be a text field that doesn't wrap the input in quotes. I'll experiment with it...
Edit: I think you're right, this is for nested blocks, not for "code fields". But it doesn't work in extension blocks - it's only used in for core blocks, afaict.

« Last Edit: October 02, 2014, 03:15:20 am by captaincomic »

ETHproductions

  • *
  • Posts: 430
CODE_BLOCK works in wrappers. Rob has explained this before. (It's always good to search the forums. ;) )

Here's some sample code, creating an 'if' block:
Code: [Select]
<block tag="if" spec="if %0" code="if (~) {~}" type="wrapper" returns="void">
<fields>
<boolean order="0"></boolean>
<CODE_BLOCK order="1"></CODE_BLOCK>
</fields>
</block>
Fontstruct - Stencyl - Website (in progress)

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

captaincomic

  • *
  • Posts: 6109

ETHproductions

  • *
  • Posts: 430
Here's a list of all the valid types that I know of, sorted by how well they work:

Normal:
anything, actor, actortype, group, animation, boolean, color,
control, filter (effect), font, image, IMAGE_INSTANCE,
joint, list, map, number, region, scene, shader, sound, text

Partial:
 - blend, camera, transition - currently useless (experts can use these as a plain code input)
 - GAME_ATTRIBUTE - works okay, but is underdeveloped

Special:
 - code-block - only works as an input for wrapper blocks
 - dropdown - only works as an input
 - void - only works as the return type for action- and wrapper-type blocks
 - attached-block - only works in 3.2+ as an "input" (pretty complex, I'll write instructions soon)

If you know of any types I'm missing, please post so I can add them to the list. :)

« Last Edit: February 21, 2015, 07:04:28 pm 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.