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 / 2 commands on same line

Author
Message
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 21st Jun 2012 12:04
When my program gets to Getpointerpressed = 1 and if sprite=1 then..etc I want it to play a sound then goto a certain part of the program to continue but it won't let me put Playsound and Goto on the same line, and if I put goto on the next line down then as there is a Do Loop in there it wil just goto whatever I put even if sprite hasn't =1 because it reads it as a separate command not when only sprite=1. Is there a way to put separate commands on same line or have I just got to put 2 lines of If Sprite=1 then .... One saying Playsound then the next saying Goto. Thanks for any help
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 21st Jun 2012 12:11
I don't think you can have two commands on the same line but you could try something like this:


baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Jun 2012 13:13
I would avoid using "goto" unless you are an experienced programmer as it is very easy to get in a mess using it. A better way would be to use conditional statements or another method.

You can put multiple commands on one line as follows however:



this.mess = abs(sin(times#))
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 21st Jun 2012 13:18
Quote: "You can put multiple commands on one line as follows however:"

I stand corrected. When was that added?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Jun 2012 14:32
It's the same as DBPro, as far as I'm aware it's been in since day one.

I don't tend to use it though. I prefer to keep commands on separate lines in most cases. About the only time I use it is in simple "select" logic IE:



this.mess = abs(sin(times#))
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 21st Jun 2012 14:38
Quote: "It's the same as DBPro, as far as I'm aware it's been in since day one."

That's embarrassing on my part. Well, you learn something new everyday.

Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 21st Jun 2012 15:09
It's best to avoid, the if statement can be a little "quirky" when it comes to the presence of colons.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Jun 2012 15:17 Edited at: 21st Jun 2012 15:28
It's been there since the 1960s

There's a very funny and accurate history of BASIC here:

http://dotnetmasters.com/HistoryOfBasic.htm

Bring out a StarTrek game at your peril!!!

If you're interested in languages you may also feel yourselves lucky to have AppGameKit Basic when you read the history of Applesoft:

http://en.wikipedia.org/wiki/Applesoft_BASIC

-- Jim
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 21st Jun 2012 15:32 Edited at: 21st Jun 2012 15:32
Quote: "I would avoid using "goto" unless you are an experienced programmer
"

I use goto at the beginning of the program main menu. so every exit from certain level or task, the program will easily comeback to the main menu. this way you avoid a lot of confusing if(s).

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Jun 2012 17:59
JimHawkins, thank you. I needed a good laugh and the history of basic was great! As is the history of C and the microprocessor (links at the bottom of the history of basic page).

I love these versions of 'my' history. Back in the mid-eighties when I built and sold IBM PC compatibles, the first thing I showed customers was that all the games written for the ROM based Basic still worked on the computer I built for them. Naturally, I upgraded all the 8088's for V20's and more than doubled the processor speed.

Cheers,
Ancient Lady
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 21st Jun 2012 18:27
Well instead of using go to in basic you can call the function main() to get a rid of }}}}}.........

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Jun 2012 19:06 Edited at: 21st Jun 2012 19:08
Thanks, Ancient One - I hadn't followed the links at the bottom. On the whole, programming is a thankless and humourless task, but for anybody who's been programming for a long time, this is sheer bliss.

We could drone on forever about what fun it all was or was not.

Turbo Pascal and Modula-2 made the dire load of old junk that was a PC (deliberately crippled by IBM) into something maybe usable. It was exciting to hit the "Go" key and have a program that ran a couple of seconds later, without multiple stages, linker problems, and all the other things which we have, it appears, sadly returned to.

The younger generation is now confronting the same old issues which we faced in the late seventies and early eighties. They will never, possibly, understand the sheer sense of empowerment that typing PRINT 5 * 3 and hitting Return meant as the number 15 appeared on the TV. Oh - maybe I'm wrong! Getting "15" to appear on an Android screen could take days of installation, many hours of work, 273 postings about path settings, NDK and SDK versions, required folders, version conflicts - and on and on, so you'd feel pretty good if you got there!

-- Jim
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Jun 2012 19:09 Edited at: 21st Jun 2012 19:13
Quote: "It's best to avoid, the if statement can be a little "quirky" when it comes to the presence of colons."

That's why I tend not to use it in AGK. Works just fine in select statements though I use it a lot like the example I gave.

Quote: "I use goto at the beginning of the program main menu. so every exit from certain level or task, the program will easily comeback to the main menu. this way you avoid a lot of confusing if(s)."

That's fine as long as you don't call it from within another loop. Something like this can cause serious problems:


Edit: Yes I know the code is duff as there's no menu loop but what I'm saying is avoid using goto unless you know how it can cause problems. Using goto is fine as long as you avoid creating multiple loops.


this.mess = abs(sin(times#))
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Jun 2012 19:16
As for Goto - really best avoided. It shouldn't be needed in a well-structured program, and could cause huge memory leaks if you allocate resources and then skip over the destructor point.

Personally I only use it (in Pascal) for some circumstances in compiler programming, but I doubt if anybody's using AppGameKit to do that!

-- Jim
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Jun 2012 19:22
Since my original language was Fortran (Watfor Watfiv), 'goto' was used all over the place.

I hated it!

COBOL uses it a lot as well. I still hated it!

I do not use a goto, ever.

You can do great things with a variable used to contain a simple state, a select statement and functions (excerpt from WIP):


Cheers,
Ancient Lady
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 21st Jun 2012 22:23
I still debug this kind of program 2 or 3 times a week as part of my day job, you can't beat getting back to basics (pardon the pun)...



basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 22nd Jun 2012 01:35
W..h..a..t I..s. t..h..a..t

Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 22nd Jun 2012 03:06
BatVink, is that IPL?

polomint
12
Years of Service
User Offline
Joined: 3rd Apr 2012
Location: Lancashire, United Kingdom
Posted: 22nd Jun 2012 12:56
@BatVink: ooooo, another language to play about with,

Blackberry App Development & ZX Spectrum Game Development.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Jun 2012 16:57
It's the original RPG - Report Program Generator. None of your fancy scrolling screens, good old-fashioned PAGEUP and PAGEDOWN. Field Exit key essential for manouvering around. Every field, opcode, result and indicator must be placed in correct column!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Jun 2012 17:10
I thought I recognized that. My ex used to work with it back in the 80's for the US federal government (it was the only time he ever really did any programming). I always felt sorry for him when he showed me some of it.

Cheers,
Ancient Lady

Login to post a reply

Server time is: 2024-11-23 16:44:36
Your offset time is: 2024-11-23 16:44:36