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 DBPro Corner / User Function Compilation (syntax) error

Author
Message
martianxx
13
Years of Service
User Offline
Joined: 19th Feb 2011
Location:
Posted: 12th Jun 2011 18:39
I am not sure where the syntax error is here. I am using tile studio to generate code for my levels (tile studio link: Tile Studio) Here is the code in question:



And the error I recieve is as follows:

Compiling Project...
User function declaration must use no spaces, no numerical first character and include a set of brackets at line 134.
Compilation Failed(Syntax Errors)

If you know what the problem is could you explain. Also why does the compiler use line 134 in the error text and then highlight line 66? Thanks in advance. David
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Jun 2011 19:30
You need to remove the space between the function name and the parentheses

Function MapHeight(map)

If you have multiple dba files in you project, then that is where the line number will be getting skewed.

martianxx
13
Years of Service
User Offline
Joined: 19th Feb 2011
Location:
Posted: 12th Jun 2011 21:26
Thanks for the quick reply, that sorted the problem, unfortunatly I have another problem. The code runs but gets stuck in a Do, While loop and I can't work out why. Here is the code, in debug mode "sx" gets stuck at 250 and then doesnt seem to increase...



the tile width is 32 and so sx should be geting increased by 32 each loop. the x/y offset will be 0 in debug mode as they are values passed in after being evaluated based on user key input left, right up and down arrows. ie x-offset is increased when the user holds the right arrow. I have attached the files with this. As i said I am just trying to get this to work so i can then implement it.

Attachments

Login to view attachments
martianxx
13
Years of Service
User Offline
Joined: 19th Feb 2011
Location:
Posted: 13th Jun 2011 02:31
Hmm found the problem after far too long debugging that loop only to see that i used this command:

Load Image "graphics\Tiles1.bmp", Tiles1Bitmap, 1

to try and load image called:

Tiles1.png

Login to post a reply

Server time is: 2024-11-22 22:17:32
Your offset time is: 2024-11-22 22:17:32