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 / Is it possible to run code from an included .agc when its called to keep the variables in main memory?

Author
Message
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 23rd Mar 2019 00:04
Just want to run code out of main before the main do loop. Trying to better organize things and have less globals with this project.

I am not sure how to run code that is not in the main.agc file unless a function is called. I swore I read there is a way to do this, but my search-fu is a fail. Thanks.
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd Mar 2019 00:59
I think functions would be the best way to do that.
Having said that, #insert "filename.,agc" will insert the file at the line where the #insert declaration is so you could chop up your code like that
fubarpk
Moderator
14
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 23rd Mar 2019 01:02
if you want to execute code outside of main
you could use do something like this






fubar
Golelorn
2
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 23rd Mar 2019 02:25
Thanks, guys.

Login to post a reply

Server time is: 2019-07-18 01:51:43
Your offset time is: 2019-07-18 01:51:43