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 / Compiler Issue

Author
Message
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 18th Sep 2016 18:24
I am getting a series of error messages when I compile my code that indicates a token (in this case "as") that is present in some lines of my code. That token is not there. I have run into this problem before with the AppGameKit IDE, and the solution was to re-key or cut and paste the code back in place (often pasting into and back out of a plain text editor). This time nothing works; the compiler is reporting a large block of code as having the same non-existent token; my code won't compile. Help!
Bob
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 19th Sep 2016 09:53
do you have a screenshot, line nr and source there?

may you can use remstart remend to hide blocks for the compiler to find the origin, or check mistake in writing.
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 19th Sep 2016 13:25
Screenshot attached. As you can see, a number of variables contain the letters "as"; I tried changing those to something else, but it made no difference.

Last night I went to the document menu and set "Convert and Set to CR (Mac)" to the code (I'm working on a Mac). That cleared up the token error message, and then created new ones such as "function declaration without end function" All these error messages are bogus.
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 19th Sep 2016 13:44
Have you recently updated to AppGameKit 2.0.21? And if so, did you do a fresh install either by removing the old version, or installing to a new location? Might be unrelated, but there have been a few posts of similar issues recently, all were resolved by doing a clean/fresh install... FWIW I always install any updates to a new path location (I just affix the version number on the end) - I currently have about 5 AppGameKit versions installed on my machine lol... I need to have a clean up
Using AppGameKit V2 Tier 1
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 19th Sep 2016 13:56
I don't know if I can install to a new location - I am running AppGameKit through Steam. Is there any way to do that?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 19th Sep 2016 17:34
i not see a attachment.
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 19th Sep 2016 17:39
Attached

Attachments

Login to view attachments
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 19th Sep 2016 18:44
Just re-installed AppGameKit from Steam, but no change in status
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 20th Sep 2016 02:13
Is Tank defined as global?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 20th Sep 2016 07:15
try using
#option_explicit
once at top, i think this will help you

or maybe you have a mix of line breaks and the compiler misunderstand, i had once in past.
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 20th Sep 2016 09:11
Try replacing

with

or simply (if #Option_Explicit is off.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 20th Sep 2016 09:56
Or maybe it is the difintion of the x and y arrays causing the compiler to go wobbly. Try replacing:

x as integer[PlayerForce]

with

x as integer[] : x.length = PlayerForce

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 20th Sep 2016 14:21
I tried the code changes suggested above, but no dice. I don't think the structure of the code is the issue here. At this point I was able to get the code to compile by converting carriage returns to"Convert and Set to CR (Mac)" , and adding an empty comment to the top of the document. But now the AppGameKit Player crashes immediately following the code compile.

I am at my wits end.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 20th Sep 2016 14:49 Edited at: 20th Sep 2016 14:50
hmm,
if it is ok for you, zip the code folder (attach here) and we can try it at windows pc first.
an home i have also a mac mini.
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 20th Sep 2016 17:34
OK, project is attached.

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Sep 2016 01:14
Compiles fine for me. i get a "Tried to run a program without any instructions message" when i tried to run it but it compiled fine.
What version of AppGameKit do you have?
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 21st Sep 2016 02:27
the latest - 2.0.21. Compiles now, but won't run (quits unexpectantly).
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Sep 2016 05:18 Edited at: 21st Sep 2016 05:22
Very very weird! I included the other files so i had one main.agc and no other files.
I got a compiler error;
main.agc:445: error: Unexpected token "as"

Even if i commented out the block of code i still got the error.

my hunch is it has to do with the lines;
#constant Tank as tankType[ALLTanks]
#constant target as targetType[ALLTanks]
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Sep 2016 08:59
Quote: "#constant Tank as tankType[ALLTanks]
#constant target as targetType[ALLTanks]"


Yes!
#constant replaces the second token with the rest of the line.

So after compilation, all occurrences of the word 'Tank' are replaced with ' as tankType[ALLTanks]' and all occurrences of the word 'target' are replaced with ' as targetType[ALLTanks]'

You shouldn't use a constant to set a global array value anyway! You should use the keyword global, for example:
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 21st Sep 2016 12:36
+ its more handy if you put all your globals into a type/udt/struct

i am unsure if u need = at #constant or not
the Syntax said not
#constant name value
Quote: "
#constant ALLTanks 6
#constant AIForce = 4
"

AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Sep 2016 12:46
Quote: "i am unsure if u need = at #constant or not"

No, #constant doesn't need the '=' sign.
Quote: "#constant ALLTanks 6"

This is correct.
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 21st Sep 2016 13:20
It was never my intention to use constants as arrays. i screwed up! Anyway, thanks everyone for finding this. Couldn't have done it without you!
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Sep 2016 13:44

Login to post a reply

Server time is: 2024-11-25 01:39:59
Your offset time is: 2024-11-25 01:39:59