"As number" block used in "Global Custom Block" results in error

LingDong

  • Posts: 4
Hi.
It appears that the "as number" block cannot be used in a global custom block. Why is that so?
Whenever I try to put the "as number" block in the definition of a global block, The game cannot be run until the whole event is deleted and Stencyl gives the following error:

Events for 'Player':  Unknown identifier : asNumber
   from scripts.ActorEvents_164
   line: 83
   columns: 19-27

To make sure that the "as number" block is indeed the source of the error, I reduced everything in the global block to:

print 2 as number

And the error remains. Any ideas why?
Thanks in advance.

yoplalala

  • *
  • Posts: 1632
You should also put your post in the bug thread, I think.

SadiQ

  • Posts: 1795
You should also put your post in the bug thread, I think.

After that you can use the Custom blocks instead of a Global custom block to allow you to advance with the code.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

LingDong

  • Posts: 4
You should also put your post in the bug thread, I think.

After that you can use the Custom blocks instead of a Global custom block to allow you to advance with the code.

Thanks for your responses! It seems that I have to use custom blocks instead of global custom block. It would really be a pain, since multiple actors use the same global block.

Really hope stencyl get it fixed soon.

LingDong

  • Posts: 4
Hi.
It appears that the "as number" block cannot be used in a global custom block. Why is that so?
Whenever I try to put the "as number" block in the definition of a global block, The game cannot be run until the whole event is deleted and Stencyl gives the following error:

Events for 'Player':  Unknown identifier : asNumber
   from scripts.ActorEvents_164
   line: 83
   columns: 19-27

To make sure that the "as number" block is indeed the source of the error, I reduced everything in the global block to:

print 2 as number

And the error remains. Any ideas why?
Thanks in advance.

yoplalala

  • *
  • Posts: 1632
Just saw that

http://community.stencyl.com/index.php?topic=32361.0

Global custom blocks are static functions that can't use any of the non-static functions (including most Stencyl blocks) in Script.hx.  That means global custom blocks are mostly useful for math calculations. 

maybe it has something to do with your problem

Justin

  • *
  • Posts: 4644
I'll see if I can refactor Script.hx and make more of it static.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

captaincomic

  • *
  • Posts: 6108
(I merged the question and the bug report thread.)

Justin

  • *
  • Posts: 4644
Refactoring complete. Starting in 3.3, almost all blocks will be usable from global custom blocks.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)