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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,253 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
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 Offline OP
Junior Member
fat32  Offline 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 Offline
Expert
frazzle  Offline
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 Offline OP
Junior Member
fat32  Offline 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
V
Vadim647 Offline
Senior Member
Vadim647  Offline
Senior Member
V

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 Offline
Expert
frazzle  Offline
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 Offline OP
Junior Member
fat32  Offline 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 !!
Re: problem when call function with more one parameter [Re: fat32] #182882
02/10/08 16:48
02/10/08 16:48
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Quote:

thank u "frazzle" very much.
i think parameter when call function is variable but i know must use by array(vector)





Np my friend, this is what this forum is famous for, for very helpful users About the parameters as vector, that's exactly what the quoted exemple show but I'm not sure if it's the best methode when combining it with a text or sort like. Post any of your problems here so other users and myself can help you out

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

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