English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 20 April 2018, 09:02   #1
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
Typewrite text on screen (One letter at a time)

I'm looking to make some text appear on screen one by one. I have a nice arcade font sheet which I wrote a grabber procedure for and they are sitting nicely in my Icon bank.

At the moment I've got a rather clumsy bit of code which works within a loop and pastes the appropriate letter one after the other.

EG

For T=1 to 50

If T=1 Then Paste Icon, TX,TY,13
If T=2 Then Paste Icon, TX+8,TY,27
If T=.........
If T=.........etc.

Wait 3
Next T

It's time consuming, but it works and if need be I can just use that method, but I'm wondering if there is a way to use a string to just type out what I have and then to scan the string and allocate each letter within it to a corresponding image number in the Icon bank?

I know there is graphic text, but honestly, it's skimmed over so vaguely in the manual I came away just as clueless as before I read it, and my text fonts are 8x16 not 8x8.

Anyway, any info would be great, thanks!
Brick Nash is offline  
Old 20 April 2018, 10:40   #2
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
Asc(Mid$(s$,t,1)) will give you the ASCII code for character t in string s$. If capital A is tile 0 in your icon bank, you need to subtract 65 from that, for example.

Also, multiplying t*8 is a bit shift when compiled so that will help your position when looping.
Samurai_Crow is offline  
Old 23 April 2018, 13:10   #3
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
Thanks for the tip! I've not quite got what I want to do yet, but this is certainly an interesting part of the manual to read.

Would I have to set up a Mid$ code for each letter/character, or could I put all the characters in one string (EG: S$= "ABCDEFGH....etc.) and then assign some sort of variable for the returned code? Also, once the ASCII code has been returned, how would I apply that to the images within the Icon bank to be used on screen? Just a paste command with custom variables? E.G. Paste Icon, X,Y,CHAR.

I think I'm getting a good idea of what to do in theory, but it's still a little muddy.

Thanks.
Brick Nash is offline  
Old 23 April 2018, 14:18   #4
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
Mid$ gives you the character at a certain position, Asc() will give you the ascii code for a character, so Asc(Mid$(S$,T,1)) will give you the ascii code for the character at position T (which could be the counter in a For…Next loop, for instance). The letter A is ascii code 65, so just put your icons in the alphabetical order and subtract the difference between 65 and the position of the letter A in your bank and you'll get the correct icon number to paste.
idrougge is offline  
Old 23 April 2018, 14:56   #5
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
Ok that's a little clearer, thanks!
Brick Nash is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
A500 with ks 3.1 sometimes kickstart most time black screen solidcore support.Hardware 3 30 March 2018 15:51
Possibly Jeff Minter program that made fireworks on screen in time to music? Starglider 2 Nostalgia & memories 6 10 June 2015 07:02
Most optimized Atari ST to Amiga real time screen converter Galahad/FLT Coders. Asm / Hardware 36 17 January 2014 06:59
actual time on on-screen LEDs Gary7 request.UAE Wishlist 3 26 July 2007 15:46
Browse by letter haribootje HOL suggestions and feedback 4 02 June 2004 12:47

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:44.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.28983 seconds with 15 queries