http://www.autohotkey.com/board/topic/1 ... -function/
but some users don't like the site so i made one here also
![Razz :P](./images/smilies/icon_razz.gif)
Hi
So i play a game called PokeMMO, witch i have a made a script to read the coordinates of my player/trainer
Here is a bad quality video of how it works:
Here is a picture:
http://s11.postimg.org/rg2vmljwz/pokemoncenter.png
So what the script does is, Reads the games memory so i get the coordinates of my player and then shows it in the GUI edit and every time i press WSA or D it records/saves the coordinates and also puts a direction to it:
W: UP | S: Down | A: Left | D: Right
and then it saves the coordinates and Directions to a file called "Path.ppm"
in the file:
Code: Select all
1769498|Left
1769493|Up
1179669|Left
524332|Down
917548|Left
917541|Up
Code: Select all
Walk_To_Pos("%CordPath%",currentPos,"%DirPath%") ; example Walk_To_Pos("1769498","Left")
Walk_To_Pos(target,currentPos, dir)
{
IF (target = currentPos)
{
GuiControl,, Statusy, Walking to %target%
send, {%dir% Down}
}
}
http://s11.postimg.org/a3xxnf11v/screenshot_177.png
Walk_To_Pos("262150",currentPos,"Right")
^
Means IF the player is standing 262150 then send the Right arrow key.
So the problem is that i don't know how to read the text inside of Path.ppm and split it so that the coordinates and the Directions gets in to the function and loops depending on how many lines there are in the Path.ppm
i tried splinting it myself but i don't really know how to do it, example:
Code: Select all
IF (Playmode = 1)
{
FileRead, Read_Path,Path.ppm
StringSplit, CordPath, Read_Path, `n
StringSplit, DirPath, Read_Path, |
Walk_To_Pos("%CordPath%",currentPos,"%DirPath%") ; Walk_To_Pos("1769498","Left")
}
Code: Select all
#Include memory.ahk
;center cord = 262151, 1 STEP DOWN FROM CENTER = 327687
Clipboard =
toggle = 0
#MaxThreadsPerHotkey 2
#SingleInstance, force
SetWorkingDir, %A_ScriptDir%
Gui, +AlwaysOnTop
Gui, Add, ListBox, x236 y7 w350 h460 VWalk, Press The Direcion you want
Gui, Add, Button, x16 y247 w110 h40 gtest, Test Path
Gui, Add, Text, x16 y17 w40 h20 , Cords:
Gui, Add, Edit, x66 y17 w70 h20 vXXYY, --
Gui, Add, Text, x226 y7 w10 h20 , 1
Gui, Add, Text, x226 y27 w10 h20 , 2
Gui, Add, Text, x226 y47 w10 h20 , 3
Gui, Add, Text, x226 y67 w10 h20 , 4
Gui, Add, Text, x226 y87 w10 h20 , 5
Gui, Add, Text, x226 y107 w10 h20 , 6
Gui, Add, Text, x226 y127 w10 h20 , 7
Gui, Add, Text, x226 y147 w10 h20 , 8
Gui, Add, Text, x226 y167 w10 h20 , 9
Gui, Add, Text, x216 y187 w20 h20 , 10
Gui, Add, Text, x216 y207 w20 h20 , 11
Gui, Add, Text, x216 y227 w20 h20 , 12
Gui, Add, Text, x216 y247 w20 h20 , 13
Gui, Add, Text, x216 y267 w20 h20 , 14
; Generated using SmartGUI Creator for SciTE
Gui, Show, w608 h491, PokeMMO Path Maker
return
GuiClose:
ExitApp
~W::
GuiControlGet, XXYY_OUT,, XXYY
step = IF: %XXYY_OUT% Walk: Up
GuiControl,, Walk, %Step%
FileAppend,%XXYY_OUT%|Up`n,Path.ppm
return
~A::
GuiControlGet, XXYY_OUT,, XXYY
step = IF: %XXYY_OUT% Walk: Left
GuiControl,, Walk, %Step%
FileAppend,%XXYY_OUT%|Left`n,Path.ppm
return
~S::
GuiControlGet, XXYY_OUT,, XXYY
step = IF: %XXYY_OUT% Walk: Down
GuiControl,, Walk, %Step%
FileAppend,%XXYY_OUT%|Down`n,Path.ppm
return
~D::
GuiControlGet, XXYY_OUT,, XXYY
step = IF: %XXYY_OUT% Walk: Right
GuiControl,, Walk, %Step%
FileAppend,%XXYY_OUT%|Right`n,Path.ppm
return
test:
Playmode = 1
return
Q::
Toggle := !Toggle
While Toggle
{
ProcessName := "javaw.exe" ; Pokemmo
cords := 0xAB3F44A8 ; Cords
hwnd := MemoryOpenFromName(ProcessName)
cords := MemoryReadPointer(hwnd,cords, "int")
Status := MemoryReadPointer(hwnd,Status, "int")
MemoryClose(hwnd)
GuiControl,, XXYY, %cords%
IF (Playmode = 1)
{
FileRead, Read_Path,Path.ppm
StringSplit, CordPath, Read_Path, `n
StringSplit, DirPath, Read_Path, |
Walk_To_Pos("%CordPath%",currentPos,"%DirPath%") ; Walk_To_Pos("1769498","Left")
}
}
return
Walk_To_Pos(target,currentPos, dir)
{
IF (target = currentPos)
{
GuiControl,, Statusy, Walking to %target%
send, {%dir% Down}
}
}
Go_Loop(target,target2, currentPos, dir1,dir2)
{
IF (target = currentPos)
{
GuiControl,, Statusy, Walking to %target2%
send, {%dir2% Up}
send, {%dir1% Down}
}
IF (target2 = currentPos)
{
GuiControl,, Statusy, Walking to %target%
send, {%dir1% Up}
send, {%dir2% Down}
}
}
http://www.autohotkey.com/board/topic/1 ... ot-working
Thanks and if you need any more info, feel free to send me a PM