|
problem when call function with more one parameter
#182876
02/09/08 09:57
02/09/08 09:57
|
Joined: Jul 2007
Posts: 69
fat32
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2007
Posts: 69
|
hi problem when call function with more one parameter.Below code for example
thank's ___________________________________________________________________________ function main{ level_load("test.wmb"); video_switch(7,32,2); fps_max=70; while(1){ wait(1); text_func(100,100,0);//problem point } }
text test_txt{ flags=visible;string="this is a test"; } function text_func(&posx ,&posy, &vis){ while(1){ test_txt.pos_x=posx; test_txt.pos_y=posy; if(vis==0){test_txt.visible=off;} else {test_txt.visible=on;} } }
dobidob hosein_dig and max_man7000 game HAPPY NEW YEAR !!
|
|
|
Re: problem when call function with more one parameter
[Re: fat32]
#182877
02/09/08 12:47
02/09/08 12:47
|
Joined: Mar 2006
Posts: 2,758 Antwerp,Belgium
frazzle
Expert
|
Expert
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
|
Mind that when using '&' as a sufix in combo with the parameter, that it must be adressed as vector. Thus when declaring this, you must make sure that you declared it as a vector or sort like  Cheers Frazzle
Antec® Case Intel® X58 Chipset Intel® i7 975 Quad Core 8 GB RAM DDR3 SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB NVIDIA® GeForce GTX 295 Memory 1795GB
|
|
|
Re: problem when call function with more one parameter
[Re: frazzle]
#182878
02/10/08 09:52
02/10/08 09:52
|
Joined: Jul 2007
Posts: 69
fat32
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2007
Posts: 69
|
hi but i can not understand.please tell me more
tnx
dobidob hosein_dig and max_man7000 game HAPPY NEW YEAR !!
|
|
|
Re: problem when call function with more one parameter
[Re: fat32]
#182879
02/10/08 13:24
02/10/08 13:24
|
Joined: Feb 2008
Posts: 337
Vadim647
Senior Member
|
Senior Member
Joined: Feb 2008
Posts: 337
|
use function text_func(posx ,posy, vis) for Var's and function text_func(VECTOR* vec1 ,VECTOR* vec2,vis) for Vectors
I switched to other account since marth 2010. Guess which.
|
|
|
Re: problem when call function with more one parameter
[Re: Vadim647]
#182880
02/10/08 13:53
02/10/08 13:53
|
Joined: Mar 2006
Posts: 2,758 Antwerp,Belgium
frazzle
Expert
|
Expert
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
|
I can't confirm that Vadim647 his solution is correct since I don't know LC that well but I think I need clair something out about it. Variables (var) can hold data which are mostly numbers. Which data it can store, depends on the way you declare it. -Scalar type: var speed = 10; -Array type: var speed[5] = { 0, 10, 30, 50, 70}; // you can adress each value by calling the corresponding index. -Vector type: var direction[3] = 200,100,20; // mostly vectors are used for x,y and z dimension -And more types ... Anyway, what I ment with my explanation is something the manualy can explain nicely  Quote:
// quoted from the 3dgs A6 manual function vector_add2(&sum,&v1,&v2) { // calculate the sum of two vectors sum[0] = v1[0] + v2[0]; sum[1] = v1[1] + v2[1]; sum[2] = v1[2] + v2[2]; }
var vector1[3] = 1,2,3; var vector2[3] = 4,5,6; var vector3[3]; ... vector_add2(vector3,vector1,vector2); // vector3 now contains 5,7,9
Thus, when using a text, you mostly won't be using vectors to adress them but just via scalars. Simply put, you don't need a & for putting through a position for a text since I assume you didn't adressed it as a vector here 
Cheers
Frazzle
Antec® Case Intel® X58 Chipset Intel® i7 975 Quad Core 8 GB RAM DDR3 SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB NVIDIA® GeForce GTX 295 Memory 1795GB
|
|
|
Re: problem when call function with more one parameter
[Re: frazzle]
#182881
02/10/08 16:37
02/10/08 16:37
|
Joined: Jul 2007
Posts: 69
fat32
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2007
Posts: 69
|
thank u "frazzle" very much. i think parameter when call function is variable but i know must use by array(vector)
tnx
hosein_dig (fat32)
dobidob hosein_dig and max_man7000 game HAPPY NEW YEAR !!
|
|
|
|