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 / Wierd error with using type as parameter

Author
Message
United Calamity
9
Years of Service
User Offline
Joined: 22nd Jul 2015
Location: Canada
Posted: 22nd Jul 2015 03:14
Anyway, I have a type, oPlayer, that I am trying to use as a parameter. So the function looks like

So when I call this function I do

ObjPlayer is declared here


So I am passing a variable, not the type, but I get this error:

when I call the playerFrame function. If you need more code from my project just say so, I'm trying to keep it readable, because I know it's annoying when someone just dumps 50 lines in to a topic and expects an answer.

The code from above is all in different files, but is all linked properly using #include statements.

Does anyone know what this is? Thanks in advance

Gamejolt: http://gamejolt.com/profile/united-calamity/575975
Yaro
10
Years of Service
User Offline
Joined: 29th Mar 2014
Location:
Posted: 22nd Jul 2015 08:35
Is your declaration outside of the function/scope of the actual call? It sounds like you think you have it declared, but it's not.
United Calamity
9
Years of Service
User Offline
Joined: 22nd Jul 2015
Location: Canada
Posted: 22nd Jul 2015 08:55
It's kinda wierd, the whole situation. Here is the player's code:


The function playerStart runs just fine. But when it gets to playerFrame it gives the error. So that would lead me to believe it is not out of scope. Here is where it is used:



In the file Objects.agc the player object is created and started.

Gamejolt: http://gamejolt.com/profile/united-calamity/575975
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Jul 2015 13:19
It cannot find ObjPlayer. Therefore it creates an integer on the fly. that is why you get a type mismatch.

Did you mean to #insert Objects.agc?

#include tags it onto the end of the project. #insert places it exactly where you put the statement.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
United Calamity
9
Years of Service
User Offline
Joined: 22nd Jul 2015
Location: Canada
Posted: 22nd Jul 2015 19:28
Well I ended up fixing it on my own. Insert didn't fix it, it said inserted files can't use #include; and they did.

I removed function main() and endfunction, just using it as plain code and it worked. Thanks for the help though.

Gamejolt: http://gamejolt.com/profile/united-calamity/575975

Login to post a reply

Server time is: 2024-11-25 19:30:31
Your offset time is: 2024-11-25 19:30:31