Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (EternallyCurious, Quad, vicknick), 700 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Action attached to sprite in WED stopped working #440359
04/24/14 12:39
04/24/14 12:39

T
tolu619
Unregistered
tolu619
Unregistered
T



I'm frustrated right now because an action I attached to some sprites in WED which were working perfectly before suddenly stopped working. I put a "printf" command at the beginning of the action just to test whether or not the action was running at all and I don't get any message (from the printf code) when the script starts running. Other actions in the same script (attached to models) are working perfectly. Its not about a syntax error in the code. For some reason, the code just seems unreachable to the engine, even though it was running perfectly before.

PLEASE! I've tried shortening the names of the actions and functions since I know the free edition of gamestudio places limitations on name lengths but nothing seems to work. I can attach the actions to the sprites in WED but once I start the game, the thing acts like there's no action attached to it at all.

Last edited by rayp; 04/25/14 09:22. Reason: merged posts
Re: Action attached to sprite in WED stopped working [Re: ] #440408
04/25/14 09:23
04/25/14 09:23
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Instead making double posts, maybe u should provide the code you add to the sprite ?

Action names are limited to 18 chars, if iam right btw.


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Action attached to sprite in WED stopped working [Re: rayp] #440412
04/25/14 10:28
04/25/14 10:28

T
tolu619
Unregistered
tolu619
Unregistered
T



While I have no problems with posting the code here, I'm convinced that this a bug and I think it needs to be looked into. I have 2 reasons for this conclusion. First, the code was working perfectly before then it suddenly stopped working without any adjustments being made to it. Secondly, I created another action in the same script and randomly named it "twirl". All it did was rotate the sprite attached to it. It worked. So I slowly added the code of the action that wasn't working, line by line, to the new action called Twirl. Every time I ran it, it worked. Eventually, the exact same code that didn't work in the other action worked in Twirl. Just for arguments purpose, I swapped the names of the 2 actions and now, the former code worked because it was named Twirl. Very annoying that I lost almost 2 days to this. Here's the code:

Code:
action Twirl()
{
	while(!player){wait(1);}
	my.skill50 = 1199; //I'm a jump target
	JumpTargetID++;
	my.skill51 = JumpTargetID;
	set(my, PASSABLE); 
	set(my, INVISIBLE);	
	my.emask |= (ENABLE_SCAN); //sensitive to c_scan	
	my.event = WasScanned;
	while(1)
	{
		//my.pan += 10*time_step;
		my.roll += 10*time_step;
		//my.tilt += 10*time_step;
		wait(1);
	}
}

action JumpTarget()
{
	while(!player){wait(1);}
	my.skill50 = 1199; //I'm a jump target
	JumpTargetID++;
	my.skill51 = JumpTargetID;
	while(1){my.roll+=1*time_step; wait(1);}

//	set(my, BRIGHT);
//	my.red = 255;
//	my.blue = 255;
//	my.green = 255;
//	my.lightrange = 10000;
	
	set(my, PASSABLE); 
	set(my, INVISIBLE);	
	my.emask |= (ENABLE_SCAN); //sensitive to c_scan	
	my.event = WasScanned;
}


Last edited by tolu619; 04/25/14 10:29. Reason: added code tags
Re: Action attached to sprite in WED stopped working [Re: ] #440418
04/25/14 11:55
04/25/14 11:55
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You will need to provide an example/ test project, otherwise this probably won't be reconstructable or fixable.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Action attached to sprite in WED stopped working [Re: Superku] #440422
04/25/14 12:04
04/25/14 12:04
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
If an action suddenly stops working, the most likely place to look for the bug is the part that you changed after it worked the last time. A wrong name length is not a likely reason unless you get an error message about it.

From your script snippet I cannot tell you where the bug is - but under "troubleshooting" in the manual there are many hints how to find and fix bugs.

Re: Action attached to sprite in WED stopped working [Re: jcl] #440447
04/25/14 16:35
04/25/14 16:35

T
tolu619
Unregistered
tolu619
Unregistered
T



