Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by Grant. 02/24/26 22:21
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
5 registered members (TipmyPip, clint000, Grant, chsmac85, Martin_HH), 5,858 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Was C-Script honestly this.. strict? #171302
12/05/07 18:56
12/05/07 18:56
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline OP
Rabbit Developer
Inestical  Offline OP
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
Am I not able to give in two arrays of four values to an C-Script function?

on_l addExp(enemyArray, playerArray); //Phails, whines about too many values


"Yesterday was once today's tomorrow."
Re: Was C-Script honestly this.. strict? [Re: Inestical] #171303
12/05/07 19:37
12/05/07 19:37
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
Try calling the function thru the console. I think the error is from the 'on_l' part (because for example on_1 passes automaticaly "1" to the function...or was it "0"? )


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Was C-Script honestly this.. strict? [Re: EpsiloN] #171304
12/05/07 19:53
12/05/07 19:53
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
it's

on_l = addExp;

No parameters at all as you're assigning a pointer!!!

Re: Was C-Script honestly this.. strict? [Re: FBL] #171305
12/05/07 22:29
12/05/07 22:29
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline OP
Rabbit Developer
Inestical  Offline OP
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
bah it still whines about too many values:

function addExp(var enemyArray[4], var playerArray[3])
-> Syntax Error: addExp - Too many parameters


"Yesterday was once today's tomorrow."
Re: Was C-Script honestly this.. strict? [Re: Inestical] #171306
12/05/07 22:47
12/05/07 22:47
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
The correct syntax for having arrays as parameters in C-Script is:

function addExp(&enemyArray, &playerArray) {
...
}

Re: Was C-Script honestly this.. strict? [Re: Fenriswolf] #171307
12/07/07 17:59
12/07/07 17:59
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline OP
Rabbit Developer
Inestical  Offline OP
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
Oh yes, I forgot about that.

Now, why is this not working?

function addExp(&enemyArray, &playerArray)
{
var enemyLvl = enemyArray[0];
var enemyHlth = enemyArray[1];
var enemyStr = enemyArray[2];
var enemyDef = enemyArray[3];

var playerLvl = playerArray[0];
var playerStr = playerArray[1];
var playerDef = playerArray[2];


"Yesterday was once today's tomorrow."
Re: Was C-Script honestly this.. strict? [Re: Inestical] #171308
12/07/07 21:16
12/07/07 21:16
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Probably you'll have to do it the inconvenient way in C-Script:

var enemyLvl;
enemyLvl = enemyArray[0];
[...]

Last edited by Fenriswolf; 12/07/07 21:16.
Re: Was C-Script honestly this.. strict? [Re: Fenriswolf] #171309
12/08/07 18:47
12/08/07 18:47
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
You can assign numbers to a variable in a function :
Code:

var test = 32;


But you cant directly assign other arrays to a definition of a new variable.


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201

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