abs() weirdness

Discuss all aspects related to modding Zandronum here.
Post Reply
ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

abs() weirdness

#1

Post by ZzZombo » Sun Aug 10, 2014 3:10 am

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).
Last edited by ZzZombo on Sun Aug 10, 2014 3:17 am, edited 1 time in total.
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

XutaWoo
Forum Regular
Posts: 113
Joined: Mon Jun 04, 2012 7:04 am

RE: abs() weirdness

#2

Post by XutaWoo » Sun Aug 10, 2014 4:05 am

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.
[spoiler]Image[/spoiler]
Image

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: abs() weirdness

#3

Post by ZzZombo » Sun Aug 10, 2014 4:36 am

No, mate, abs() is absolutely present in Z&, and were since forever.
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: abs() weirdness

#4

Post by Watermelon » Sun Aug 10, 2014 5:28 am

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?
Last edited by Watermelon on Sun Aug 10, 2014 5:29 am, edited 1 time in total.

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: abs() weirdness

#5

Post by ZzZombo » Sun Aug 10, 2014 5:44 am

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?!
Last edited by ZzZombo on Sun Aug 10, 2014 6:02 am, edited 1 time in total.
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

User avatar
Monsterovich
Forum Regular
Posts: 343
Joined: Sun Jun 17, 2012 5:46 pm

RE: abs() weirdness

#6

Post by Monsterovich » Sun Aug 10, 2014 8:09 am

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.
Last edited by Monsterovich on Sun Aug 10, 2014 9:26 am, edited 1 time in total.

XutaWoo
Forum Regular
Posts: 113
Joined: Mon Jun 04, 2012 7:04 am

RE: abs() weirdness

#7

Post by XutaWoo » Sun Aug 10, 2014 12:49 pm

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.
[spoiler]Image[/spoiler]
Image

User avatar
Dark-Assassin
Maintenence Crew
Posts: 968
Joined: Fri May 25, 2012 4:25 am

RE: abs() weirdness

#8

Post by Dark-Assassin » Sun Aug 10, 2014 12:54 pm

Try in 2.0
❗ Don't message me for technical or moderation support.
❔ Use the relevant support channels instead.

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: abs() weirdness

#9

Post by ZzZombo » Sun Aug 10, 2014 1:03 pm

I'm working on my project in v2.0 since the very beginning, and trust me, that's not enough.
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

User avatar
Dark-Assassin
Maintenence Crew
Posts: 968
Joined: Fri May 25, 2012 4:25 am

RE: abs() weirdness

#10

Post by Dark-Assassin » Sun Aug 10, 2014 1:41 pm

Does it work properly with ZDoom 2.5.0?
If not, what about 2.6?
❗ Don't message me for technical or moderation support.
❔ Use the relevant support channels instead.

scroton
 
Posts: 63
Joined: Mon Aug 26, 2013 3:33 am

RE: abs() weirdness

#11

Post by scroton » Mon Oct 27, 2014 8:41 pm

You probably already solved this, but did you include commonfuncs.h in your acs? abs() is defined in there.

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: abs() weirdness

#12

Post by ZzZombo » Thu Nov 20, 2014 6:46 am

Huh? What's that even?
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: abs() weirdness

#13

Post by Ijon Tichy » Thu Nov 20, 2014 2:12 pm

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.

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: abs() weirdness

#14

Post by ZzZombo » Thu Nov 20, 2014 2:45 pm

Mkay, I don't use it at all.
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

Post Reply