Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / My BASIC Code Doesn't Work?

Author
Message
Kieran Adams
13
Years of Service
User Offline
Joined: 2nd Oct 2011
Location: Brighton
Posted: 29th Jun 2012 19:47
Hello, I don't know if this is the right place for this to be posted but I have recently been reading Hands on AppGameKit Basic and when ever I type in the examples it gives me errors. For example:

SetDisplayAspect( 4.0/3.0 )

do

i=10

IF i = 10 THEN

Print (" Hello, world! ")
SetPrintColor( 255,0,255, [ 255 ] )

ELSE

Print ( "The condition i is not equel to ten" )

ENDIF

Sync()
loop

The above piece of code is giving me a error saying "command out of place on line 12, which is the "ELSE" part. I also cannot run this:

For 3 times DO

Print( "Hello, World!" )

ENDFOR

If anyone can help me it would be much appreciated. Thank You

4B:69:65:72:61:6E:20:41:64:61:6D:73
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Jun 2012 02:14 Edited at: 30th Jun 2012 02:16
Quote: "IF i = 10 THEN"

On this line, you don't need the THEN. The IF condition THEN statement is used for one line IF statements e.g

IF a = b THEN print("A equals B")

When using IF ELSE ENDIF, you can't use THEN.

I hope that makes sense.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Jun 2012 02:21 Edited at: 30th Jun 2012 02:22
OK, first code snippet should be like this:

When you use "if (case) THEN" the remaining code should be on the same line as the "if" statement.

Second snippet, a "for" loop should be like this:


Check out some of the tutorials in my signature and the help files under the "IDE/Help" folder in the AppGameKit install and you'll understand the syntax a little better.

Damn you Hodgey, ninja score = Hodgey+1


this.mess = abs(sin(times#))
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Jun 2012 02:29
Maybe someone (me) should take the time to re-write TDK's tutorials for AppGameKit?

Quote: "Damn you Hodgey, ninja score = Hodgey+1"

I've been practicing.

Kieran Adams
13
Years of Service
User Offline
Joined: 2nd Oct 2011
Location: Brighton
Posted: 30th Jun 2012 02:44
Guys thanks for your help, I can see where I went wrong now as I have just realized that chapter 1 (algorithms)in the Hands On AppGameKit Basic book explains how the code works rather than what it should be.

4B:69:65:72:61:6E:20:41:64:61:6D:73
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 30th Jun 2012 03:29 Edited at: 30th Jun 2012 03:30
The real question, to my mind, is "Why is Hands On AppGameKit Basic telling him to use those commands?"


For 3 times DO

What?


ENDFOR

Really?

If I had to guess, I'd say the book is showing pseudo code to explain, in a common language kind of way, what the loop is trying to accomplish, and that pseudo code is NOT the code that is supposed to be typed into a program.

Kieran, make sure you know the difference between the book's pseudo code and the code you're supposed to type.

Some days, the bear will eat you.
Some days, you'll eat the bear.
Today, I'm eating the bear!
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 30th Jun 2012 13:35
Rich, half the examples is in structured English, not basic, and he tried to type in the structured English example

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 30th Jun 2012 13:59
Impetus73, that's what I thought. I'd seen the same type of thing in the other books in the series.

I think that this method is just confusing. BASIC is pretty easy to understand, why bother with an example that LOOKS like code?

That's just my opinion, though.

Some days, the bear will eat you.
Some days, you'll eat the bear.
Today, I'm eating the bear!
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 30th Jun 2012 14:18
I agree, the book really focus on planning and making all kinds of tests and plans before you code. I'm sure 99% of coders, don't bother about that at all, even if we maybe should...

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Kieran Adams
13
Years of Service
User Offline
Joined: 2nd Oct 2011
Location: Brighton
Posted: 30th Jun 2012 15:51
Yes guys I was accidentally assuming that the code in the book was real basic code, but it was just in fact pseudo code in the first chapter. Thanks for your help, most appreciated.

4B:69:65:72:61:6E:20:41:64:61:6D:73
3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 1st Jul 2012 14:32 Edited at: 1st Jul 2012 14:37
How needs a book when ugot the forums there is more documentation on the forums then any other source the book is probly good if you don't want to search through the endless post Mabel we should make a post about the commands and add examples in c++ and basic for every command. Make sure if a post in on the furums go a-z of the commands or start a wiki

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 1st Jul 2012 23:32
I have already given feedback to the author of the book, that he might want to more clearly specify run-able code in the book.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
MarcoBruti
13
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 2nd Jul 2012 00:11
If the target of the book are the VERY beginners, it is better to specify the difference between pseudo-code and real code.
But anyone who attended a programming course or read a programming book should be able to distinguish. English pseudo-code is a standard way to describe algorithms, it is used in project documentation etc.
DarkBasicPro books series is full of such an examples...
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 2nd Jul 2012 13:33
Yes MarcoBruti, and the author seem to realize this, and hopefully will change this in later releases. He release the book in smaller batches, and do small fixes as people reports them in, so I encourage all who got the book, to give feedback.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 2nd Jul 2012 17:50
Having read through the first chapter I really can't see why he does this. It is so similar to Basic that it probably makes things more confusing. Found a handful of minor mistakes in the first chapter. Must have been a sleepy spell checker.

Login to post a reply

Server time is: 2024-11-23 16:55:22
Your offset time is: 2024-11-23 16:55:22