Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Joey, flink, AndrewAMD), 1,226 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Endless Loop in "Clip_Model"... #140292
07/10/07 08:09
07/10/07 08:09
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
ACTION clip_models {

my.shadow = off;//casts a shadow
my.gravity = off;//gravity off or your tree might float away
wait(1);


while(1)
{


if(my.clipped != on && vec_dist(my.x,player.x) <= 500)

{
my.visible = off;
wait(1);
}


if(my.clipped != on && vec_dist(my.x,player.x) >= 501)
{
my.visible = on;
wait(1);
}


}


}




I want to make the entity invisible when so close to it. But I get an endless loop on run in my action I've also tried using:


ACTION clip_models {

my.shadow = off;//casts a shadow
my.gravity = off;//gravity off or your tree might float away
wait(1);


while(1)
{


if(my.clipped != on && vec_dist(my.x,player.x) <= 500)

{
my.visible = off;
wait(1);
}


else
{
my.visible = on;
wait(1);
}


}


}

Re: Endless Loop in "Clip_Model"... [Re: Leaf] #140293
07/10/07 09:09
07/10/07 09:09
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
plz use [code ]tags/[ code]
Code:

ACTION clip_models
{
my.shadow = off;//casts a shadow
my.gravity = off;//gravity off or your tree might float away
wait(1);
while(1)
{
if(my.clipped != on && vec_dist(my.x,player.x) <= 500)
{
my.visible = off;
} else
{
my.visible = on;
}
wait(1);
}
}



julz

Last edited by JulzMighty; 07/11/07 01:26.

Formerly known as JulzMighty.
I made KarBOOM!
Re: Endless Loop in "Clip_Model"... [Re: Leaf] #140294
07/10/07 14:16
07/10/07 14:16
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
While not exactly like what you are after the following may be of some assistance too.
Its tested and works well but not consistantly as expected.

Code:
 function fade_tree()
{
my.scale_x=8;//just my scale values here
my.scale_y=8;
my.scale_z=8;

while(1)
{
my.transparent = on;
my.passable = on;

if(vec_dist(player.x, my.x) < 3000)
{

my.alpha -= 2*time_step;
if (my.scale_x > 3)//more of my scaling stuff
{
my.scale_x += 0.5 * time;
my.scale_y = my.scale_x;
my.scale_z = my.scale_x;
}
}

if(vec_dist(player.x, my.x) > 3000)
{

if(my.alpha < 99)
{

my.alpha += 2*time_step;


if (my.scale_x > 8)//same ol same old
{
my.scale_x =8;
my.scale_y = my.scale_x;
my.scale_z = my.scale_x;
}
}
if(my.alpha > 90)
{
my.transparent = off;
}

}



wait(1);
}
}

action world_tree
{

my.polygon = on;
plant_object();// saves manual placement by leaving in the air
fade_tree();


}



Re: Endless Loop in "Clip_Model"... [Re: Nems] #140295
07/10/07 19:08
07/10/07 19:08
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
Very cool NEM's and thanks I was only missing wait(1); at the end. Now I dont get a loop but it's not working like it should.

Re: Endless Loop in "Clip_Model"... [Re: Nems] #140296
07/10/07 19:29
07/10/07 19:29
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
*deleted

Last edited by Leaf; 07/11/07 01:05.
Re: Endless Loop in "Clip_Model"... [Re: Leaf] #140297
07/11/07 01:06
07/11/07 01:06
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
Code:
 ACTION clip_models {

my.shadow = off;//casts a shadow
my.gravity = off;//gravity off or your tree might float away

wait(1);


while(1){

if(my.clipped != on && vec_dist(my.x,player.x) > 500)
{
my.invisible = on;
wait(1);
}
else {
my.invisible = off;
wait(1);

}




okay the problem now is that it blinks on and off when im outside 500 quants, I just want the entity to stay off. How do I end this ?

Re: Endless Loop in "Clip_Model"... [Re: Leaf] #140298
07/11/07 06:07
07/11/07 06:07
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Code:

while(1)
{
if(vec_dist(my.x,player.x) > 500)
{
my.invisible = on;
} else {
my.invisible = off;
}
wait(1);
}



Not sure why you've to test the "clipped" flag? your code
works fine without it.

Re: Endless Loop in "Clip_Model"... [Re: vlau] #140299
07/11/07 06:10
07/11/07 06:10
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
thanks, that clip flag was bugging it


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

Gamestudio download | chip programmers | 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