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.

Author
Message
BEAST
8
Years of Service
User Offline
Joined: 11th Jun 2012
Location: the gamecreators.com
Posted: 21st Jun 2014 20:06
Cannot find structure 'collision:&min' in local declaration at line 2277.
Line 2277 " for iy = y1 to y2"
how can i fix this error

BM Wakeupnow IBO
Lucas Tiridath
AGK Developer
11
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 21st Jun 2014 22:04
I'm not familiar with that error, so maybe someone else will be able to help you more. However as projects get longer, DBP tends to give less and less accurate line numbers with errors. My guess would be that the error is being generated from a different line. Is there anywhere in the surrounding lines where you declare a variable of a UDT? Do the names collision or min mean anything to you?

BEAST
8
Years of Service
User Offline
Joined: 11th Jun 2012
Location: the gamecreators.com
Posted: 21st Jun 2014 23:35
no

BM Wakeupnow IBO
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 22nd Jun 2014 12:28
Can you post 20 lines before and after where that error occurred?

BEAST
8
Years of Service
User Offline
Joined: 11th Jun 2012
Location: the gamecreators.com
Posted: 22nd Jun 2014 18:08
function collision(curValue as integer, amount as integer, direction as integer)

if direction = COLLISION_RIGHT
rem the character's bounding collision box
rem can lie within more than a single tile
rem unless completely aligned with the natural
rem grid of the map. This calculates the range
rem of tiles necessary to check for collision
x2 = min(((_Player.x - MAP_OFFSET_X) + amount + _Player.cx2) / _TileSize + 1, 16)
y1 = max(((_Player.y - MAP_OFFSET_Y) - _Player.cy2) / _TileSize + 1, 1)
y2 = min(((_Player.y - MAP_OFFSET_Y) - _Player.cy1) / _TileSize + 1, 11)

for iy = y1 to y2
rem check if this nearby tile is passable or not
if collisionMap(x2, iy) = STATE_IMPASSABLE OR (collisionMap(x2, iy) = STATE_WATER AND _ShowLadder = 1 AND (_WaterX <> x2 OR _WaterY <> iy))
x = (x2-1)*_TileSize + MAP_OFFSET_X
y = (iy-1)*_TileSize + MAP_OFFSET_Y
if _Player.y - _Player.cy2 < y+_TileSize and _Player.y - _Player.cy1 > y
rem there was a collision
if curValue+amount + _Player.cx2 > x
rem restore x coordinate
_Player.x = x - _Player.cx2
rem provides a small level of sliding when colliding
rem with an object. When the character's path becomes
rem obstructed because it only clipped the edge of an
rem impassable tile, it will gradually align to the
rem natural grid of the map, often allowing the character
rem to slide on past the obstruction.
i = (_Player.y - MAP_OFFSET_Y-8) / 32
r = (_Player.y - MAP_OFFSET_Y-8) - (i*32)

if r > 16 then _Player.y = _Player.y - 1
if r < 16 then _Player.y = _Player.y + 1
exitfunction 1
endif
endif
else
if collisionMap(x2, iy) = STATE_WATER
if _ShowLadder = 0
_ShowLadder = 1
_WaterX = x2
_WaterY = iy
endif
else
_ShowLadder = 0
endif
endif
next iy
rem there was no collision, increment position as normal
_Player.x = curValue + amount
exitfunction 0
endif

if direction = COLLISION_LEFT
x1 = min(((_Player.x - MAP_OFFSET_X) + amount + _Player.cx1) / _TileSize + 1, 16)
y1 = max(((_Player.y - MAP_OFFSET_Y) - _Player.cy2) / _TileSize + 1, 1)
y2 = min(((_Player.y - MAP_OFFSET_Y) - _Player.cy1) / _TileSize + 1, 11)

for iy = y1 to y2
if collisionMap(x1, iy) = STATE_IMPASSABLE OR (collisionMap(x1, iy) = STATE_WATER AND _ShowLadder = 1 AND (_WaterX <> x1 OR _WaterY <> iy))
x = (x1-1)*_TileSize + MAP_OFFSET_X
y = (iy-1)*_TileSize + MAP_OFFSET_Y
if _Player.y - _Player.cy2 < y+_TileSize and _Player.y - _Player.cy1 > y
if curValue+amount + _Player.cx1 < x + _TileSize
_Player.x = x + _TileSize - _Player.cx1

i = (_Player.y - MAP_OFFSET_Y-8) / 32
r = (_Player.y - MAP_OFFSET_Y-8) - (i*32)
if r > 16 then _Player.y = _Player.y - 1
if r < 16 then _Player.y = _Player.y + 1

exitfunction 1
endif
endif

BM Wakeupnow IBO
MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 23rd Jun 2014 12:01


TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jun 2014 15:58
@BEAST - PLEASE post your code in a code snippet. It makes it painful for others because then they have to indent it themselves.

Anyway, here's your problem. You're missing two ENDIFs here:


You should indent your code so this becomes apparent, like this:


See how there are tabs missing where the ENDIF's should be?

Lucas Tiridath
AGK Developer
11
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 23rd Jun 2014 18:42
@Mr. Valentine
Those endifs are actually correct. They are not for the if.. then statements you show, but for ifs earlier in the code.

@TheComet
I'm afraid I disagree. I think you've indented after a couple of if.. then statements which is why you have found two endifs to be missing. However in fact, those should not be intended. Therefore I think the proper indentation is actually more like this.


Now clearly, this code ends mid way through, but nonetheless, I don't think that missing endifs are the problem.

@BEAST
First off, I second TheComet in asking you to use the code tags around your code. It definitely makes our lives easier. Second, I don't mean to be nasty about this, but I asked you
Quote: "Is there anywhere in the surrounding lines where you declare a variable of a UDT? Do the names collision or min mean anything to you?"

to which you responded
Quote: "no"

And yet, the first line of the code you post is

and nine lines in, we find this

We are trying to help you here, but surely you can see that your answer was less than helpful!!

Anyhow back to the problem in hand. I had a quick search around for errors like these, and it appears that they are usually the result of the parser getting muddled between functions and data. Clearly the problems are to do with the functions min and collision. So the questions I would ask are:
1. Do your functions all come after the end of the rest of your code?
2. Which version of the compiler are you using? I believe there were some issues in older versions.
3. Are you sure that the names collision and min are ONLY used for these functions, and that there are no variables or UDTs defined with the same names?
4. Where are the definitions of min and max in relation to collision? Could it be that a function defined earlier is not properly closed with an endfunction statement?

Also, may I ask where you got the code? Did you write it? Because if so, I'm assuming that you didn't just write over 2277 lines straight off. You must have done builds before, right? In which case what did you change since the last successful build? If on the other hand you got the code from somewhere else, could you tell us where so we could try compiling it ourselves?

I hope that offers some leads. Do let us know if any of those are possible.

MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 23rd Jun 2014 18:57
Ah If Then...

Did not look at them properly... Need food...

BEAST
8
Years of Service
User Offline
Joined: 11th Jun 2012
Location: the gamecreators.com
Posted: 25th Jun 2014 01:56
thank everyone for the help

BM Wakeupnow IBO

Login to post a reply

Server time is: 2020-08-03 16:30:00
Your offset time is: 2020-08-03 16:30:00