"as list" custom block

Luyren

  • *
  • Posts: 1516
Attached is what I tried by seeing the preview code from the <as boolean> block as an example. I need a custom block that returns any value as a list, but since I don't know AS3 (or any programming language for that matter), I don't know what I'm doing wrong. Can anyone help?
Working.

Greg

  • *
  • Posts: 1260
Attached is what I tried by seeing the preview code from the <as boolean> block as an example. I need a custom block that returns any value as a list, but since I don't know AS3 (or any programming language for that matter), I don't know what I'm doing wrong. Can anyone help?

You can try using just "Array", removing the "as" part.  Not sure off hand that this will work though.  Can you explain what this will be used for, and what issue you're trying to resolve with this?  I just ask because there may be alternative ways.

Luyren

  • *
  • Posts: 1516
In my Save Status behavior, the user can add to a list the name of the attributes and the behavior these attributes are from, and save them to a list game attribute. The user also have to specify the type of attribute: number, boolean, text or list.

From what I tested, it is saving correctly for all types, but it isn't loading the lists. Since I'm using the block [for self set ( ) for behavior ( )], I figured I should probably set the attribute as array, the same way I'm doing for loading booleans.

EDIT: Crap. Using only array made the custom block work, but didn't solve my problem. D:

« Last Edit: April 15, 2011, 07:11:19 am by Luyren »
Working.

Alexin

  • *
  • Posts: 3132
Code: [Select]
return SOME_OBJECT as Array;
Replace SOME_OBJECT by the internal of some attribute. Beware this code can throw an error if the attribute can't be converted to Array.
"Find the fun"
alexin@stencyl.com

Luyren

  • *
  • Posts: 1516
Both codes worked, but Alexin's made an old bug disappear. Anyway, my problem continues, so i'll reformulate it:

I have behavior A and B. I want A to set the value of B's list attribute to the same value of a list in A. Using just the setter block doesn't seems to work as expected. Any ideas?
Working.