Gamestudio Links
Zorro Links
Newest Posts
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
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
0 registered members (), 806 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Taschenlampensript Problem A8 #343983
10/12/10 16:47
10/12/10 16:47
Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
White_Wolf Offline OP
User
White_Wolf  Offline OP
User

Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
Hi,

Ich habe ein Problem mit folegnden Script. Es handeltr sich um ein Script für eine Taschenlampe.
Code:
var light_on = 0;

function light_toggle()
{
	
	if(light_on == 0)
	{
	light_on = 1;
	return;
 	}
	else
	{
	light_on = 0;
	return;		
	}
}

action flashlight_pickup()
{
	while (player == NULL) {wait (1);}
	set(my,PASSABLE);	
	while (vec_dist (player.x, my.x) > 100) {wait (1);}
	set(my,INVISIBLE);
	vec_set(my.blue,vector(255,255,170));
	set(taschl100_pan,SHOW);
	reset(taschl75_pan,SHOW);
	reset(taschl50_pan,SHOW);
	reset(taschl25_pan,SHOW);
	reset(taschl0_pan,SHOW);
	set(TaschenLampe_str,SHOW);
	wait(-16*zeit);
	reset(TaschenLampe_str,SHOW);
	
	on_f = light_toggle();
	while (1)
	{
		while (energy > 0 && light_on == 1) // press the "F" key to use the flashlight
		{
			my.lightrange = 150;
			temp2.x = max_dist * cos(player.pan) * cos(camera.tilt) + player.x;
			temp2.y = max_dist * sin(player.pan) * cos(camera.tilt) + player.y;
			temp2.z = max_dist * sin(camera.tilt) + player.z;
			//trace_mode = IGNORE_MODELS + USE_BOX;
			my.skill1 = c_trace (player.x, temp,IGNORE_MODELS | USE_BOX);
			if (my.skill1 != 0)
			{
			temp2.x = (my.skill1 - 30) * cos(player.pan) * cos(camera.tilt) + player.x;
			temp2.y = (my.skill1 - 30) * sin(player.pan) * cos(camera.tilt) + player.y;
			temp2.z = (my.skill1 - 30) * sin(camera.tilt) + player.z;
			vec_set (my.x, temp);
			}
			energy -= 0.5 * time_step;
			wait (1);
			if (energy <= 200)
			{
			set(taschl100_pan,SHOW);
			reset(taschl75_pan,SHOW);
			reset(taschl50_pan,SHOW);
			reset(taschl25_pan,SHOW);
			reset(taschl0_pan,SHOW);
			}
			if (energy <= 150)
			{
			reset(taschl100_pan,SHOW);
			set(taschl75_pan,SHOW);
			reset(taschl50_pan,SHOW);
			reset(taschl25_pan,SHOW);
			reset(taschl0_pan,SHOW);
			}
			if (energy <= 100)
			{
			reset(taschl100_pan,SHOW);
			reset(taschl75_pan,SHOW);
			set(taschl50_pan,SHOW);
			reset(taschl25_pan,SHOW);
			reset(taschl0_pan,SHOW);	
			}
			if (energy <= 50)
			{
			reset(taschl100_pan,SHOW);
			reset(taschl75_pan,SHOW);
			reset(taschl50_pan,SHOW);
			set(taschl25_pan,SHOW);	
			reset(taschl0_pan,SHOW);
			}
			if (energy <= 1)
			{
			reset(taschl100_pan,SHOW);
			reset(taschl75_pan,SHOW);
			reset(taschl50_pan,SHOW);
			reset(taschl25_pan,SHOW);	
			set(taschl0_pan,SHOW);	
			}
		}
		my.lightrange = 0;
		wait (1);
		
	}
}


Sobald ich die F taste Drücke bekomme ich den Fehler: Error E1513 Sript crash in SYS. Sämtliche Panels sind definiert. Habe bist jetzt festellen können das das Probelm von der light_toggle() verusacht wird welche ich ja per on_f in der Action .... defeniert ist. Auch wenn die on_f = light_toggle(); in der Mainfucntion steht (habe es mal Testweise dahin verschoben) besteht das Problem. Wenn ich per zeitlichen abstand die Variable Wechsle und dabei die Function light_toggle() nutzte besteht das problem nicht. (habe als Test wait(-5); und dann light_toggle(); mehrmals und mir die Variable anzeigen lassen). Wie kann aber so eine einfache Variablenwechsel Function einen solchen Fehler verusachen?

Tschau
White_Wolf


A8 Com Version 8.40 Win 7 64 Bit
Re: Taschenlampensript Problem A8 [Re: White_Wolf] #343984
10/12/10 16:55
10/12/10 16:55
Joined: Apr 2010
Posts: 172
W
wdlmaster Offline
Member
wdlmaster  Offline
Member
W

Joined: Apr 2010
Posts: 172
Originally Posted By: White_Wolf
...on_f = light_toggle();...

die Klammern müssen weg!

Re: Taschenlampensript Problem A8 [Re: wdlmaster] #343985
10/12/10 17:03
10/12/10 17:03
Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
White_Wolf Offline OP
User
White_Wolf  Offline OP
User

Joined: Jan 2004
Posts: 557
Wurzen, Deutschland
Hi,

Danke für die Hilfe. Jetzt crashed es nicht mehr.

Tschau

White_Wolf


A8 Com Version 8.40 Win 7 64 Bit

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