Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
About "Level_load" ?? #400430
04/30/12 18:36
04/30/12 18:36
Joined: May 2010
Posts: 37
AMIR_REZAs Offline OP
Newbie
AMIR_REZAs  Offline OP
Newbie

Joined: May 2010
Posts: 37
Hello

I try to load my second level by "level_load"
my code:

Code:
function Golevel(){
			level_load("2.wmb"); 
}

action player_action()
{
	while(1)
	{
		if(score <= 0){
			
			set(last_txt,SHOW);
			media_stop(f_m);
media_play("robot 7.wav",NULL,170);			
			wait(-3); 
Golevel();   
			
			
			} 

		wait(1);
	}
}




but it crashed in "player_action" code ....How can I solve this problem?

thanks.

Re: About "Level_load" ?? [Re: AMIR_REZAs] #400432
04/30/12 18:43
04/30/12 18:43
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
You are using a while(1).
It will never end and when you delete the ent via level_load there is an empty pointer.
Try while(me)

Re: About "Level_load" ?? [Re: Ch40zzC0d3r] #400434
04/30/12 19:24
04/30/12 19:24
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
You could make the code more readable by promoting the condition up into the while loop:

Code:
action player_action()
{
	while(score > 0)
		wait(1);


	set(last_txt,SHOW);

	media_stop(f_m);
	media_play("robot 7.wav",NULL,170);	

	wait(-3); 
	Golevel();
}



(For code readability your goal should always be to nest as narrowly as possible)


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: About "Level_load" ?? [Re: WretchedSid] #400445
05/01/12 09:56
05/01/12 09:56
Joined: May 2010
Posts: 37
AMIR_REZAs Offline OP
Newbie
AMIR_REZAs  Offline OP
Newbie

Joined: May 2010
Posts: 37
I tested while(me) but it didn't work.... confused


Last edited by AMIR_REZAs; 05/01/12 10:15.
Re: About "Level_load" ?? [Re: AMIR_REZAs] #400449
05/01/12 10:45
05/01/12 10:45
Joined: May 2010
Posts: 37
AMIR_REZAs Offline OP
Newbie
AMIR_REZAs  Offline OP
Newbie

Joined: May 2010
Posts: 37
Crashing has been solved but I want to kill all my level1 scripts after that.
And import my new scripts and level?

thanks

Re: About "Level_load" ?? [Re: AMIR_REZAs] #400494
05/02/12 09:47
05/02/12 09:47
Joined: May 2010
Posts: 37
AMIR_REZAs Offline OP
Newbie
AMIR_REZAs  Offline OP
Newbie

Joined: May 2010
Posts: 37
plz help me...

Re: About "Level_load" ?? [Re: AMIR_REZAs] #400510
05/02/12 15:33
05/02/12 15:33
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
You don`t can "kill" your script and load a new one if you change the level. You have to do all in one script.


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