Stencyl 3.4.0 is now out. Get it now!

Bug Issue: HTML5: returning null from custom blocks does Bad Things


Pages: 1

SirAthos

  • Junior Stencyler
March 11, 2017, 12:45:37 am
Version: Stencyl build 9300 from 2017-02-14

How to repro: create a custom block that returns an Actor (e.g. "Find Actor In Group"), and return null from it. Assign the return of that custom block to an Actor type attribute.

What happens: in some cases, the calling function will silently abort. In others (probably where a catch() is used), it will complain that it basically cannot cast null to Actor (other types are likely affected too, I haven't tried).

Workaround: Instead of assigning the custom block return value to an Actor type attribute and checking if it has value, I created another custom block ("Actor Exists In Group") which duplicates the functionality of the first block, but returns true (some Actor was found) or false (no Actor found, the first block will return null if called). Then, only call the first custom block if the second one returns true.

(This only breaks in HTML5, other platforms have no problem with assigning null to an attribute)
« Last Edit: March 11, 2017, 12:48:41 am by SirAthos »


yoplalala

  • Subscriber - Stencyl Studio
  • *
September 12, 2017, 01:36:41 am
Up ! The funny thing is you can set an actor to null. Is there another workaround ?


SirAthos

  • Junior Stencyler
September 12, 2017, 05:58:50 am
You could also combine the two functions into one which returns true/false and sets some global attribute to the actual value when found... but using globals like that is dirty programming.  :)


yoplalala

  • Subscriber - Stencyl Studio
  • *
September 15, 2017, 07:32:21 am
In fact, yhere is an easier way . Your block must return "anything". If it's the case, it will work.


Pages: 1

Details

  • Reported
    March 11, 2017, 12:45:37 am
  • Updated
    September 15, 2017, 07:32:21 am

  • View Status
    Public
  • Type
    Bug
  • Status
    New
  • Priority
    Normal
  • Version
    Stencyl 3.4
  • Fixed in
    (none)
  • Assigned to
    (none)
  • Category
    Engine

Tags