Silly Programming Ideas - Turning Text into Graphics

Started by AMSDOS, 12:43, 23 November 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AMSDOS

A while ago I wondered if it were possible to use one of those BASIC Message Scrollers to have each letter in a different colour as it Scrolls Right to Left. I wasn't successful earlier, though my 2nd attempt I had of it was good enough to create this version. I don't know if it could be improved, though the code is compatible in Locomotive BASIC and CPC BASIC 3.




100 MODE 1:BORDER 0:INK 0,11:INK 1,26:p=1
110 READ a$,col$
120 a$=a$+MID$(a$,1,1):a$=RIGHT$(a$,LEN(a$)-1)
130 col$=col$+MID$(col$,1,1):col$=RIGHT$(col$,LEN(col$)-1)
140 LOCATE 10,10
150 FOR p2=1 TO 20
160   PEN VAL(MID$(col$,p,1))
170   PRINT MID$(a$,p2,1);
180   p=p+1
190   IF p=len(a$) THEN p=1
200 NEXT p2
210 IF p>20 THEN p=p-20
220 GOTO 120
230 DATA " Multicoloured Text Scrolling in BASIC...."
240 DATA "132231123123212321231212321231322123212321"

* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

mv

Quote from: AMSDOS on 11:25, 11 December 19
A while ago I wondered if it were possible to use one of those BASIC Message Scrollers to have each letter in a different colour as it Scrolls Right to Left. I wasn't successful earlier, though my 2nd attempt I had of it was good enough to create this version. I don't know if it could be improved, though the code is compatible in Locomotive BASIC and CPC BASIC 3.

Hmm, improve? Staying with Locomotive BASIC, I just checked that using chr$(15) to set the PEN and printing it as a single string will speeds up the scroller by a factor of 3:


100 MODE 1:BORDER 0:INK 0,11:INK 1,26:p=1
110 READ a$,col$
120 a$=a$+MID$(a$,1,1):a$=RIGHT$(a$,LEN(a$)-1)
130 col$=col$+MID$(col$,1,1):col$=RIGHT$(col$,LEN(col$)-1)
140 'LOCATE 10,10
150 FOR p2=1 TO len(a$)
160   'PEN VAL(MID$(col$,p,1))
170   'PRINT MID$(a$,p2,1);
175   s$=s$+chr$(15)+chr$(VAL(MID$(col$,p,1))) +  MID$(a$,p2,1)
180   p=p+1
190   IF p=len(a$) THEN p=1
200 NEXT p2
205 p=1
210 'IF p>20 THEN p=p-20
213 t$=mid$(s$,p,20*3)
214 if len(t$)<20*3 then t$=t$+left$(s$,20*3-len(t$))
215 locate 10,10:?t$;
216 p=p+3:if p>len(s$) then p=1
220 GOTO 213
230 DATA " Multicoloured Text Scrolling in BASIC...."
240 DATA "132231123123212321231212321231322123212321"

Fessor

Dunno how much it saves, AFAIK converting of the values wasn't needed.

175   s$=s$+chr$(15)+MID$(col$,p,1) +  MID$(a$,p2,1)

Z|G

Not as one nice as the above ones.



10 CLS
20 MODE 2
30 a$="Hello CPC Wiki... Greetings to all members... Found a scroller and thought it worthy of posting...."
50 startatpos=40
60 amt=LEN(a$):a$=STRING$(startatpos," ")+a$:a$=a$+" "
80 FOR txt=1 TO LEN(a$)-1
90 LOCATE 20,10:PRINT MID$(a$,txt,startatpos);   
100 FOR delay=1 TO 50:NEXT delay     
110 NEXT txt
120 GOTO 80
1xCPC6128, 1xTandy Model 4, 1xC64 (IN BOX)

Powered by SMFPacks Menu Editor Mod