English Amiga Board


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

 
 
Thread Tools
Old 19 August 2021, 08:20   #1
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 676
Issue with spacing...

Hello guys,

I have issue when it comes to spacing when saving files to disk in AMOS. I have an array called:

LEVELGETCARD$(WIDTH, HEIGHT)="2"

When I use Open Out and Print #1 to save or even use text 32,32,_STR$ or Print _STR$ I get:

2 2 2 2 2 2 2 2 2 2 2 2 2 --- instead of ---> 2222222222222


I tried:

For HEIGHT=0 to 49
For WIDTH=0 to 49
_GETSTR$=_GETSTR$+LEVELGETCARD$(WIDTH, HEIGHT)
...
...
Next WIDTH
Next HEIGHT

It comes out as 2 2 2 2 2 instead of 22222....then I tried:

For HEIGHT=0 to 49
For WIDTH=0 to 49
_GETSTR$=_GETSTR$+Space$(0)+LEVELGETCARD$(WIDTH, HEIGHT)
...
...
Next WIDTH
Next HEIGHT

It comes out as 2 2 2 2 instead of 22222....then I tried

For HEIGHT=0 to 49
For WIDTH=0 to 49
LEVELGETCARD$(WIDTH,HEIGHT)="2"+Space$(0)
_GETSTR$=_GETSTR$+LEVELGETCARD$(WIDTH, HEIGHT)
...
...
Next WIDTH
Next HEIGHT

It comes out as 2 2 2 2 instead of 2222....even if I print it on screen such as Print or Text 32,32 ....or Print #1, ....

What advice someone can help me?
xboxown is offline  
Old 19 August 2021, 15:04   #2
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,187
The sign is a space for positive numbers. If it were negative the minus sign would be there.
Samurai_Crow is offline  
Old 19 August 2021, 17:48   #3
adrazar
Registered User
 
Join Date: Feb 2017
Location: Oslo
Posts: 90
It seems to work as expected if you literally initialise the array like this

Code:
For HEIGHT=0 to 49
   For WIDTH=0 to 49
      LEVELGETCARD$(WIDTH, HEIGHT)="2"
   Next WIDTH
Next HEIGHT
SamuraiCrow's theory of the origin of the extra space character is quite typical, but something makes me think it could be something else going on here...
Because it doesn't quite make sense to encode numbers as strings and then save these strings without any separating character, like space [unless all numbers are in the range 0-9].
adrazar is offline  
Old 19 August 2021, 22:04   #4
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 676
Quote:
Originally Posted by adrazar View Post
It seems to work as expected if you literally initialise the array like this

Code:
For HEIGHT=0 to 49
   For WIDTH=0 to 49
      LEVELGETCARD$(WIDTH, HEIGHT)="2"
   Next WIDTH
Next HEIGHT
SamuraiCrow's theory of the origin of the extra space character is quite typical, but something makes me think it could be something else going on here...
Because it doesn't quite make sense to encode numbers as strings and then save these strings without any separating character, like space [unless all numbers are in the range 0-9].

How should I have initialized the array then?
xboxown is offline  
Old 19 August 2021, 22:41   #5
adrazar
Registered User
 
Join Date: Feb 2017
Location: Oslo
Posts: 90
If you converted numbers to strings with Str$(NUMBER), you could replace it with Str$(NUMBER)-" " to get rid of the whitespace.
Alternatively, if NUMBER always lies between 0-255 you could consider using Chr$(NUMBER) instead, and let the reverse operation from string to number be done with Asc.
adrazar 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
B.A.T. II issue demoniac support.WinUAE 8 18 November 2020 04:51
CF issue Blipsqueak support.Hardware 3 27 April 2018 05:32
CF issue? zerohour1974 support.Hardware 19 28 September 2016 20:31
amiga computing vol 2 issue 1 (issue 13 anyone) Mort request.Other 0 30 November 2010 11:27
Re-issue Galahad/FLT HOL suggestions and feedback 4 26 April 2003 16:48

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 08:48.

Top

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