ACS division?

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.
Locked
J14
Posts: 14
Joined: Fri Nov 14, 2008 8:28 am
Location: SW Ontario, Canada

ACS division?

Post by J14 »

I want to make "GetActorX(0)-16128.0" divided by 8. How can I do this?

Here's the code:

Code: Select all

SetActorPosition(1,GetActorX(0)-16128.0,GetActorY(0),GetActorZ(0),0);
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: ACS division?

Post by NeuralStunner »

This is the division operator: /
J14
Posts: 14
Joined: Fri Nov 14, 2008 8:28 am
Location: SW Ontario, Canada

Re: ACS division?

Post by J14 »

Thanks but I tried both "GetActorX(0)-16128.0 / 8" and "GetActorX(0)-16128.0/8" and neither work.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: ACS division?

Post by NeuralStunner »

You can try putting the first part in parentheses: "(GetActorX(0) - 16128.0) / 8". I believe this forces the first section to be evaluated before dividing.
J14
Posts: 14
Joined: Fri Nov 14, 2008 8:28 am
Location: SW Ontario, Canada

Re: ACS division?

Post by J14 »

Nope, still doesn't work.
User avatar
InsanityBringer
Posts: 3392
Joined: Thu Jul 05, 2007 4:53 pm
Location: opening the forbidden box

Re: ACS division?

Post by InsanityBringer »

J14 wrote:Thanks but I tried both "GetActorX(0)-16128.0 / 8" and "GetActorX(0)-16128.0/8" and neither work.
Try:

Code: Select all

int result = FixedDiv(GetActorX(0)-16228.0, 8.0);
J14
Posts: 14
Joined: Fri Nov 14, 2008 8:28 am
Location: SW Ontario, Canada

Re: ACS division?

Post by J14 »

The only problem is I need it to fit in the code

Code: Select all

SetActorPosition(1,GetActorX(0)-16128.0,GetActorY(0),GetActorZ(0),0);
User avatar
InsanityBringer
Posts: 3392
Joined: Thu Jul 05, 2007 4:53 pm
Location: opening the forbidden box

Re: ACS division?

Post by InsanityBringer »

Code: Select all

SetActorPosition(1,FixedDiv(GetActorX(0)-16228.0, 8.0),GetActorY(0),GetActorZ(0),0);
J14
Posts: 14
Joined: Fri Nov 14, 2008 8:28 am
Location: SW Ontario, Canada

Re: ACS division?

Post by J14 »

Yep, thank you :D
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Re: ACS division?

Post by Isle »

fun fact: you don't need fixeddiv() when dividing a fixed by a whole number.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: ACS division?

Post by Gez »

Parentheses for precedence.

Code: Select all

SetActorPosition(1,(GetActorX(0)-16128.0)/8,GetActorY(0),GetActorZ(0),0);
Locked

Return to “Editing (Archive)”