If then else bypass

All discussions about the Atari 8bit range of machines.

Moderators: Mug UK, Silver Surfer, Moderator Team

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

If then else bypass

Postby MrPixel » Mon Jan 08, 2018 4:40 am

i am working on a game for the atari 800 (using atari800WinPlus) and need a similar command to IF THEN ELSE for the 800XL.

for those wondering why this is the code needed:

Rem select a or b for yes or no respectively
If a="yes" (or if a =true then etc...) then goto (command line for action)

the problem is, unlike the BBC micro (of which i loath for a different reason) there is no way to classify a as a variable outside of the DIM command. and i don't wan't the game to be full of DIM commands. i need an easy way to allow the player to access an action or choice, select it, then move on to the next area. this is just a small demo, but the issue is grinding on my nerves.

please help

Edit (essentially i need a command that Can act as IF THEN ELSE and be accepted.

am i making sense? i'm new, sorry

mikro
Atari God
Atari God
Posts: 1618
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: If then else bypass

Postby mikro » Mon Jan 08, 2018 11:49 am

Hi there,

although it's not exactly a helpful answer (it has been long time since I did something in Atari Basic), this forum: http://atariage.com/forums/index.php is much better place to ask questions like this.

To be honest, I don't know why we're having this section here at all.

Dal
Administrator
Administrator
Posts: 4160
Joined: Tue Jan 18, 2011 12:31 am
Location: Cheltenham, UK
Contact:

Re: If then else bypass

Postby Dal » Mon Jan 08, 2018 12:17 pm

mikro wrote:To be honest, I don't know why we're having this section here at all.


For the same reason AtariAge have an ST/Falcon section...
Mega"SST" 12, MegaSTE, STE: Desktopper case, IDE interface, UltraSatan (8GB + 512Mb) + HXC floppy emulator. Plus some STE's/STFM's

mikro
Atari God
Atari God
Posts: 1618
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

AF for 8-bits

Postby mikro » Mon Jan 08, 2018 10:26 pm

Dal wrote:
mikro wrote:To be honest, I don't know why we're having this section here at all.


For the same reason AtariAge have an ST/Falcon section...

Fair enough. :) But I think time has shown that while AA ST/Falcon section is something like US oriented part of AF, it doesn't work the other way around, many 8-bit posts are simply unanswered due to lack of audience. Maybe a nice banner telling that 8-bit matters are discussed on AA would be a nice step forward to invite AA guys to do the same with AF?

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2315
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: If then else bypass

Postby charles » Mon Jan 08, 2018 10:39 pm

which programming language are u using ? does it have an instruction set?
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

darwinmac
Captain Atari
Captain Atari
Posts: 180
Joined: Sat Aug 06, 2011 2:49 pm
Location: Chicago, USA

Re: If then else bypass

Postby darwinmac » Mon Jan 08, 2018 11:15 pm

MrPixel,

If you use Turbo Basic XL (TBXL) for the Atari 8-bit, you will get more structures (REPEAT/UNTIL, IF/THEN/ELSE, etc.). However, if you want to use the built-in Atari BASIC (maybe you do not want to use OSRAM in the XL/XE systems which can cause compatibility issues), then you will have to make your own ELSE construct.

I was thinking about something like the following:

10 IF (this condition) THEN DIM X(10):GOTO 30
20 DIM X(30)
30 PRINT "Hello"

In this case, you will execute both statements on line 10 and skip the new DIM statement on line 20. I checked it out in Altirra (Atari 8-bit emulator) to make sure this worked in Atari BASIC. Here is the exact code I typed into Atari BASIC:

10 A=1
20 IF A=1 THEN PRINT "HELLO":GOTO 40
30 PRINT "Hello 2"
40 PRINT "I'M HERE"

When I run this simple program, I see HELLO and I'M HERE printed. If I change A to another value, it prints Hello 2 and I'M HERE. This should do what you want. I realize it is not as elegant as an IF/THEN/ELSE but, without using TBXL, I do not see an alternative.

As mikro mentioned, there are many more 8-bit programmers on AtariAge. As to a banner, The ST forum on AtariAge does receive more traffic than the 8-bit forum receives here. However, I have seen people on AA refer people here when they need more extensive ST help.

Bob C

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: If then else bypass

Postby MrPixel » Mon Jan 08, 2018 11:52 pm

i will try that now. thank you. also, is there a way to save created games to .Tap or cart? i'm using WinAtari800Plus

ijor
Hardware Guru
Hardware Guru
Posts: 3398
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: If then else bypass

Postby ijor » Tue Jan 09, 2018 12:15 am

MrPixel wrote:i will try that now. thank you. also, is there a way to save created games to .Tap or cart? i'm using WinAtari800Plus


You can save Basic programs to tape or to disk, if that's what you mean, but not to easy to cart. Btw, Atari800WinPlus is very outdated. I'd recommend switching to Altirra.

jruark56
Atari freak
Atari freak
Posts: 63
Joined: Sun Nov 09, 2008 2:58 am

Re: If then else bypass

Postby jruark56 » Wed Jan 10, 2018 8:21 pm

Mr. Pixel,
Just one point of clarification. Scalar variables in Atari Basic do not need DIM's. A scalar is defined at first use. Only arrays and strings need to be defined prior to use.
Russ Ruark Jr.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2315
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: If then else bypass

Postby charles » Wed Jan 10, 2018 11:08 pm

also if you use consecutive successive variable u can use command like this
on (x mod 4)gosub proc1,proc2 proc3,proc4
this will eliminate the if x gosub...
??? help ,,maybe?
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: If then else bypass

Postby MrPixel » Tue Jan 16, 2018 10:03 pm

@mikro. i am banned from that site. made some bad choices when replying to certain users

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: If then else bypass

Postby MrPixel » Sun Jan 21, 2018 8:34 pm

i'm getting an 800 installed in school. that means just the base 800, no xl


Social Media

     

Return to “The Atari 8bit corner”

Who is online

Users browsing this forum: No registered users and 1 guest