Manual 2D list input

LtVax27

  • *
  • Posts: 85
Trying to put a list in list for a basic Attribute, couldn't find anything on it so here I am. Building a Map gen, Index is last tile ID, Value is compatible Tile ID based on direction. [U,Ur,Ul,D,Dr,Dl,R,Rd,Ru,L,Ld,Lu] Have I input it wrong or can't do it this way?
A few of the Numbers are wrong if you try to copy the list, row 3.


« Last Edit: September 28, 2017, 08:22:45 am by LtVax27 »

LtVax27

  • *
  • Posts: 85
Still no reply on if I can do it this way :( O'well, Custom Block it is for a quick fix. (Well it did work, once, got a loop bug I need to find) (Loop was something else)
ADD an , to the ends of the 2D Lists
CAUTION: Getting Numbers wrong will cause a loop!

« Last Edit: September 28, 2017, 08:54:45 am by LtVax27 »

mdotedot

  • Posts: 1560
You can use a list in a list but you need to convert that text to something that Stencyl understands as a list.
Did not test it:  but I would assume that you would need to use the split block.
So if your line was [ get item # [ItemInc2 ] from [get item # TileID ...] ]
it should be something like [get item # [ItemInc2]  from  [   split text  [get item # TileID ..]  using [,] ]  ]

That split text block will create a list from a string. So your string is 0,0,0,6,11 etc..  and that would be used to create the list.

Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

yoplalala

  • *
  • Posts: 1511
You were inputting a string by hand , not a list. That's why you had this error. I don't know if you can manually input a list. There is maybe a trick but I don't know it.

LtVax27

  • *
  • Posts: 85
So if your line was [ get item # [ItemInc2 ] from [get item # TileID ...] ]
it should be something like [get item # [ItemInc2]  from  [   split text  [get item # TileID ..]  using [,] ]  ]

'String should be Int' error for the  [split text  [get item # TileID ..]  using [,] ]

Anyway got the 2nd compatible tile spawning, now to add constraints and have it loop till it's done.

« Last Edit: September 28, 2017, 05:55:08 am by LtVax27 »

Luyren

  • *
  • Posts: 1704
'String should be Int' error for the  [split text  [get item # TileID ..]  using [,] ]
This means you have to put your "get item from list" block inside an "as number" block to make comparisons with numbers, in case you haven't found how to fix that.

« Last Edit: September 28, 2017, 06:25:48 am by Luyren »
Working.

LtVax27

  • *
  • Posts: 85
[split text  [[get item # TileID ..]as number]  using [,] ] is the only way I can fit them and it wont work, same error.
(updated Custom Block workaround pic)

Luyren

  • *
  • Posts: 1704
You only have to wrap around the "as number" when you are using that to compare to numbers or using for math operations. The way you are using it won't work because you are using a number in a block that expects a text (string).
Working.

LtVax27

  • *
  • Posts: 85
Well the Custom block I made seems to be working good, not sure how it will perform under pressure but I got it all set up in a nice trigger loop. I guess if there is no proper way to input 2D List manually then it will have to do. Hope it helps anyone else wanting/needing to do things this way.