Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 17,416 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
function with more than 1 parameter? #178855
01/20/08 01:46
01/20/08 01:46
Joined: Dec 2007
Posts: 8
S
scrooge313 Offline OP
Newbie
scrooge313  Offline OP
Newbie
S

Joined: Dec 2007
Posts: 8
Hi,

I am a newbie and have an simple question:

I want to call a function with more than one parameter. I thougt that this code should work. But it didn't :-( :

Code:
  
function createp(a,b){
temp.x=a;
temp.y=b;
...
}

createp(10,50);




I always get the message: "Bad or missing parameter unknown function"

But when I call createp with only one parameter it works.

Code:
 create(10); 



What is wrong with my code?

Thanks for yours answers.

Greetings,
scrooge313

Last edited by scrooge313; 01/20/08 01:47.
Re: function with more than 1 parameter? [Re: scrooge313] #178856
01/20/08 02:15
01/20/08 02:15
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
If youre programming lite-c, then you need to declare a type for each parameter, e.g. int, double, var, PANEL*.

Code:

function createp(var a, var b){
temp.x=a;
temp.y=b;
...
}

createp(10,50);



Should work. Be aware though that in lite-c, temp is not declared, and you need to do so by yourself.
Code:
VECTOR temp;




Click and join the 3dgs irc community!
Room: #3dgs
Re: function with more than 1 parameter? [Re: Joozey] #178857
01/20/08 02:29
01/20/08 02:29
Joined: Dec 2007
Posts: 8
S
scrooge313 Offline OP
Newbie
scrooge313  Offline OP
Newbie
S

Joined: Dec 2007
Posts: 8
Thanks for answering.

I tried this in lite-c and c-script.

It's still the same problem.

I can't call a function with more than one parameter.

I tried this and it doesn't work
Code:
function createp(var a, var b){
temp.x=a;
temp.y=b;
...
}

createp(10,50);




But curiously it works with with one parameter when calling the function which is declared with two parameters.
Code:
function createp(var a, var b){
temp.x=a;
temp.y=b;
...
}

createp(10);





Last edited by scrooge313; 01/20/08 02:30.
Re: function with more than 1 parameter? [Re: scrooge313] #178858
01/20/08 02:44
01/20/08 02:44
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
I have had such a problem as well when I was still scripting in c-script, but that was because I called the function before I defined it:
Code:

test(55, 6);
...

function test(par1, par2) {
...do stuff;
}



When using 1 parameter, you can call a function that is defined later on, but when you want to use more parameters, you had to prototype the funcion before calling it:

Code:

function test(par1, par2);
...

test(55, 6);
...

function test(par1, par2) {
...do stuff;
}



Though your example does not shows a problem, maybe this example is not identical to your real code? The problem seems exactly the same...
Can't find the thread anymore where this problem was explained, grr.


Click and join the 3dgs irc community!
Room: #3dgs
Re: function with more than 1 parameter? [Re: Joozey] #178859
01/20/08 02:58
01/20/08 02:58
Joined: Dec 2007
Posts: 8
S
scrooge313 Offline OP
Newbie
scrooge313  Offline OP
Newbie
S

Joined: Dec 2007
Posts: 8
Thank you very much, Joozey!!

With your information I could solve the problem.

I called the function before it was declared ;-)

Regards,
scrooge313


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1