Crash from do effect functions

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Crash from do effect functions

Post by Apeirogon »

I dont know what I screw in code and gzdoom strongly recommended to me send error report.
And who am I, to refuse gzdoom...

Code: Select all

class fade_out_mutation : inventory{ default {inventory.amount 1;} 

	double max_health;
	double current_health;
	double result_value;
	double limit;

override void AttachToOwner(Actor user)
	{
        	max_health = user.health;
		current_health = user.health;
		limit = 1;
		result_value = 1;
		super.AttachToOwner(user);
	}
override void doeffect()
	{
		if(owner.health == 0){return;}

		current_health = owner.health;
		result_value = current_health/max_health;

		if(result_value == limit)(owner.a_fadeto(result_value, 0.05, FTF_CLAMP); return;)//error here

		CVar fading_amount = CVar.FindCVar('fade_out_cvar');
		limit = fading_amount.GetFloat();

		if( result_value <= limit)
		{result_value = limit;}


		owner.a_fadeto(result_value, 0.05, false);
	}
}
Looks like change owner paramether from if/else statement in do effect virtual currently not possible.
Attachments
CrashReport.zip
(20.1 KiB) Downloaded 21 times
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Crash from do effect functions

Post by _mental_ »

You need to use curly brackets in the error line.

Using 3.2.5 x64

Code: Select all

Script error, ":zscript.txt" line 23:
Unexpected ';'
Expecting '=' or '*=' or '/=' or '%=' or '+=' or '-=' or '<<=' or '>>=' or '&=' or '|=' or '^=' or '>>>=' or '?' or '||' or '&&' or '==' or '!=' or '~==' or '<' or '>' or '<=' or '>=' or '<>=' or 'is' or '..' or '|' or '^' or '&' or '<<' or '>>' or '>>>' or '-' or '+' or '*' or '/' or '%' or 'cross' or 'dot' or '**' or '::' or ',' or ')'

Execution could not continue.

Fatal parse error
Post a whole file, not just one class.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Crash from do effect functions

Post by Graf Zahl »

Why is there a parenthesis behind the return? Did you want braces?

To be honest, proper formatting of the code would have most likely prevented this.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Crash from do effect functions

Post by Apeirogon »

_mental_ wrote:You need to use curly brackets in the error line.
My bad, I dont know how I place () instead of {} and dont distinguished them.

File.
test.pk3
(851 Bytes) Downloaded 19 times
And there are another bug.
After fixing this I load "my" test map, "4000 monsters.wad".
There I face this
Screenshot_Doom_20180220_194743.png
Upper from nuts, lower from 4000 monsters.

I "delete" from compile lines with cvar searching and get this
Screenshot_Doom_20180220_194819.png
upper from nuts, lower from 4000 monsters.

1.8M VM calls in comprasion to 202K.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Crash from do effect functions

Post by _mental_ »

Please do not report completely unrelated issues in one topic. There is a high chance to be lost.

Please post complete runnable samples with all maps, scripts, any other resources included.
Let’s be honest, no one is interested in spending time on crafting test cases in desperate attempts to get the same results as yours.
Post Reply

Return to “Closed Bugs [GZDoom]”