## Recommended Posts

hey im having troubles with using the parameters in one of my functions, heres the code:

```Func Walkto(\$Xcoord, \$Ycoord)
\$Xcoord = \$ChestX
\$Ycoord = \$ChestY
WinActivate("Mythwar")
sleep(1500)
\$CoordX = _NCR(649, 52, 669, 64)
\$FinalX = \$ChestX - \$CoordX
If -5 > \$FinalX Then
ToolTip("MythBot: going west", 2, 0)
\$west = 1
EndIf
If \$FinalX > 5 Then
ToolTip("MythBot: going east", 2, 0)
\$east = 1
EndIf

\$CoordY = _NCR(673, 52, 695, 64)
\$FinalY = \$ChestY - \$CoordY
If -5 < \$FinalY Then
ToolTip("MythBot: going south", 2, 0)
\$north = 1
EndIf
If \$FinalY < 5 Then
ToolTip("MythBot: going north", 2, 0)
\$south = 1
EndIf
If \$east = 1 Or \$west = 1 Or \$north = 1 Or \$south = 1 Then
ChestWalk()
EndIf
EndFunc```

now in another function i have this:

Walkto(237,675)

so i want it to use 237 for Xcoord and 675 for Ycoord in the Walkto function but Xcoord and Ycoord never have a value, if someone could tell me how to fix this that would be great

##### Share on other sites

now in another function i have this:

Walkto(237,675)

so i want it to use 237 for Xcoord and 675 for Ycoord in the Walkto function but Xcoord and Ycoord never have a value

Oh, they have a value alright. However, you take care of that in the first two lines of code:

```Func Walkto(\$Xcoord, \$Ycoord)
\$Xcoord = \$ChestX ; <--- so much for that \$Xcoord value that was passed
\$Ycoord = \$ChestY ; <--- yep, you just killed the \$Ycoord value too```

Auto3Lib: A library of over 1200 functions for AutoIt

##### Share on other sites

o lol that was a pretty stupid mistake lol thx

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

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