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 / code does not work when split over two lines

Author
Message
arnzzz
9
Years of Service
User Offline
Joined: 19th Dec 2014
Location:
Posted: 20th Jan 2015 02:16
Sorry I dont know the proper way to describe this, but I have for example a call to a function, and it is long, to long for one line, so after the comma separating the function parameters I drop the rest down to the following line, to aid in readability.

Doing this in most other languages or IDE's is no problem, but in the AGKv2 IDE the code will not compile if you break up a long function call over two lines.

Ill add an image to show you the function call that wont compile because its split over two lines.

Is there a way to do this that I am missing?

Thanks

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 20th Jan 2015 03:35
line breaks in AppGameKit basic indicate new lines for the compiler like you'd do with a semicolon in most languages.
You can't have line breaks in a single AppGameKit command like this.

arnzzz
9
Years of Service
User Offline
Joined: 19th Dec 2014
Location:
Posted: 20th Jan 2015 07:45
Thanks Naphier,

The reason I was confused is I had been copying and pasting code from some website, not sure where, and they had seemed to be useing underscores__ which I had to keep removing

Thanks for the info
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 20th Jan 2015 09:40
I think you want to store those joystick values in a variable anyway, you might end up having to limit the speed for example, as I don't think joystick values are normalized. Like, if you only want the sprite to move by 1 unit at a time... well what if the stick is right in the corner, and X and Y both give 1 - the sprite would actually be moving at more like 1.3 units, or you might want a deadzone, so maybe the last 25% of the joystick range gives a limited full speed. It might make sense to store these values now regardless.

I am the one who knocks...
arnzzz
9
Years of Service
User Offline
Joined: 19th Dec 2014
Location:
Posted: 20th Jan 2015 10:01
Hi Van B

Thats good advice, ill keep that in mind.

I wasn't actually using the joystick code here tbh, its just left over code from a hacked apart example

Thanks though, I really do appreciate the input. I'm sure ill be using the joystick before long
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Jan 2015 13:17
In DBPro, you could use _ to continue on a new line, doesn't seem to work in AGK.

The problem is that in AppGameKit (like Visual Basic), a carriage return signifies a new line.

In C++, C#, or Java, you use a ;
So in these languages you can split the line as it ignores the carriage return.

Quidquid latine dictum sit, altum sonatur
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 20th Jan 2015 13:29
Unfortunately, BASIC shows its age in actually requiring blocks defined by new lines, rather than by white space. In C it's the \ character that defines a continuation.

Onwards and sometimes upwards
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jan 2015 17:11
I'm pretty sure that if there was enough call for a method of continuing a line it could be easily written into the compiler. It's not a 'requirement' of BASIC (or some relic from a bygone age) that means this has to happen in AppGameKit

Personally I quite like using an end of line semi-colon in C# (as with many other languages) it simplifies the whole thing. Not sure we couldn't add something similar into AppGameKit too if there was call for it but when the language was in its infancy a lot of these sort of options were discussed with the community, not sure if this was one of them...?


Using AppGameKit V2 Tier 1
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 20th Jan 2015 19:10
I shall refrain from pointing out that in Pascal you can do this (apart from splitting a string in the middle) with no need for a continuation symbol.

Onwards and sometimes upwards
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jan 2015 20:06
In return i shall refrain from sighing


Using AppGameKit V2 Tier 1
arnzzz
9
Years of Service
User Offline
Joined: 19th Dec 2014
Location:
Posted: 20th Jan 2015 20:22
Its only a small thing really, Its still been a pleasure to work with AppGameKit when I throw out some of my preconceptions coming from Java, and having no experience with procedural languages

I've spent the first couple days banging my head against the procedural programming style, but I've accepted it now and I'm trying to bring some pseudo Object Orientation to my game making with AppGameKit

@BatVink I must have been looking at DarkBasic code by the sounds of things then

Thanks for the input guys
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 20th Jan 2015 21:08
I added Line Continuation as an enhancement request on the Bug Board on Nov 7th 2011 lol...

Using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2024-05-05 02:16:05
Your offset time is: 2024-05-05 02:16:05