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.

DarkBASIC Discussion / Strange function error

Author
Message
snicko
21
Years of Service
User Offline
Joined: 22nd Mar 2004
Location:
Posted: 15th Jul 2005 05:23
I have a funtion that creates an explosion at a specified location wen called with explode(od(c,2),od(c,3),od(c,4),od(c,2),od(c,3),od(c,4),c)
(c is the object number, od(c,2),od(c,3),od(c,4) are the x, y and z locations. The code for the function is

The media is attached.
If you wish to try it you need this at the top of your code

When it try to compile i get 'Syntax error. Parameters differ between function call and declaration'. The strage thing is it only happens in this one function.

Any ideas?

Give in, NEVER

Attachments

Login to view attachments
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 15th Jul 2005 06:09
snicko,

The variables that you pass to the function must be the same type as defined in the function's argument list. You are passing integer values to where real values are defined. So, either make the c array to be a real value, or change the function's perimeter definition variables to be integer.

On a last note, why are you manipulating an array's values by passing them through an argument list? Arrays are naturally global, and can be edited from with-inside a function, without their values being passed to the function through a perimeter list.


+NanoBrain+
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 15th Jul 2005 06:49
don't you need to create the object before you can play with them?

Don't look at my sig!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Jul 2005 10:35
Also, you can't/don't need to pass arrays to a function.

Arrays are global and can be accessed from within a function (one of the idiosyncrasies of Dark Basic).

If you need arrays, just chop all the arrays out of your calling function and the function's header and use the same arrays in the function code it'self and all should be OK!

As NanoBrain said, the variable types have to be the same though.

TDK_Man

Login to post a reply

Server time is: 2025-05-22 19:14:46
Your offset time is: 2025-05-22 19:14:46