Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (AndrewAMD), 3,675 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Code crash game! What's wrong? #368811
04/28/11 16:12
04/28/11 16:12
Joined: Apr 2011
Posts: 12
Sweden
L
Linus371 Offline OP
Newbie
Linus371  Offline OP
Newbie
L

Joined: Apr 2011
Posts: 12
Sweden
When I run my game it works first, But after a while I get this error:
Quote:

Error E1513
Script crash in goal: SYS


I don't understand that error! shocked
This is the code that's in the action goal:
Code:
action goal(){
	var range=10;
	while(1){
		if (playerCar.x>my.x-range && playerCar.x<my.x+range){
			level_load("leve2.wmb");
		}
	wait(1);
	}
}


What's wrong? :C

Re: Code crash game! What's wrong? [Re: Linus371] #368821
04/28/11 17:40
04/28/11 17:40
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
it could be that the level_load is executed a frame after it is called.
the engine runs the loop again, and level_load is called 2 times.

you could try this:

Code:
action goal()
{
	var range=10;
	while(1)
	{
		if (playerCar.x>my.x-range && playerCar.x<my.x+range)
		{
			break;
		}
		wait(1);
	}
	level_load("leve2.wmb");
}




Check out the throwing game here: The throwing game
Re: Code crash game! What's wrong? [Re: Roel] #368822
04/28/11 17:55
04/28/11 17:55
Joined: Apr 2011
Posts: 12
Sweden
L
Linus371 Offline OP
Newbie
Linus371  Offline OP
Newbie
L

Joined: Apr 2011
Posts: 12
Sweden
Originally Posted By: Roel
it could be that the level_load is executed a frame after it is called.
the engine runs the loop again, and level_load is called 2 times.

you could try this:

Code:
action goal()
{
	var range=10;
	while(1)
	{
		if (playerCar.x>my.x-range && playerCar.x<my.x+range)
		{
			break;
		}
		wait(1);
	}
	level_load("leve2.wmb");
}


Thanks You Really Much grin

Re: Code crash game! What's wrong? [Re: Roel] #368839
04/28/11 20:03
04/28/11 20:03
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Code:
action goal()
{
	var range=10;
	while(abs(playerCar.x - my.x) > range)
		wait(1);
	level_load("leve2.wmb");
}


That should be a more elegant solution...


Always learn from history, to be sure you make the same mistakes again...
Re: Code crash game! What's wrong? [Re: Uhrwerk] #368840
04/28/11 20:15
04/28/11 20:15
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
which is indeed better, but requires more brainpower... I didn't have grin


Check out the throwing game here: The throwing game
Re: Code crash game! What's wrong? [Re: Uhrwerk] #368872
04/29/11 04:41
04/29/11 04:41
Joined: Apr 2011
Posts: 12
Sweden
L
Linus371 Offline OP
Newbie
Linus371  Offline OP
Newbie
L

Joined: Apr 2011
Posts: 12
Sweden
Originally Posted By: Uhrwerk
Code:
action goal()
{
	var range=10;
	while(abs(playerCar.x - my.x) > range)
		wait(1);
	level_load("leve2.wmb");
}


That should be a more elegant solution...

What does abs do? :S

Re: Code crash game! What's wrong? [Re: Linus371] #368889
04/29/11 08:55
04/29/11 08:55
Joined: May 2010
Posts: 117
Germany , Dortmund
B
Bone Offline
Member
Bone  Offline
Member
B

Joined: May 2010
Posts: 117
Germany , Dortmund


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