Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (degenerate_762, AndrewAMD), 877 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
2(script-)problems #170461
12/01/07 17:44
12/01/07 17:44
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
hello,
I tried a lot around and I'm not able to solve this problems.
The first one is a little function that _should_ spawn entities in one line from one position to another one.

Code:
unction felsSpitzen(VECTOR* startPos,VECTOR* endPos)
{
VECTOR tempPos;
VECTOR addPos;
vec_set(addPos,endPos);
vec_sub(addPos,startPos);
vec_normalize(addPos,50);
vec_set(tempPos,startPos);
while(vec_dist(tempPos,endPos)>25)
{
ent_create("felsen.mdl",tempPos,felsMoveOut);
vec_add(tempPos,addPos);
wait(-random(0.05));
}
}



it spawns them correctly, but it don't stop spawning them, if they reached the end-position.If i comment out the wait() everything works property.

My second problem is, that a function(main) I use to check if a key is pressed is closed if I call another function.
I left out all unimportant parts. If I comment out the ent_remove everything works fine.
Code:
function flash_func()
{
set(my,BRIGHT | TRANSLUCENT);
my.alpha = 100;
while(my.alpha>0)
{
my.alpha -= 7*time_step;
wait(1);
}
ent_remove(me);
}

function spawn_flash(VECTOR* position)
{
me = ent_create("lightning2.tga",position,flash_func);
}

int main()
{
[...]
while(1)
{
if(key_l)
{
spawn_flash(nullvector);
while(key_l){wait(1);}
}
wait(1);
}
return 0;
}



Last edited by Scorpion; 12/02/07 10:17.
Re: 2(script-)problems [Re: Scorpion] #170462
12/01/07 18:31
12/01/07 18:31
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
int main()
{
var cr;
[...]
while(1)
{
if(key_l == 1 && cr ==1)
{
spawn_flash(nullvector);
cr =0;
}
if(key_l == 0)
{
cr =1;
}

}
wait(1);
}
return 0;
}


"empty"
Re: 2(script-)problems [Re: flits] #170463
12/01/07 22:00
12/01/07 22:00
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
that really does not solve the problem.
All in all the mainfunction works, it also calls the funtion if i press l, the problem is, that it is killed after that.

If i call any other function it works without any problems.

EDIT: I found out, that the first Problem doesn't occur, if I comment out the wait()..

Last edited by Scorpion; 12/02/07 10:16.
Re: 2(script-)problems [Re: Scorpion] #170464
12/02/07 10:59
12/02/07 10:59
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline
User
RedPhoenix  Offline
User
R

Joined: Jan 2007
Posts: 651
Germany
you move the creator with 50 per wait unit, but your vec_dist searches only in an range of 25. This COULD cause the problem, if the creator has an 25dividable distance to the endpos.

Re: 2(script-)problems [Re: RedPhoenix] #170465
12/02/07 12:46
12/02/07 12:46
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
nope, that is correct. The distance can be just as half big as the distance to move. When I set it to 50 it still don't work... and like i said already: it works great if I don't use the wait()

Re: 2(script-)problems [Re: Scorpion] #170466
12/02/07 16:03
12/02/07 16:03
Joined: Mar 2007
Posts: 75
Hamburg, Ger
Altimeter Offline
Junior Member
Altimeter  Offline
Junior Member

Joined: Mar 2007
Posts: 75
Hamburg, Ger
-just for debugging: try to replace
wait(-random(0.05));
by
wait(1);
or by
wait(-0.05);
does it work?
-how many entities are created, when you comment the wait(...) out?
Is it as much as expected or are that many, but at the same place?

Re: 2(script-)problems [Re: Altimeter] #170467
12/02/07 16:30
12/02/07 16:30
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
oh my god, its really weird today, my SED went crazy, it saves files not or just in parts. My WED compiles the level just sometimes. and this 1. problem was solved by itsself, but there is still the other one left... but still thank you for the help from you already

EDIT: i found a walk-around for the 2. problem. I used the you-pointer instead of "my" but i don't see i reason why that is necessary...

SO the Problems are gone..also if i don't know why...thank you for the time you spend on that thread, wihs me luck that they don't appear again :S

Last edited by Scorpion; 12/02/07 16:56.

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