# Math solve for X?

## Recommended Posts

What I'm trying to do is create a program that reads the distance from one point to another, then divides the distance by 3. Then clicks on a point, drags to a certain point and then lets go.

This would be easy if this had worked:

```Local \$b = (\$m * \$throwX) - \$throwY
Local \$x = int(\$x = Sqrt(\$d^2 - (\$m * (\$x + \$d)) + \$b))
Local \$y = \$m * \$x + \$b
MouseMove(\$throwX, \$throwY)
MouseDown("left")
Sleep(50)
MouseMove(\$x, \$y, 4)
MouseUp("left")
Sleep(100)```

The problem is \$x is being used to define itself, which can't be done apparently.

In above, \$b is the y-intercept, \$x is the x cord of where the mouse is being dragged to, and \$y is the y of where the mouse is being dragged to, \$throwX and \$throwY is the point where dragging starts.

In short, I'm asking for something that can solver for X in the 2nd line, does such a function exist in AutoIt?

Edited by foot1221

##### Share on other sites

What I'm trying to do is create a program that reads the distance from one point to another, then divides the distance by 3. Then clicks on a point, drags to a certain point and then lets go.

This would be easy if this had worked:

```Local \$b = (\$m * \$throwX) - \$throwY
Local \$x = int(\$x = Sqrt(\$d^2 - (\$m * (\$x + \$d)) + \$b))
Local \$y = \$m * \$x + \$b
MouseMove(\$throwX, \$throwY)
MouseDown("left")
Sleep(50)
MouseMove(\$x, \$y, 4)
MouseUp("left")
Sleep(100)```

The problem is \$x is being used to define itself, which can't be done apparently.

In above, \$b is the y-intercept, \$x is the x cord of where the mouse is being dragged to, and \$y is the y of where the mouse is being dragged to, \$throwX and \$throwY is the point where dragging starts.

In short, I'm asking for something that can solver for X in the 2nd line, does such a function exist in AutoIt?

Can you use this and then divide by 3

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go."

"Everybody catches up with everyone, eventually"

"As you teach others, you are really teaching yourself."

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace \$ghGDIPDll with \$__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

# Ternary operator

##### Share on other sites

This doesn't look right :

`Local \$x = int(\$x = Sqrt(\$d^2 - (\$m * (\$x + \$d)) + \$b))`

Maybe :

`Local \$x = int(Sqrt(\$d^2 - (\$m * (\$x + \$d)) + \$b))`

Live for the present,
Dream of the future,
Learn from the past.

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...