|
Post by Mark Dunham on Jun 12, 2021 9:30:20 GMT -5
I am formatting text into a large textbox and I am wondering if there is a way to split that data onto multiple lines to make the code look cleaner. I have tried a bunch of different combinations and I am not having luck. I feel I have done this before but for the life of me can't find it in my notes or bookmarks. The code snippet below is all on one line it would be nice to break it up onto multiple lines in the editor.
#Structure.tbMightSt, "Damage:"; chr$(9); chr$(9);chr$(9); damage$; chr$(13);chr$(10); "Throw:"; chr$(9);chr$(9);chr$(9); throw$; chr$(13);chr$(10); "Grapple:";chr$(9);chr$(9);chr$(9); grapple$; chr$(13); chr$(10); "Might Checks:"; chr$(9);chr$(9); mightChecks$
|
|
|
Post by Rod on Jun 12, 2021 13:44:54 GMT -5
Little confused. You can split long lines in the code editor with the line continuation character _ Long lines of text in a textbox need split with Chr$(13)+Chr$(10)
print "Damage:"; chr$(9); chr$(9);chr$(9);_ damage$; chr$(13);chr$(10); "Throw:"; chr$(9);chr$(9);_ chr$(9); throw$; chr$(13);chr$(10); "Grapple:";_ chr$(9);chr$(9);chr$(9); grapple$; chr$(13);_ chr$(10); "Might Checks:"; chr$(9);chr$(9);_ mightChecks$
|
|
|
Post by tsh73 on Jun 12, 2021 14:23:24 GMT -5
How about adding some constants Then you could write like this
nomainwin textbox #text.txt, 1, 1, 200, 200 open "test" for window as #text
'dummy data damage$="100" throw$="81" grapple$="1.5" mightChecks$="Yes"
'fromatting constants CrLf$=chr$(13);chr$(10) Tb$=chr$(9) Tb3$=chr$(9); chr$(9);chr$(9)
'tretyy printed code line #text.txt "Damage:"; Tb3$; damage$; CrLf$; _ "Throw:"; Tb3$; throw$; CrLf$; _ "Grapple:"; Tb3$; grapple$; CrLf$; _ "Might Checks:"; Tb$;Tb$; mightChecks$
wait
(did not know textBox actually supports TAB !!! while textWindow / textEditor does not, obviously)
|
|
|
Post by Mark Dunham on Jun 12, 2021 15:00:16 GMT -5
Little confused. You can split long lines in the code editor with the line continuation character _ Long lines of text in a textbox need split with Chr$(13)+Chr$(10) print "Damage:"; chr$(9); chr$(9);chr$(9);_ damage$; chr$(13);chr$(10); "Throw:"; chr$(9);chr$(9);_ chr$(9); throw$; chr$(13);chr$(10); "Grapple:";_ chr$(9);chr$(9);chr$(9); grapple$; chr$(13);_ chr$(10); "Might Checks:"; chr$(9);chr$(9);_ mightChecks$
Thanks Rod, that is what I was looking for I have not really used it that much so I was trying to remember. Being overtired is not helping either LOL
|
|
|
Post by Mark Dunham on Jun 12, 2021 15:01:51 GMT -5
How about adding some constants Then you could write like this nomainwin textbox #text.txt, 1, 1, 200, 200 open "test" for window as #text
'dummy data damage$="100" throw$="81" grapple$="1.5" mightChecks$="Yes"
'fromatting constants CrLf$=chr$(13);chr$(10) Tb$=chr$(9) Tb3$=chr$(9); chr$(9);chr$(9)
'tretyy printed code line #text.txt "Damage:"; Tb3$; damage$; CrLf$; _ "Throw:"; Tb3$; throw$; CrLf$; _ "Grapple:"; Tb3$; grapple$; CrLf$; _ "Might Checks:"; Tb$;Tb$; mightChecks$
wait
(did not know textBox actually supports TAB !!! while textWindow / textEditor does not, obviously) tsh73, thanks for the input. I do have a lot of constants that are filled depending on what the user selects. This snippet is part of a project for creating characters in an RPG game.
|
|
|
Post by Mark Dunham on Jun 12, 2021 16:19:42 GMT -5
Thank you for all of the input I could not remember the line continuation character. I have another program that uses it with structs but it never came to me, I have been burning the candle at both ends and the sides lately. I really appreciate you answering my duh moment.
|
|
|
Post by Brandon Parker on Jun 12, 2021 21:18:12 GMT -5
|
|