Ultimate Amiga

Network Boards => AMOS Factory => Topic started by: amigaalien on March 28, 2020, 01:13:45 AM

Title: Hello Friends! newb here!
Post by: amigaalien on March 28, 2020, 01:13:45 AM
Heya everyone!
long time amiga user and fan! always wanted to make a game never had time.
Now that im retired iv got time to learn a programming language!
except i dont want to learn anything new coz thats boring.

I want to learn AMOS BASIC! coz its fun.
anyway been going a while now writing my own programs
its slow going as I have to use my brain alot, who knew almost everyone bloody line is a new problem to solve!

anyway I need some help! (of course you do u say..) iv got old 80's basic books that im learning from and most of it is transferring to AMOS but one thing I cannot figure out from all my documentation.

How to do create an dimensional array that doesnt start at 0!!!!
I want it to start at say 1 to 40.
this is driving me crazy at the moment.
and how to generate a rnd number that also doesnt start at 0

( i assume the solution will work for both problems)
Title: Re: Hello Friends! newb here!
Post by: supercruiser on April 28, 2020, 02:37:21 AM
Hi
Did you end up working this out?

Cheers
Craig
Title: Re: Hello Friends! newb here!
Post by: SamuraiCrow on May 08, 2020, 03:02:33 AM
I don't think there is an Option Base command in Amos but it's easy to do without: dimension the array with the width of the range of the desired length, then subtract the start from the index every time you read from the array.

For example:
Code: [Select]
Dim a(40): Rem 40 elements
...
a(x-1) = v : element 1 stored in index 0
Title: Re: Hello Friends! newb here!
Post by: supercruiser on May 08, 2020, 10:48:28 AM
Mr Crow.

Appreciate your reply.

Can you explain this out a bit more.

Sorry to not get it..

Cheers
SC
Title: Re: Hello Friends! newb here!
Post by: SamuraiCrow on May 15, 2020, 12:30:43 AM
If you want to start with 1, you have to subtract 1 from each time you use the array.