Page 1 of 1

abs() weirdness

Posted: Sun Aug 10, 2014 3:10 am
by ZzZombo

Code: Select all

		Missile:
		TNT1 A 0 A_ChangeFlag("NOPAIN",1)
		SARG D 10 A_PlaySound("demon/active")
		SARG D 10 A_FaceTarget
		TNT1 A 0 A_ChangeVelocity(20,0,3,CVF_RELATIVE)
		SARG E 1 A_CustomMissile("ZDemonHelper",1,0,0,CMF_AIMDIRECTION)
		_:
		SARG E 1 A_JumpIf(abs(velx)<0.1||abs(vely)<0.1,"Missile.End")//this line give me error: Numeric type expected.
		loop
		Missile.End:
		TNT1 A 0 A_GiveInventory("ZDemonMarker")
		TNT1 A 0 A_PlaySound("demon/melee",CHAN_BODY)
		TNT1 A 0 A_ChangeFlag("NOPAIN",0)
		SARG G 35
		TNT1 A 0 A_TakeInventory("ZDemonMarker")
		SARG F 15 A_FaceTarget
		goto See
It's not the first time I get this weird error message, and it always complains about abs(). If I rewrite the script to work w/o it the latter works just fine. Can someone enlighten me as to why the fuck it happen?
P. S. Sometimes even simply moving lines around (or in one case, rewriting one line to work w/o abs() made another, exactly the same line below it to work).

RE: abs() weirdness

Posted: Sun Aug 10, 2014 4:05 am
by XutaWoo
I might be missing what you're saying, but it's entirely possible that Zand just doesn't support abs() in DECORATE yet.

I know it lacks frandom(), so it being behind in DECORATE functions in general wouldn't surprise me.

RE: abs() weirdness

Posted: Sun Aug 10, 2014 4:36 am
by ZzZombo
No, mate, abs() is absolutely present in Z&, and were since forever.

RE: abs() weirdness

Posted: Sun Aug 10, 2014 5:28 am
by Watermelon
I don't know if you can use logical OR's with decorate. Maybe you can, but I don't recall ever seeing it or using it myself.

Try abs() on its own with a jump number and see if it still gives you an error.
Ex:
A_JumpIf(abs(-255)...)

If abs is missing, try possibly using an ACS script with a return value?

RE: abs() weirdness

Posted: Sun Aug 10, 2014 5:44 am
by ZzZombo
Watermelon, that's definitely a parser fault. I changed an unrelated actor in another lump and another line in this actor definition contained abs() started to bug out.

Proof:

Code: Select all

Script error, "ZzZ-NoRoomInHell.pk3:decorate.zdemon.txt" line 100:
Numeric type expected
Script error, "ZzZ-NoRoomInHell.pk3:decorate.zdemon.txt" line 117:
Numeric type expected
Script error, "ZzZ-NoRoomInHell.pk3:decorate.zdemon.txt" line 117:
Numeric type expected
Line 100:

Code: Select all

	Damage		((abs(velx)+abs(vely))/3+1)
Line 110:

Code: Select all

		TNT1 A 0 A_JumpIf(abs(velx)+abs(vely)<0.2,2)
Note how it complains only once about the line #100 despite it contains the same number of abs() calls as the following one.

I want to say once more: the code I showed you worked fine at some point in the past until I changed some unrelated part of the project so asking if it's even gonna work is not going to help.

P. S. Ye. I called a script to return the absolute value:

Code: Select all

	Damage		((ACS_ExecuteWithResult(820,8,velx)+abs(vely))/3+1)
The error message about the line went away but there is no fucking difference in all cases of abs() usage so why the fuck it doesn't work?!

RE: abs() weirdness

Posted: Sun Aug 10, 2014 8:09 am
by Monsterovich
I think, this is stupid zdoom limitation (yes, in zdoom style), you can't use abs() more than once. Why? Because decorate is crap, WFDS.

RE: abs() weirdness

Posted: Sun Aug 10, 2014 12:49 pm
by XutaWoo
Actually, the A_JumpIf line works perfectly fine in ZDoom, but not in Zandronum. I just tested it.

So it's either a Zandronum bug or there was a change to A_JumpIf or abs() that Zandronum hasn't caught up with.

RE: abs() weirdness

Posted: Sun Aug 10, 2014 12:54 pm
by Dark-Assassin
Try in 2.0

RE: abs() weirdness

Posted: Sun Aug 10, 2014 1:03 pm
by ZzZombo
I'm working on my project in v2.0 since the very beginning, and trust me, that's not enough.

RE: abs() weirdness

Posted: Sun Aug 10, 2014 1:41 pm
by Dark-Assassin
Does it work properly with ZDoom 2.5.0?
If not, what about 2.6?

RE: abs() weirdness

Posted: Mon Oct 27, 2014 8:41 pm
by scroton
You probably already solved this, but did you include commonfuncs.h in your acs? abs() is defined in there.

RE: abs() weirdness

Posted: Thu Nov 20, 2014 6:46 am
by ZzZombo
Huh? What's that even?

RE: abs() weirdness

Posted: Thu Nov 20, 2014 2:12 pm
by Ijon Tichy
ZzZombo wrote: Huh? What's that even?
It's a over-1000-line header file that I've made over a few years. The most recent version is probably in Demonsteele - failing that, Metrood or maybe Push. All it is is a bunch of functions that I collected in the same place because I used them in a lot of places. I shoved it in Samsara for my convenience and now Term has been including it in all his projects. I'm not even sure if he uses them.

Anyway, it's ACS so it doesn't really apply here.

RE: abs() weirdness

Posted: Thu Nov 20, 2014 2:45 pm
by ZzZombo
Mkay, I don't use it at all.