How to do ? -1 : 1 Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

How to do ? -1 : 1

Post by masheen » 30 Mar 2018, 11:57

Hi how to do this expression one line.

Code: Select all

if (X1 < X2 ) {
	camRec3 := maxCamG / (2 * Pi) * (Atan((Y2 - Y1) / (X2 - X1)) + 3 * Pi / 2) - Pi
}else{
	camRec3 := maxCamG / (2 * Pi) * (Atan((Y2 - Y1) / (X2 - X1)) + 3 * Pi / 2)
}
dont work :(

Code: Select all

	camRec3 := maxCamG / (2 * Pi) * (Atan((Y2 - Y1) / (X2 - X1)) + 3 * Pi / 2) X1 < X2 ? -Pi : ""

Nightwolf85
Posts: 302
Joined: 05 Feb 2017, 00:03

Re: How to do ? -1 : 1

Post by Nightwolf85 » 30 Mar 2018, 12:10

Does putting grouping ( ) around the tertiary operator help at all?

Code: Select all

maxCamG / (2 * Pi) * (Atan((Y2 - Y1) / (X2 - X1)) + 3 * Pi / 2) (X1 < X2 ? -Pi : "")

User avatar
Flipeador
Posts: 1204
Joined: 15 Nov 2014, 21:31
Location: Argentina
Contact:

Re: How to do ? -1 : 1  Topic is solved

Post by Flipeador » 30 Mar 2018, 12:12

Code: Select all

camRec3 := maxCamG / (2 * Pi) * (Atan((Y2 - Y1) / (X2 - X1)) + 3 * Pi / 2) - (X1 < X2 ? PI : 0)

User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to do ? -1 : 1

Post by jeeswg » 30 Mar 2018, 12:15

Like this?

Code: Select all

camRec3 := maxCamG / (2 * Pi) * (Atan((Y2 - Y1) / (X2 - X1)) + 3 * Pi / 2) - (X1 < X2 ? Pi : 0)
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: How to do ? -1 : 1

Post by masheen » 30 Mar 2018, 14:00

jeeswg wrote:Like this?

Code: Select all

camRec3 := maxCamG / (2 * Pi) * (Atan((Y2 - Y1) / (X2 - X1)) + 3 * Pi / 2) - (X1 < X2 ? Pi : 0)
Thx

Post Reply

Return to “Ask for Help (v1)”