OK, here's my entire project folder. https://www.dropbox.com/sh/6979kmt9rstkk46/4Xl2o8udfS
Run the script called "Project Monkey", select the fox as your character, then select the level in the middle (dodge dash training ground) and as your level. The twirl code should run on the sprites it is attached to while the JumpTarget code won't run. At least that's what happens here.

Re: Action attached to sprite in WED stopped working [Re: ] #440585
04/28/14 14:05
04/28/14 14:05
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Hmm, although I'm here to help users with their projects, this folder is a little too big for my taste (and for my time). Can you do the first steps? Strip the game down, step by step, until you end up with a minimal script that only contains the very elements you have problems with. You will most likely find the bug this way. But if the action then still does not run, please post here and I'll help.

Re: Action attached to sprite in WED stopped working [Re: jcl] #440593
04/28/14 14:37
04/28/14 14:37
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
It may help you to implement some sort of level protocol function. A few weeks ago I did something similar - you can see the function below - but there may be some bugs (in engine_gettaskinfo(), the protocol function or my game) because it sometimes leads to errors. You can however use it as a basis for your own project and if you remove the first while(e_res) loop there won't be errors.

Click to reveal..
Code:
void level_protocol()
{
	var p_file,e_count = 0,e_res = 1;
	STRING* str_tmp;
	char* funcname;
	ENTITY* ent;
	
	sys_marker("LP1");
	str_tmp = str_create("");
	str_cpy(str_tmp,level_name);
	str_trunc(str_tmp,4);
	if(key_l) str_cat(str_tmp,"_protocol_forced.txt");
	else str_cat(str_tmp,"_protocol.txt");
	p_file = file_open_write(str_tmp);
	if(!p_file)
	{
		error("level_protocol: could not open file!");
		return;
	}
	
	sys_marker("LP2");
	file_str_write(p_file,"Functions:");
	while(e_res)
	{
		sys_marker("L2A");
		if(!engine_gettaskinfo(e_count,&funcname,&ent)) break;
		sys_marker("L2B");
		file_str_write(p_file,"\nFunction: ");
		file_var_write(p_file,e_count);
		file_str_write(p_file,"\n-name: ");
		sys_marker("L2C");
		if(funcname) file_str_write(p_file,funcname);
		sys_marker("L2D");
		file_str_write(p_file,"\n-me entity: ");
		if(ent) file_var_write(p_file,ent->link.index);
		e_count++;
	}
	sys_marker("LP3");
	file_str_write(p_file,"\nEntities:");
	e_count = 0;
	for(you = ent_next(NULL); you; you = ent_next(you))
	{
		e_count++;
		file_str_write(p_file,"\nEntity: ");
		file_var_write(p_file,e_count);
		file_str_write(p_file,"\n-filename: ");
		str_for_entfile(str_tmp,you);
		file_str_write(p_file,str_tmp);
		file_str_write(p_file,"\n-link id: ");
		file_var_write(p_file,you->link.index);
		file_str_write(p_file,"\n-link name: ");
		if(you->link.name) file_str_write(p_file,you->link.name);
		file_str_write(p_file,str_printf(NULL,"\n-pos: (%d,%d,%d)",(int)your.x,(int)your.y,(int)your.z));
		file_str_write(p_file,str_printf(NULL,"\n-pan: (%d,%d,%d)",(int)your.pan,(int)your.tilt,(int)your.roll));
		file_str_write(p_file,str_printf(NULL,"\n-scale: (%d,%d,%d)",(int)your.scale_x,(int)your.scale_y,(int)your.scale_z));
		file_str_write(p_file,str_printf(NULL,"\n-flags: (%d,%d,%d)",(int)your.eflags,(int)your.flags2,(int)your.emask));
	}
	sys_marker("LP4");
	file_str_write(p_file,"\nEntities in total: ");
	file_var_write(p_file,e_count);
	file_str_write(p_file,"\nLoading errors: ");
	file_var_write(p_file,last_error);
	file_close(p_file);
	sys_marker(NULL);
	ptr_remove(str_tmp);
}
...
on_l = level_protocol;
on_level_load = level_protocol;



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Moderated by  old_bill, Tobias 

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