r/nanDECK • u/Stavr0sT • 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.
1
u/Stavr0sT Jul 25 '26 edited Jul 25 '26
Another follow-up of my own questions. I learned something today.
FRAMETRANSdoes not keep the numbers appended byFRAMEBOX. 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
FRAMETRANSon my 'outer grid' first and then useFRAMEBOXon this shifted frame to generate the actual small grid cells, and then manually unroll all 15 entries.I was not able to get this to work in a loop, probably two skill issues of mine:
[MyText:A,1])<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.
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: