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 / Function parameter error?

Author
Message
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th May 2004 01:28
I'm pretty new to DBPro (but not to programming) and was a little surprised to see this error message when I was debugging.

#100008: Parameter for 'GetAngle' do not match 'float' at line 2

It seems to be complaining about this: -

function GetAngle(X1#,Z1#,X2#,Z2#)
angle# = atanfull((X2# - X1#),(Z2# - Z1#))
endfunction angle#

which I am accessing through this: -

angle# = GetAngle(tTarget.X#, tTarget.Z#, tPlayer.X#, tPlayer.Z#)

tPlayer being a Type of this: -

type Entity
float X#
float Y#
float Z#
integer LegsObjNum
integer TorsoObjNum
float LegsAngle#
float DirectionAngle#
float TorsoAngle#
endtype

At first I thought the IDE was just being pissy, but I get the same error in Twilight too. I don't get it if I comment out the GetAngle function and the stuff that references it.
Little help? Be cruel if you have to - I'm new and stupid at this langauge (and 3D programming in general)
I can post the entire code if need be. I've got the latest IDE patch and the latest Update, if that helps at all.

Thanks.

www.tronsoftware.co.uk
AMD Athlon XP 1700+, 180GB HDD, 512MB DDR RAM, ATI Radeon 9700 Pro 128MB DDR, Windows XP Pro, DirectX 9.0b
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th May 2004 01:43 Edited at: 8th May 2004 01:44
you using angle# twice, is it Global?
try changing one of the two var names, like the one in the fucntion, call it test# or something just to see


* DBP_NETLIB_v1 - VB.NET PLUGIN FOR DBP * Click Logo
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th May 2004 01:45
Maybe you should post your GetAngle function definition ... and make sure you don't have it defined twice

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th May 2004 02:29
CattleRustler: Good thinking about the angle# variable name. I hadn't spotted that. I changed the local variable within the GetAngle() function to myAngle#, but no joy. Still the same error.

IanM: The GetAngle() function is listed above in my OP. I've checked and I definitely don't have it defined twice.

I've posted the entire code (clicky on Source button)....perhaps someone could have a look?
I've had this problem before when using Types within DBPro. Could it be something to do with that?

BTW, try to ignore the huge kludge that is the ProcessEntityDirection() function. Its reasonably clear from the code what it does....if anyone feels the burning need to tidy it up for me, feel free. It truely is a terrible bit of coding (and doesn't even work all that well) but it was the best I could come up with.

Thanks folks.

www.tronsoftware.co.uk
AMD Athlon XP 1700+, 180GB HDD, 512MB DDR RAM, ATI Radeon 9700 Pro 128MB DDR, Windows XP Pro, DirectX 9.0b
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 8th May 2004 03:48
Well this is bloody weird!

Have spent half an hour rewriting code, changing the types to be defined properly (your way is very wrong)

type Entity
X as float
Y as float
Z as float
LegsObjNum as integer
TorsoObjNum as integer
LegsAngle as float
DirectionAngle as float
TorsoAngle as float
endtype

then changed all the variable in program to use these. Still wont work.

Found you missed variable name of NEXT command, should be

NEXT Looking_for_bullets

this would stop compilation as well.

still no joy!

f you comment out the big IF stuff in controlplayer:, then it compiles, but why???

Boo!
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th May 2004 04:09
I know.....I've been banging my head against it for ages tonight too. No joy so far.

Just to clarify, to define variables of certain datatypes you define as "someVariable as float" or whatever with the type definition and so don't need to use the # to indicate its datatype. If you are declaring globals, it would be "global someVariable# = 0.0". What about local variables within functions? "local someVariable# = 0.0"?

Grrr....frustrating stuff. It doesn't help that the IDE doesn't even point to where the error is!

www.tronsoftware.co.uk
AMD Athlon XP 1700+, 180GB HDD, 512MB DDR RAM, ATI Radeon 9700 Pro 128MB DDR, Windows XP Pro, DirectX 9.0b
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th May 2004 04:21
Spooky: Heres what I have so far according to your advice about how to set up the types. I can get it to compile some of the time, but in debug mode it always complains about the same error *after* exiting the program and returning to the IDE. Weird.

www.tronsoftware.co.uk
AMD Athlon XP 1700+, 180GB HDD, 512MB DDR RAM, ATI Radeon 9700 Pro 128MB DDR, Windows XP Pro, DirectX 9.0b
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th May 2004 04:49
Quote: "If you are declaring globals, it would be "global someVariable# = 0.0""


not necessarily

Global SomeVar as Float=0.0

will compile and run


* DBP_NETLIB_v1 - VB.NET PLUGIN FOR DBP * Click Logo
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th May 2004 05:20
Okay. I'll use that way in order to be consistent with the types definition. Still, the problem remains. I can get it to compile, but I still get the same error after exiting the program. Doesn't exactly fill me with confidence that I want to commit to a game on this.

...although, obviously if its "humman error" ie = my fault....I'm going to look a little silly.

www.tronsoftware.co.uk
AMD Athlon XP 1700+, 180GB HDD, 512MB DDR RAM, ATI Radeon 9700 Pro 128MB DDR, Windows XP Pro, DirectX 9.0b
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th May 2004 05:22
Spooky: Here is my current code. Perhaps this will help you a little by getting rid of some of the more obvious mistakes. I've given up for tonight....off to bed.

www.tronsoftware.co.uk
AMD Athlon XP 1700+, 180GB HDD, 512MB DDR RAM, ATI Radeon 9700 Pro 128MB DDR, Windows XP Pro, DirectX 9.0b
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 8th May 2004 05:34
Passing types into fuctions is buggy.
http://www.thegamecreators.com/?m=forum_view&t=17874&b=15

It's best not to pass types into functions.

If you change the the ProcessEntityDirection() function so it uses the global tplayer it compiles fine.

see atttached code.

i won't see you in the pit
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th May 2004 16:11
Thanks the_winch - I didn't know that. Jeez.....does *nothing* work properly in DBPro? <sigh>

www.tronsoftware.co.uk
AMD Athlon XP 1700+, 180GB HDD, 512MB DDR RAM, ATI Radeon 9700 Pro 128MB DDR, Windows XP Pro, DirectX 9.0b
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th May 2004 18:37
our plugin does
click logo below


* DBP_NETLIB_v1 - VB.NET PLUGIN FOR DBP * Click Logo

Login to post a reply

Server time is: 2024-09-22 08:40:13
Your offset time is: 2024-09-22 08:40:13