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 Studio Chat / [SOLVED] Problem with Gosub "encountered a RETURN statement when not in GOSUB in an line 0"

Author
Message
Dodo105
4
Years of Service
User Offline
Joined: 27th May 2019
Location:
Posted: 27th May 2019 19:49 Edited at: 27th May 2019 20:12
Hello, i have a problem ...
at first, this is my text:


(test):


sooo and if i start my programm now, it just says:
"encountered a RETURN statement when not in GOSUB in an line 0"

and i just dont know what i did wrong... if someone knows my mistake please help me!
thanks.. :lunar2019piginablanket:

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: 27th May 2019 20:17
I just edited your post because you didn't use code tags. code tags make the code much more readable
and they are compulsory. A code tag is used by clicking the Code button at the beginning of your code
and at the end of your code snippet.

the lines


may be where the problem is in one of the included agc text files
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Bored of the Rings
User Banned
Posted: 27th May 2019 20:32 Edited at: 27th May 2019 20:32
A few issues there.... brackets for a gosub, really?
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th May 2019 20:47
Quote: "brackets for a gosub, really?"

well spotted !! (that very well might be the problem)

personally i prefer to not use gosubs at all and go for functions

fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 28th May 2019 05:20
Here's my two cents. I think when fubark edited the post, he didn't realize that the "()" bracketed parts were meant to show that it was a separate agc file.

As for his problem, it's his first Gosub command that is failing. He's attempting to jump to "loader()", when none exist. It should be changed to "loader"
Dodo105
4
Years of Service
User Offline
Joined: 27th May 2019
Location:
Posted: 28th May 2019 15:43
The brackets arent the problem... it still wouldn't work...
and as you probably already noticed, im completly new to this program ... but i have read so often, that the most people use funtcions rather than gosub.
I only have no idea how these works. Maybe someone can rewrite my program with functions.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 28th May 2019 15:59
with functions instead of gosubs


fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Bored of the Rings
User Banned
Posted: 28th May 2019 16:01 Edited at: 28th May 2019 16:03
This post has been marked by the post author as the answer.
code below compiles ok , temporarily commented out the includes as I don't have those.



Brackets were the problem
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Dodo105
4
Years of Service
User Offline
Joined: 27th May 2019
Location:
Posted: 28th May 2019 16:05
okay thanks but now it just says "error: Failed to open file for reading Loader.agc ... why? i didnt do anything with that file, i just copyed your code... :/

DannyD
6
Years of Service
User Offline
Joined: 29th Aug 2017
Location:
Posted: 30th May 2019 03:33 Edited at: 30th May 2019 03:35
I copied the code from@ Bored of the Rings and it compile 100%

Did you remove the character before #include "loader.agc"?



If so, then it can't find the loader.agc file.
Make sure "loader.agc" it is in the project folder

I would also suggest buying one of the Tutorial Guides
"AppGameKit Official Beginners Guide" is very good, and do a bunch of examples, that will give you the basic understanding...

The Forum also have a lot of examples... sometimes a pain to find them with the search, but they are there...

Login to post a reply

Server time is: 2024-04-24 05:08:33
Your offset time is: 2024-04-24 05:08:33