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 / gosubs and goto are still ok?

Author
Message
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 27th Dec 2017 16:02
I have bin away for so long but before so did i always use gosubs to create types in external files to make everything clean and collected.
But noticed that gosubs and goto don't seam to be in the commands list anymore?
Is it a old command that will be removed so i know right away before using it to much in my code???
Yes i know its a silly question but better be sure...
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
puzzler2018
User Banned
Posted: 27th Dec 2017 16:06
those are cursed words in the programming world
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 27th Dec 2017 16:09 Edited at: 27th Dec 2017 16:11
Jupp but the only existing workaround to do this



Now do we simply put this after the include command gosub Invaders_Data

And everything runs fine and compiles a lot cleaner


all include files are read at the end and throws you errors if you don't use a gosub with types

I can tell you its neaded in larger projects later on ......
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
puzzler2018
User Banned
Posted: 27th Dec 2017 16:13
I would :-

- Create a new AGC file (which will live besides the main.agc file) call itsomething like "variablesetups.agc" or similar

- Pop your initiasing variables into it what you have here into variablessetup.agc

- At the top of your main.agc file enter #include "variablessetup.agc"

Something along those lines

D
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Dec 2017 16:14
Quote: "all include files are read at the end and throws you errors if "

use #insert
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 27th Dec 2017 16:19
puzzler you did not read my text
It do not work for types and only workaround is gosubs so they are read at the start and not end ....
i have done as you say for all my other stuff but it do not work for types without a workaround..
All types in a include file as a array throws you errors if not in a gosub set at the start of the main file

Will check that markus ....
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 27th Dec 2017 16:21
How do i use the insert command markus?
cant find it in the commands list either?
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
puzzler2018
User Banned
Posted: 27th Dec 2017 16:27
Ahh got ya now

- Use the same method as i describe but use

#insert "setupvariables.agc"

instead of #include
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 27th Dec 2017 16:29
Already tested it
Its a new command since i coded the last time and its wonderfull
I know we had so much problems before in agks early days with large projects
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 27th Dec 2017 22:28
#insert - good to know, I got some old libs that require a initial gosub.
The newer ones dont have that problem, because the Dim XXX[] stuff will be managed on the first creation, if XXX.length=-1

[/url]
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 28th Dec 2017 00:48
Interesting! i use goto to restart my game. Can someone share me the structure to reset the game?Thanks
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 28th Dec 2017 02:39
Quote: "But noticed that gosubs and goto don't seam to be in the commands list anymore?"

Quote: "How do i use the insert command markus?
cant find it in the commands list either?"


Look in ...

Home --> Language

...not

Home --> Commands

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
nonom
7
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 28th Dec 2017 02:44
Quote: "Can someone share me the structure to reset the game?"


A simple state machine that I posted a few day ago https://forum.thegamecreators.com/thread/221174#msg2614888
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 28th Dec 2017 03:09
Thanks conjured i have bin away from coding for to long
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz

Login to post a reply

Server time is: 2024-11-24 03:45:51
Your offset time is: 2024-11-24 03:45:51