I thought this would be useful to make text games look a little bit nicer!
The only way i can think of is by making each letter in a sentence one by one like
LOCATE 1,1:PRINT"H"
WAIT 30
LOCATE 2,1:PRINT"E"
WAIT 30
LOCATE 3,1:PRINT"L"
WAIT 30
LOCATE 4,1:PRINT"L"
WAIT 30
LOCATE 5,1:PRINT"O"
WAIT 30
LOCATE 6,1:PRINT"!"
See how much space and time that takes up?
Please, and Thank You!
How to easily make TEXT that Appears Letter By Letter?
Root / Programming Questions / [.]
ElzoBroCreated:
I don't like data ;( I love it?
Uhhh this doesn't use DATA at all. A% is just the integer value (basically just A if you don't use OPTION STRICT) that is the main part of the for loop. Basically, the for loop makes A% increase by one at the NEXT A%, and the LEFT$ tells what to include. So for the first time around, A% is equal to 1, so the LEFT$ takes the first character to the left of the string and prints it. Then, A% is equal to 2, and the LEFT$ this time takes the first two characters and prints them, eventually printing every character in the string.
tldr lol
Haha sorry but it reminds me of data so much
Explain with comments (I hope to make it less complicated for beginners lol)
TEXT$="HELLO!" 'setting what will be printed FOR A%=1 TO LEN(TEXT$) 'the beginning of the loop. A% will start at 1 and end at the length of the text. At the NEXT A%, at returns to here and makes A% greater by one. Once A% equals the length of the text, it breaks from the loop, continuing along. CLS 'clears screen duh PRINT LEFT$(TEXT$,A%) 'prints however many characters on the left of the text. example: if A%=2 then just the first two characters of the text WAIT 30 'waits so it doesnt all come at the same time NEXT A% 'tells the for loop to restart and increment A% by whatever STEP value you put (if omitted then its just 1)hope this works lol EDIT: apparently theres no text wrap for code so youll have to scroll left and right
Cool, oh also found out how to have multiple lines and have a specific line a different color =)
I hope this would work
TEXT$="HELLO!" 'This is what will be printed CLS 'Does just like DOS Does. FOR T%=1 TO LEN(TEXT$) 'This sets the T% for use later in the loop. It basically sets the loop to start at 1 and stop at the length of TEXT$ PRINT MID$(TEXT$, A%, 1); 'Prints one character of the TEXT$ variable WAIT 30 'Waits so that you can actually see what it is printing NEXT T% 'Tells the loop to increment T% and go back to the FOR statement
A general formula for a sequence of events that happen regularly, that doesn't block other events:
' When the sequence starts SEQUENCE%=TRUE NEXTEVENT%=MAINCNT+delay between eventsRegularly:
IF (SEQUENCE% AND (MAINCNT>=NEXTEVENT%)) THEN DO_EVENTProcedure:
DEF DO_EVENT ' Do event ' If not the last event in sequence, INC NEXTEVENT%,delay between events ' If the last event in sequence, SEQUENCE%=FALSE RETURN