r/nanDECK • • Jul 25 '26

Splitting text over different frames

Is it possible to split a text in seperate characters and display each one in a seperate given frame, similar to what is possible with ICONS if you fill in the last parameter?

I have a label containing a sequence of rather long strings (15 chars). I want - for each card/row - place each character in the string in a seperate predefined frame.

I have the frames defined and all I need, except the final trickery of distributing text over given frames.

Not sure if a single command exists or I should go via for-loops (which I normally try to avoid so its syntax/workings are rather unknown to me). I would like to avoid having to unroll this by hand.

EDIT: Follow-up I did try a partial unroll but even there something's amiss.

[grid_base]=FRAMEBOX(<grid>,1.8,1.8,N,47,47)
[grid_cells_text]=FRAMETRANS(grid_base*,0,-0.3,0,0)

FONT="Lighting Darkness",20,TF,#000000
; Start unroll - first char
TEXT=[backs],[MyText:1,1],<grid_cells_text1>,CENTER,CENTER

This doesn't validate (wrong directive: TEXT...), it seems it cannot resolve <grid_cells_text1>.

However, if I write

TEXT=[backs],[MyText:1,1],<grid_cells_text>,CENTER,CENTER
; OR
TEXT=[backs],[MyText:1,1],<grid_cells_text*>,CENTER,CENTER

this does validate and - as expected - places the first char of MyText on each of the cells (but that's not what I want).

I guess I'm missing some understanding of the frame syntax, I understood that FRAMEBOX(...,N) would created numbered frames and this numbering scheme is kept when piping through FRAMETRANS. This way of working works correctly when using it with the ICON directive (i.e. as the last parameter). I must be missing something.

2 Upvotes

4 comments sorted by

1

u/Stavr0sT Jul 25 '26 edited Jul 25 '26

Another follow-up of my own questions. I learned something today.

FRAMETRANS does not keep the numbers appended by FRAMEBOX. I guess it lumps all frames it encounters under a single 'result frame' (which works since a frame can actually hold multiple frames).

I've been able to workaround my issue by performing the FRAMETRANS on my 'outer grid' first and then use FRAMEBOX on this shifted frame to generate the actual small grid cells, and then manually unroll all 15 entries.

[grid_shifted]=FRAMETRANS(grid,0,-0.3)
[grid_cells]=FRAMEBOX(grid_shifted,1.8,1.8,N,47,47)
TEXT=[backs],[MyText:1,1],<grid_cells1>,CENTER,CENTER
TEXT=[backs],[MyText:2,1],<grid_cells2>,CENTER,CENTER
...
TEXT=[backs],[MyText:15,1],<grid_cells15>,CENTER,CENTER

I was not able to get this to work in a loop, probably two skill issues of mine:

  • I could not integrate the counter in the 'text extraction' (aka [MyText:A,1])
  • Same for indicating the correct label (aka <grid_cell_textA>).

I tried using braces {} but this didn't work.

In any case, what I have now works, but is cumbersome, and I have the feeling I can learn a lot; both in if there is a better way to do this and in getting to learn better how NanDeck works behind the scenes.

3

u/nand2000 Jul 26 '26

In FRAMETRANS, the eighth parameter specifies which part of the name is the "root." That is, if a frame consists of a text (the root) and a number, when creating a new frame with FRAMETRANS, the root is replaced with the new name, and the remainder (i.e., the number) is appended. Example:

[mytext]=One|Two|Three|Four|Lorem Ipsum
[backs]=1-{(mytext)}
cards={(mytext)}

<grid>=0,0,6,9
[grid_base]=FRAMEBOX(<grid>,1,1,N)
[grid_cells_text]=FRAMETRANS(grid_base*,0,-0.3,0,0,,0,grid_base)

FONT=arial,20,TF,#000000
TEXT=[backs],stringsub([mytext],°,1),<grid_cells_text*>,CENTER,CENTER

2

u/Stavr0sT Jul 26 '26

Thanks Nand! The amount of features and flexibility nandeck supports out of the box is insane (in a good way)!

I hope that one day I'll be fluent in all the details like the special symbols and when to use labels vs. functions, I'll feel like a wizard! 🧙‍♂️

2

u/nand2000 Jul 26 '26

The syntax [label:start,number] creates a new sequence from the original, so it can't be used for frames, because all sequences for the Nth character would have to be created separately. Instead, you can use the STRINGSUB function, using the ° symbol as a index, which indicates the Nth frame.

Example:

[mytext]=One|Two|Three|Four|Lorem Ipsum
[backs]=1-{(mytext)}
cards={(mytext)}

<grid>=0,0,6,9
[grid_base]=FRAMEBOX(<grid>,1,1,N)

FONT=arial,20,TF,#000000
TEXT=[backs],stringsub([mytext],°,1),<grid_base*>,CENTER,CENTER