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.

Newcomers AppGameKit Corner / [SOLVED] Does AGK Studio Have a Carriage Return Character?

Author
Message
boldpaste2
5
Years of Service
User Offline
Joined: 4th Apr 2019
Location:
Posted: 13th Feb 2020 23:29
Hey guys!

Hope im posting this in the right place. I got what might be "a noob question". Well, I am a noob so for me perfectly appropriate . Surfed the net and guides but could not find what I was looking for.

Here is some pseudo code... Can AppGameKit Studio continue a line of code onto the next link with a special character (I think its called a Carriage Return Character)? I asks this because long conditionals or formulas are kinda difficult to read without it.

Essential... This...
If A = 0 and B = 0 and C = 0 and D = 0 and E = 0 and F = 0 and G = 0 and H = 0 and I = 0

Into this...
If A = 0 and_
B = 0 and_
C = 0 and_
D = 0 and_
E = 0 and_
F = 0 and_
G = 0 and_
H = 0 and_
I = 0

The author of this post has marked a post as an answer.

Go to answer

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 13th Feb 2020 23:52
Chr(13)

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
boldpaste2
5
Years of Service
User Offline
Joined: 4th Apr 2019
Location:
Posted: 13th Feb 2020 23:59
Hmm...

I tried turning this



Into this...



Got this...
Error: Incompatible types "Integer" and "string"

I think I did something incorrectly.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 14th Feb 2020 04:55 Edited at: 14th Feb 2020 04:57
sorry I thought you wanted a string
like A$="line 1"+chr(13)+"line 2"+chr(13)+"line 3"
print (a$)

and you cant separate conditions over multiple lines like that the ide isn't designed for it

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
boldpaste2
5
Years of Service
User Offline
Joined: 4th Apr 2019
Location:
Posted: 15th Feb 2020 00:07
Thanks fubarpk, It would certainly be a nice thing to have though.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 3rd Mar 2020 15:01 Edited at: 3rd Mar 2020 15:06
Quote: "sorry I thought you wanted a string
like A$="line 1"+chr(13)+"line 2"+chr(13)+"line 3"
print (a$)"

Just remember those variable are case sensitive, right?

chr(13) is also very helpful when displaying multiple lines using the Message(a$) command.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Mar 2020 08:58 Edited at: 11th Mar 2020 10:02
This post has been marked by the post author as the answer.
As already stated, the IDE doesn't support concatenated lines. However, in your case you can still do it because your concatenation is with the AND keyword. So you can simply create another IF on the line below which will only be executed if the IF above it is TRUE.
Like this:


You can make that easier to read by pre-creating simplified variable names, like this:


Both of those are good suggestions but in your case I wouldn't recommend either one. Your code is simply checking to see if a point is within a box. So you really should functionise that. Like this:

I simplified the variable names again in the final example above, but that is just for clarity, you don't actually need to do that.

Finally, you can simplify it much further. If you don't have any overlapping sprites or you only ever want to test against the one on top (depth nearest the screen) then you can do this:

Login to post a reply

Server time is: 2024-11-23 09:33:25
Your offset time is: 2024-11-23 09:33:25