A_JumpIf question

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
carlcyber
Posts: 163
Joined: Thu Jan 27, 2005 1:04 am

A_JumpIf question

Post by carlcyber »

After reading the introduction about A_JumpIf in the wiki. I still don't understand how to write the expression for it.
For example, how do I identify the x coordinate is larger 1024 and then jumps a specified state number?
Another question is, what is "pitch" in the A_JumpIf wiki page?
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: A_JumpIf question

Post by HotWax »

carlcyber wrote:After reading the introduction about A_JumpIf in the wiki. I still don't understand how to write the expression for it.
For example, how do I identify the x coordinate is larger 1024 and then jumps a specified state number?
This will jump 4 frames ahead if the x coordinate is larger than 1024:

Code: Select all

TNT1 A 0 A_JumpIf(x > 1024, 4);
Another question is, what is "pitch" in the A_JumpIf wiki page?
The pitch is the Z-angle (up/down) which the actor in question is currently facing. I believe this may only be useful for players, but maybe projectiles store this value as well? Somebody more knowledgable with DECORATE could probably clarify.
User avatar
Electronic Samurai
Posts: 177
Joined: Mon Mar 27, 2006 1:54 am
Location: Wandering the open plains

Post by Electronic Samurai »

Along the same lines, what sort of math can DECORATE handle? Does it support, for example, sine functions? Logical operators?
carlcyber
Posts: 163
Joined: Thu Jan 27, 2005 1:04 am

Post by carlcyber »

Thanks, HotWax.
And I'm curious about Electronic Samurai's question, too.
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Post by solarsnowfall »

I've always thought the documentation on that function was a bit lacking.
User avatar
Grubber
Posts: 1031
Joined: Wed Oct 15, 2003 12:19 am
Location: Czech Republic
Contact:

Post by Grubber »

Operators: ~a, !a, -a, a * b, a / b, a % b, a + b, a - b, a << b, a >> b, a < b, a <= b, a > b, a >= b, a == b, a != b, a & b, a ^ b, a | b, a && b, a || b, a ? b : c

Functions: random (min, max), sin (angle), cos (angle), any action special
User avatar
Bio Hazard
Posts: 4019
Joined: Fri Aug 15, 2003 8:15 pm
Location: ferret ~/C/ZDL $
Contact:

Post by Bio Hazard »

No XOR logical operator?
User avatar
Grubber
Posts: 1031
Joined: Wed Oct 15, 2003 12:19 am
Location: Czech Republic
Contact:

Post by Grubber »

No, only standard C operators. After all, there's no need for logical XOR operator, != is equivalent with it.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

No, it isn't.

(1 ^^ 2) ==0
(1 != 2) == 1


But I don't know any language that implements that operator. It's easy enough to replicate with other operators.
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

Grubber wrote:sin (angle), cos (angle)
Is angle represented as a byte angle, fixed point angle, or as 360 degrees?
User avatar
Bio Hazard
Posts: 4019
Joined: Fri Aug 15, 2003 8:15 pm
Location: ferret ~/C/ZDL $
Contact:

Post by Bio Hazard »

Um, wouldn't

Code: Select all

if(i ^^ q){
evaluate true if either i OR q were true but not if both were true? The only way I can think to do that with other operators is with

Code: Select all

if((i && !q) || (!i && q)){
Hmm, I could have sworn I'd seen it in C somewhere but I guess you're right.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Code: Select all

if (!!i ^ !!q) ...
User avatar
Bio Hazard
Posts: 4019
Joined: Fri Aug 15, 2003 8:15 pm
Location: ferret ~/C/ZDL $
Contact:

Post by Bio Hazard »

That's still more text (and instructions) than

Code: Select all

if(i^^q)
:P
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

Because 3 more key strokes is a work out. :P
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Graf Zahl wrote:

Code: Select all

if (!!i ^ !!q) ...
"If not not i or not not q"?

What?

<brain explodes>
Locked

Return to “Editing (Archive)”