Ultimate Amiga
Network Boards => AMOS Factory => Topic started 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)
-
Hi
Did you end up working this out?
Cheers
Craig
-
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:
Dim a(40): Rem 40 elements
...
a(x-1) = v : element 1 stored in index 0
-
Mr Crow.
Appreciate your reply.
Can you explain this out a bit more.
Sorry to not get it..
Cheers
SC
-
If you want to start with 1, you have to subtract 1 from each time you use the array.