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
4 registered members (NewbieZorro, Grant, TipmyPip, AndrewAMD), 12,885 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
I'm stumped, my variables dont work lol #228191
09/18/08 06:08
09/18/08 06:08
Joined: Nov 2005
Posts: 66
Spokane, WA, USA
Vonman Offline OP
Junior Member
Vonman  Offline OP
Junior Member

Joined: Nov 2005
Posts: 66
Spokane, WA, USA
I'm trying to TILE some dirt models to make a ground, instead of doing it with WED, I wanted to make a script that automaticaly generates the tile (for however long or big).

We all know that if you create two or more entities with the same pointer, and you change the xyz cords of the pointer (like thing.x += 10), then everything with the pointer (even if more than one entity) will all move.

This being taken into consideration, I made a global variable called 'placement[3],0,0,0'.

In the ent_create(-----) function, one of the parimeters is the initial position.

ent_create("gndtile.mdl",PLACMENT,NULL);

In the function that I used in order to MODIFY the xyz cords of PLACEMENT[3], which is an outside function, I tryed to modify
my variable so that the NEXT generated tile would pop up
855 quants further down the .X cords.
My modification looked like this.

placement.x += 855;)

When I tryed to run that,
I got an error messege saying,
" 'X' is not a member of 'function' ".



What i'm trying to figure out is WHY I cannot modify placement.x (or .y or .z) from within a function OTHER than the function that created the entity.

It worked before with C-Script, won't work with LC.
placement[3] is a global variable, so it's not like i'm tring to use a local variable that exists within another function in the script.

Last edited by Vonman; 09/18/08 06:12.
Re: I'm stumped, my variables dont work lol [Re: Vonman] #228206
09/18/08 07:50
09/18/08 07:50
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
use VECTOR* placement; instead of placement[3]

ps. if you create entities on same pointer, the pointer will point only the las one you created.

VECTOR* placement = vector(0,0,0);
int tile_count = 0;
while(tile_count>100){
ent_create("tile.mdl",placement,NULL);
placement.x+=855;
tile_count++;
if(tile_count%10 == 0){//move to the next row at 10 tiles(a row will have 10 tile)
placement.y += 855;
}
}


3333333333
Re: I'm stumped, my variables dont work lol [Re: Quad] #228222
09/18/08 09:27
09/18/08 09:27
Joined: Oct 2003
Posts: 702
Z
zazang Offline
User
zazang  Offline
User
Z

Joined: Oct 2003
Posts: 702
remember that LC is case-sensitive so if u use an X instead of x then it will
throw an error.


I like good 'views' because they have no 'strings' attached..
Re: I'm stumped, my variables dont work lol [Re: zazang] #228316
09/18/08 17:33
09/18/08 17:33
Joined: Nov 2005
Posts: 66
Spokane, WA, USA
Vonman Offline OP
Junior Member
Vonman  Offline OP
Junior Member

Joined: Nov 2005
Posts: 66
Spokane, WA, USA
Thanks guys, I just figured it out last night, I just had to go from directly modifying the variable PLACEMENT.X to modifying it with a VEC_ADD instruction.

vec_add(placement,vector(855,0,0));

Now I just have to work around a few weird here-and-there puzzlers and I have just learned to do LC lol


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