Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Hello Friends! newb here!  (Read 4476 times)

0 Members and 1 Guest are viewing this topic.

amigaalien

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 1
  • Generic Amiga User
Hello Friends! newb here!
« 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)
Logged

supercruiser

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 8
  • Generic Amiga User
Re: Hello Friends! newb here!
« Reply #1 on: April 28, 2020, 02:37:21 AM »

Hi
Did you end up working this out?

Cheers
Craig
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Hello Friends! newb here!
« Reply #2 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
Logged

supercruiser

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 8
  • Generic Amiga User
Re: Hello Friends! newb here!
« Reply #3 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
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Hello Friends! newb here!
« Reply #4 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.
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022