taultunleashed logoNetworked Synced Melee Macro : Darkfall Online - Submissions tu winter contest 2012 nintendo wii
newtopic  postreply
 [ 19 posts ]  1, 2  Next
blue large dot

Networked Synced Melee Macro : Darkfall Online - Submissions

Posted: June 6th, 2009, 9:29 am
 
tault_frosaly

Total Posts: 19
Joined: August 21st, 2004, 4:40 pm
tault_frosaly's Reps: 0
User avatar
Ok guys it took me many hours to figure this out so don't give up and I'll try to help you out as much as I can. Hope this works for you as well as it did for me.

What it does is:
Player 1 hits 1 time and player 2 parries that hit.
Player 2 hits 1 time and player 1 parries that hit.
x times, untill emo mode.
Emo mode is where both players hits each other x times without parry
Then it rests and repeats all over.

This program runs in AutoHotKey. Download it in www.autohotkey.com

First, there has to be two accounts. It can be either 2 different people or two accounts under the same owner. If you have two accounts under the same owner then you should have a virtual PC on your computer so it thinks there's 2 computers.

How to install:

Anyway, each person must chose either server or client. One person will be client, the other will be server (Remember that).
Remember to copy the scripts to C:\AHK\ (It must be to that directory cause it creates a preference file later).
Paste the script on a notepad. Server side must save as server.ahk and client side must save as client.ahk

The ONLY thing you need to edit are the KEY CONFIGURATION, which you can find at the beginning of each script. This is a link that has the shortcuts to every key in the keyboard http://www.autohotkey.com/docs/commands/Send.htm

My KEY CONFIGURATION looks like this:
; -----------KEY CONFIGURATION--------------
khit = {LButton}
kparrydown = {v down}
kparryup = {v up}
karm = {r}
krest = {0}
kmove = {w}
kmenuopen = {RButton}
kmenuclose = {RButton}
kmenuclick = left

khit is the button you use to attack.
kparrydown and kparry up you must put in the button you use to parry but leave the down and up.
karm is the button you use to unsheath. krest is the button you have rest on.
kmove is the button you use to move forward or stand up.
kmenuopen and kmenuclose is the button you use to open and close menu. and
kmenuclick is the button you use to choose things in the menu.

Once you have that save the text as .ahk file. (The client side will do client. ahk and the serverside will do server.ahk)



Ok second step is, once you open it.

Server side will need to put the in the Local IP. To get that you go to Start, Run, and type CMD. The command prompt should appear and you type in IPCONFIG You can now see your local IP. Enter that IP on the server side.

Client side, if it's over the internet, the player with the server script must go to www.myip.dk and give that IP address to the client side.

Remember to use the same port and NAT it on your router/firewall. (I used 8750). (I personally disconnected my router and did a direct connection to make it easier. IE. My local IP was the same as my network IP.)

You will also get a window to set up your ingame paperdoll, bag and weapons. Remember to press 1 on the weapons slot in paperdoll, press 2 on the shield slot in the paperdoll (Do it in the slot not on an equipped weapon). Press 3 in the upper left corner of your backpack. Press 4 in the lower right corner of your backpack. Then 5 press over the weapon you will be using and 6 over the shield. If you're using 2h weapons then press both numbers over the same weapon. Remember when you press 5 and 6 over the weapon to place it in a distinguishable color because that's how it detects the weapons, thru pixels. Once you finish this step hit done.

I think by this moment it will ask your melee options.
Without armor I use:
Number of hits:10
Number of emo hits:3
Rest: 50
Delay between hits: (1h 900) (2h 3000)

With armor I use:
Number of hits:10
Number of emo hits:10
Rest:50
Delay between hits: same

Finally here are the 2 scripts. Remember one char must be server the other must be client.

Server:
; ------------------------------------------
; ------------SERVERSCRIPT------------------
; ---------------v-0.03b--------------------

; -----------KEY CONFIGURATION--------------
khit = {RButton}
kparrydown = {LButton down}
kparryup = {LButton up}
karm = {MButton}
krest = {7}
kmove = {numpad8}
kmenuopen = {PgDn}
kmenuclose = {PgDn}
kmenuclick = right

; -------CHECK CONFIGURATION SECTION--------
Gosub, IniReadSettings
if (Network_Address = "ERROR" )
{
Gosub, IPPORTGUI
return
}

if (oEmo = "ERROR" OR oHits = "ERROR" OR oShields = "ERROR" OR oHitDelay = "ERROR" OR oRest = "ERROR" OR oProfile = "ERROR" )
{
Gosub, MeleeOptionsGUI
return
}

if (oEmo = "" OR oHits = "" OR oShields = "" OR oHitDelay = "" OR oRest = "" OR oProfile = "" )
{
Gosub, MeleeOptionsGUI
return
}

if (pweapon = "" OR pweapon = "ERROR" OR pshield = "" OR pshield = "ERROR")
{
Gosub, BPSetup
return
}

if (pxu = "ERROR")
{
Gosub, BPSetup
return
}

Main:
Gui, Destroy
Gui, Add, Button, gIPPORTGUI, IP and Port Setup
Gui, Add, Button, gBPSetup, Backpack and Paperdoll Setup
Gui, Add, Button, gItemSearchGUI, Item Search Test
Gui, Add, Button, gKeySetupGUI, Key Setup
Gui, Add, Button, gTeleportGUI, Teleporthack
Gui, Add, Button, gMeleeOptionsGUI, Melee Options
Gui, Add, Button, gMeleeStart, Melee Start
Gui, Add, Button, gAbout, About
Gui, Show

Gosub Connection_Init

return

MeleeStart:
Gui, Submit, NoHide
loop
{
;Gosub, IniReadSettings
weapons = 1
counter = 1
;change = 10
dcast = 5000
darm = 1000
dsmall = 1000
dserver = 200

sleep 3000

loop
{
if(oProfile = 1 OR oProfile = 2)
{
;Hit start
SendText = parry %oHitDelay%
SendData(conectioncheck,SendText)
sleep dserver
send % khit
sleep oHitDelay
sleep 100
;Hit end
}
if(oProfile = 1 OR oProfile = 3 )
{
;Parry start
SendText = hit %oHitDelay%
SendData(conectioncheck,SendText)
dparry := oHitDelay - 400
sleep 500
send % kparrydown
sleep dparry
send % kparryup
;Parry end
}
sleep dserver
if(counter = oHits)
{
;Emo-donkey-mode
loop, % oEmo
{
;Hit start
SendText = hit %oHitDelay%
SendData(conectioncheck,SendText)
sleep dserver
send % khit
sleep oHitDelay
sleep 100
;Hit end
}
sleep 1000
SendText = rest %oRest%
SendData(conectioncheck,SendText)
counter = 0

;rest start
loop, % oRest
{
send % karm
sleep darm
send % krest
sleep dserver
send % khit
}

sleep darm

loop, 3
{
send % kmove
sleep dsmall
}

sleep 2000
;rest stop
send % kmenuopen
sleep 1000
;Weapon Change Start
Gosub, SearchWeaponPaperdoll
sleep 1000
if oShields = 1
Gosub, SearchShieldPaperdoll
sleep 2000
send % kmenuclose
sleep 1000
send % karm
sleep darm
;Weapon Change Stop
sleep 5000
}

counter++


}
}
SentText =
return

; ------------GUI-MISC------------------

Restart:
Reload
return

ItemSearchGUI:
Gui, Destroy
Gui, Add, Text,, Remove your weapon and shield from the paperdoll!
Gui, Add, Text,, Mouse have to be in menu mode, not mouselook mode:
Gui, Add, Text,, Click button 1 ingame to test weapon search and equip paperdoll.
Gui, Add, Text,, Click button 2 ingame to test shield search and equip paperdoll.
Gui, Add, Button, gRestart, Exit
Gui, Show
Loop
{
if GetKeyState("1","P")
{
Gosub, SearchWeaponPaperdoll
}
else if GetKeyState("2","P")
{
Gosub, SearchShieldPaperdoll
}
}
return

MeleeOptionsGUI:
Gui, Destroy
Gui, Add, Text,, Number of hits before going to emo:
Gui, Add, Edit, voHits
Gui, Add, Text,, Number of emo-hits:
Gui, Add, Edit, voEmo
Gui, Add, Text,, Delay between hits, in ms (1 sec = 1000 ms):
Gui, Add, Edit, voHitDelay
Gui, Add, Text,, How many times to rest 1200ms:
Gui, Add, Edit, voRest
Gui, Add, Text,, Check if using shields:
Gui, Add, Checkbox, voShields
Gui, Add, Text,, Profile 1: Server and client hit n parry
Gui, Add, Text,, Profile 2: Server hit only, client parry only
Gui, Add, Text,, Profile 3: Server parry only, client hit only
Gui, Add, Text,, Select a profile:
Gui, Add, DropDownList, voProfile, 1|2|3
Gui, Add, Button, gIniMelee, Save
Gui, Add, Button, gRestart, Exit
Gui, Show
return

IniMelee:
Gui, Submit
IniWrite, %oHits%, C:\ahk\config.ini, MeleeOptions, Hits
IniWrite, %oEmo%, C:\ahk\config.ini, MeleeOptions, Emo
IniWrite, %oShields%, C:\ahk\config.ini, MeleeOptions, Shields
IniWrite, %oHitDelay%, C:\ahk\config.ini, MeleeOptions, HitDelay
IniWrite, %oRest%, C:\ahk\config.ini, MeleeOptions, Rest
IniWrite, %oProfile%, C:\ahk\config.ini, MeleeOptions, Profile
Reload
return

KeySetupGUI:
MsgBox Not done yet, will be added in the future.
return

TeleportGUI:
MsgBox HAR! You damn dirty cheating punk! Got ya noob :P
return

About:
MsgBox Network connection code was made by Zed Gecko @ Autohotkey forum. Thanks!
MsgBox Rest was made by a donkey. Yada yada blah blah... Version 0.03b
return

IPPORTGUI:
Gui, Destroy
Gui, Add, Text,, Please enter your network IP:
Gui, Add, Edit, vIP
Gui, Add, Text,, Please enter your network port:
Gui, Add, Edit, vPort
Gui, Add, Button, gIniIPPort, Save
Gui, Add, Button, gRestart, Exit
Gui, Show
return

IniIPPort:
Gui, Submit
IniWrite, %IP%, C:\ahk\config.ini, Network, IP
IniWrite, %Port%, C:\ahk\config.ini, Network, Port
Reload
return


; ------------TrainerSetupHandling------------------

BPSetup:
Gui, Destroy
Gui, Add, Text,, Paperdoll:
Gui, Add, Text,, Push key 1 in upper left above your weapon slots
Gui, Add, Text,, Push key 2 in lower right under your shield slots
Gui, Add, Text,, Backpack:
Gui, Add, Text,, Push key 3 in upper left (inside the wood please) corner of your backpack
Gui, Add, Text,, Push key 4 in lower right (inside the wood please) corner of your backpack
Gui, Add, Text,, Click the backpack, then push key 5 On your weapon and wait untill the mouse moves back (try to pick a unike color on that item, if possible)
Gui, Add, Text,, Click the backpack, then push key 6 On your shield and wait untill the mouse moves back (try to pick a unike color on that item, if possible)
Gui, Add, Button, gRestart, Done
Gui, Show
loop
{
if GetKeyState("1","P")
{
Gosub, IniWriteUpperPaperdoll
}
else if GetKeyState("2","P")
{
Gosub, IniWriteLowerPaperdoll
}
else if GetKeyState("3","P")
{
Gosub, IniWriteUpperBackpack
}
else if GetKeyState("4","P")
{
Gosub, IniWriteLowerBackpack
}
else if GetKeyState("5","P")
{
Gosub, IniWriteWeaponPixel
}
else if GetKeyState("6","P")
{
Gosub, IniWriteShieldPixel
}
}
return

IniReadSettings:
IniRead, pweapon, C:\AHK\config.ini, Items, weapon
IniRead, pshield, C:\AHK\config.ini, Items, shield

IniRead, pxu, C:\AHK\config.ini, paperdollCordsUpperLeft, x
IniRead, pyu, C:\AHK\config.ini, paperdollCordsUpperLeft, y

IniRead, pxl, C:\AHK\config.ini, paperdollCordsLowerRight, x
IniRead, pyl, C:\AHK\config.ini, paperdollCordsLowerRight, y

IniRead, bxu, C:\AHK\config.ini, backpackCordsUpperLeft, x
IniRead, byu, C:\AHK\config.ini, backpackCordsUpperLeft, y

IniRead, bxl, C:\AHK\config.ini, backpackCordsLowerRight, x
IniRead, byl, C:\AHK\config.ini, backpackCordsLowerRight, y

IniRead, Network_Address, C:\AHK\config.ini, Network, IP
IniRead, Network_Port, C:\AHK\config.ini, Network, Port

IniRead, oHits, C:\AHK\config.ini, MeleeOptions, Hits
IniRead, oEmo, C:\AHK\config.ini, MeleeOptions, Emo
IniRead, oShields, C:\AHK\config.ini, MeleeOptions, Shields
IniRead, oHitDelay, C:\AHK\config.ini, MeleeOptions, HitDelay
IniRead, oRest, C:\AHK\config.ini, MeleeOptions, Rest
IniRead, oProfile, C:\AHK\config.ini, MeleeOptions, Profile

return

IniWriteUpperPaperdoll:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, paperdollCordsUpperLeft, x
IniWrite, %y%, C:\ahk\config.ini, paperdollCordsUpperLeft, y
return

IniWriteLowerPaperdoll:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, paperdollCordsLowerRight, x
IniWrite, %y%, C:\ahk\config.ini, paperdollCordsLowerRight, y
return

IniWriteUpperBackpack:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, backpackCordsUpperLeft, x
IniWrite, %y%, C:\ahk\config.ini, backpackCordsUpperLeft, y
return

IniWriteLowerBackpack:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, backpackCordsLowerRight, x
IniWrite, %y%, C:\ahk\config.ini, backpackCordsLowerRight, y
return

; ------------PixelSearchHandlingNEW------------------

IniWriteWeaponPixel:
MouseGetPos, x, y
MouseMove, 0, 0
sleep 1000
PixelGetColor, color, %x%, %y%
IniWrite, %color%, C:\ahk\config.ini, Items, weapon
sleep 1000
MouseMove, x, y
return

IniWriteShieldPixel:
MouseGetPos, x, y
MouseMove, 0, 0
sleep 1000
PixelGetColor, color, %x%, %y%
IniWrite, %color%, C:\ahk\config.ini, Items, shield
sleep 1000
MouseMove, x, y
return


; ------------ItemSearchHandling------------------
SearchWeaponPaperdoll:
px := round((pxl - pxu )/2+ pxu)
py := round(pyu-(pyl - pyu ))
MouseClick, %kmenuclick%, %px%, %py%, 1
sleep 300
PixelSearch oX, oY, pxu, pyu, pxl, pyl, pweapon, 1, Fast
if ErrorLevel
Gosub, SearchWeaponBackpack
return
return

SearchShieldPaperdoll:
px := round((pxl - pxu )/2+ pxu)
py := round(pyu-(pyl - pyu ))
MouseClick, %kmenuclick%, %px%, %py%, 1
sleep 300
PixelSearch, oX, oY, pxu, pyu, pxl, pyl, pshield, 1, Fast
if ErrorLevel
Gosub, SearchShieldBackpack
return
return

SearchWeaponBackpack:
bx := round((bxl - bxu )/2 + bxu)
by := round((byl - byu )/2 + byu)
MouseClick, %kmenuclick%, %bx%, %by%, 1
sleep 300
PixelSearch, oX, oY, bxu, byu, bxl, byl, pweapon, 1, Fast
if ErrorLevel
return
else
MouseClick, %kmenuclick%, %oX%, %oY%, 3
return
return

SearchShieldBackpack:
bx := round((bxl - bxu )/2 + bxu)
by := round((byl - byu )/2 + byu)
MouseClick, %kmenuclick%, %bx%, %by%, 1
sleep 300
PixelSearch, oX, oY, bxu, byu, bxl, byl, pshield, 1, Fast
if ErrorLevel
return
else
MouseClick, %kmenuclick%, %oX%, %oY%, 3
return
return


Menu:
sleep 200
send % kmenuopen
sleep 200
return

; ------------ConnectionHandling------------------

Connection_Init:
OnExit, ExitSub ; For connection cleanup purposes.

socket := PrepareForIncomingConnection(Network_Address, Network_Port)
if socket = -1 ; Connection failed (it already displayed the reason).
ExitApp

Process, Exist ; This sets ErrorLevel to this script's PID (it's done this way to support compiled scripts).
DetectHiddenWindows On
ScriptMainWindowId := WinExist("ahk_class AutoHotkey ahk_pid " . ErrorLevel)
DetectHiddenWindows Off

NotificationMsg = 0x5555 ; An arbitrary message number, but should be greater than 0x1000.
OnMessage(NotificationMsg, "ReceiveData")

FD_READ = 1 ; Received when data is available to be read.
FD_CLOSE = 32 ; Received when connection has been closed.
FD_CONNECT = 20 ; Recieved when connection has been made.
if DllCall("Ws2_32\WSAAsyncSelect", "UInt", socket, "UInt", ScriptMainWindowId, "UInt", NotificationMsg, "Int", FD_READ|FD_CLOSE|FD_CONNECT)
{
MsgBox % "WSAAsyncSelect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
ExitApp
}

Loop ; Wait for incomming connections
{
conectioncheck := DllCall("Ws2_32\accept", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
if conectioncheck> 1
{
MsgBox Incoming connection accepted
break
}
sleep 500
}
return

PrepareForIncomingConnection(IPAddress, Port)
{
VarSetCapacity(wsaData, 32) ; The struct is only about 14 in size, so 32 is conservative.
result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Request Winsock 2.0 (0x0002)
if ErrorLevel
{
MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required.
return -1
}
if result ; Non-zero, which means it failed (most Winsock functions return 0 upon success).
{
MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}

AF_INET = 2
SOCK_STREAM = 1
IPPROTO_TCP = 6
socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
if socket = -1
{
MsgBox % "socket() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}

SizeOfSocketAddress = 16
VarSetCapacity(SocketAddress, SizeOfSocketAddress)
InsertInteger(2, SocketAddress, 0, AF_INET) ; sin_family
InsertInteger(DllCall("Ws2_32\htons", "UShort", Port), SocketAddress, 2, 2) ; sin_port
InsertInteger(DllCall("Ws2_32\inet_addr", "Str", IPAddress), SocketAddress, 4, 4) ; sin_addr.s_addr

if DllCall("Ws2_32\bind", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
{
MsgBox % "bind() indicated ---- Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
return -1
}
if DllCall("Ws2_32\listen", "UInt", socket, "UInt", "SOMAXCONN")
{
MsgBox % "LISTEN() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
return -1
}

return socket ; Indicate success by returning a valid socket ID rather than -1.
}



ReceiveData(wParam, lParam)
{
global ShowRecieved
socket := wParam
ReceivedDataSize = 4096 ; Large in case a lot of data gets buffered due to delay in processing previous data.
Loop
{
VarSetCapacity(ReceivedData, ReceivedDataSize, 0)
ReceivedDataLength := DllCall("Ws2_32\recv", "UInt", socket, "Str", ReceivedData, "Int", ReceivedDataSize, "Int", 0)
if ReceivedDataLength = 0 ; The connection was gracefully closed,
ExitApp ; The OnExit routine will call WSACleanup() for us.
if ReceivedDataLength = -1
{
WinsockError := DllCall("Ws2_32\WSAGetLastError")
if WinsockError = 10035 ; WSAEWOULDBLOCK, which means "no more data to be read".
return 1
if WinsockError <10054> welcome, strlen(welcome) + 1, NULL);
}


InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
; The caller must ensure that pDest has sufficient capacity. To preserve any existing contents in pDest,
; only pSize number of bytes starting at pOffset are altered in it.
{
Loop %pSize% ; Copy each byte in the integer into the structure as raw binary data.
DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger>> 8*(A_Index-1) & 0xFF)
}



ExitSub: ; This subroutine is called automatically when the script exits for any reason.
DllCall("Ws2_32\WSACleanup")
ExitApp



Client:

; ------------------------------------------
;--------------CLIENTSCRIPT-----------------
; ---------------v-0.03b--------------------

; -----------KEY CONFIGURATION--------------
khit = {LButton}
kparrydown = {p down}
kparryup = {p up}
karm = {r}
krest = {7}
kmove = {up}
kmenuopen = {RButton}
kmenuclose = {LButton}
kmenuclick = right

; -------CHECK CONFIGURATION SECTION--------
Gosub, IniReadSettings
if (Network_Address = "ERROR" )
{
Gosub, IPPORTGUI
return
}

if (oShields = "ERROR")
{
Gosub, MeleeOptionsGUI
return
}

if (oShields = "")
{
Gosub, MeleeOptionsGUI
return
}

if (pweapon = "" OR pweapon = "ERROR" OR pshield = "" OR pshield = "ERROR")
{
Gosub, BPSetup
return
}

if (pxu = "ERROR")
{
Gosub, BPSetup
return
}

Gui, Add, Button, gIPPORTGUI, IP and Port Setup
Gui, Add, Button, gBPSetup, Backpack and Paperdoll Setup
Gui, Add, Button, gItemSearchGUI, Item Search Test
Gui, Add, Button, gKeySetupGUI, Key Setup
Gui, Add, Button, gTeleportGUI, Teleporthack
Gui, Add, Button, gMeleeOptionsGUI, Melee Options
Gui, Add, Button, gConnection_Init, Connect
Gui, Add, Button, gAbout, About
Gui, Show

return

; ------------GUI-MISC------------------

Restart:
Reload
return

ItemSearchGUI:
Gui, Destroy
Gui, Add, Text,, Remove your weapon and shield from the paperdoll!
Gui, Add, Text,, Mouse have to be in menu mode, not mouselook mode:
Gui, Add, Text,, Click button 1 ingame to test weapon search and equip paperdoll.
Gui, Add, Text,, Click button 2 ingame to test shield search and equip paperdoll.
Gui, Add, Button, gRestart, Exit
Gui, Show
Loop
{
if GetKeyState("1","P")
{
Gosub, SearchWeaponPaperdoll
}
else if GetKeyState("2","P")
{
Gosub, SearchShieldPaperdoll
}
}
return

MeleeOptionsGUI:
Gui, Destroy
Gui, Add, Text,, Check if using shields:
Gui, Add, Checkbox, voShields
Gui, Add, Button, gIniMelee, Save
Gui, Add, Button, gRestart, Exit
Gui, Show
return

IniMelee:
Gui, Submit
IniWrite, %oShields%, C:\ahk\config.ini, MeleeOptions, Shields
Reload
return

KeySetupGUI:
MsgBox Not done yet, will be added in the future.
return

TeleportGUI:
MsgBox HAR! You damn dirty cheating punk! Got ya noob :P
return

About:
MsgBox Network connection code was made by Zed Gecko @ Autohotkey forum. Thanks!
MsgBox Rest was made by a donkey. Yada yada blah blah... Version 0.03b
return

IPPORTGUI:
Gui, Destroy
Gui, Add, Text,, Please enter server network IP:
Gui, Add, Edit, vIP
Gui, Add, Text,, Please enter server network port:
Gui, Add, Edit, vPort
Gui, Add, Button, gIniIPPort, Save
Gui, Add, Button, gRestart, Exit
Gui, Show
return

IniIPPort:
Gui, Submit
IniWrite, %IP%, C:\ahk\config.ini, Network, IP
IniWrite, %Port%, C:\ahk\config.ini, Network, Port
Reload
return

; ------------TrainerSetupHandling------------------

BPSetup:
Gui, Destroy
Gui, Add, Text,, Paperdoll:
Gui, Add, Text,, Push key 1 in upper left above your weapon slots
Gui, Add, Text,, Push key 2 in lower right under your shield slots
Gui, Add, Text,, Backpack:
Gui, Add, Text,, Push key 3 in upper left (inside the wood please) corner of your backpack
Gui, Add, Text,, Push key 4 in lower right (inside the wood please) corner of your backpack
Gui, Add, Text,, Click the backpack, then push key 5 On your weapon and wait untill the mouse moves back (try to pick a unike color on that item, if possible)
Gui, Add, Text,, Click the backpack, then push key 6 On your shield and wait untill the mouse moves back (try to pick a unike color on that item, if possible)
Gui, Add, Button, gRestart, Done
Gui, Show
loop
{
if GetKeyState("1","P")
{
Gosub, IniWriteUpperPaperdoll
}
else if GetKeyState("2","P")
{
Gosub, IniWriteLowerPaperdoll
}
else if GetKeyState("3","P")
{
Gosub, IniWriteUpperBackpack
}
else if GetKeyState("4","P")
{
Gosub, IniWriteLowerBackpack
}
else if GetKeyState("5","P")
{
Gosub, IniWriteWeaponPixel
}
else if GetKeyState("6","P")
{
Gosub, IniWriteShieldPixel
}
}
return

IniReadSettings:
IniRead, pweapon, C:\AHK\config.ini, Items, weapon
IniRead, pshield, C:\AHK\config.ini, Items, shield

IniRead, pxu, C:\AHK\config.ini, paperdollCordsUpperLeft, x
IniRead, pyu, C:\AHK\config.ini, paperdollCordsUpperLeft, y

IniRead, pxl, C:\AHK\config.ini, paperdollCordsLowerRight, x
IniRead, pyl, C:\AHK\config.ini, paperdollCordsLowerRight, y

IniRead, bxu, C:\AHK\config.ini, backpackCordsUpperLeft, x
IniRead, byu, C:\AHK\config.ini, backpackCordsUpperLeft, y

IniRead, bxl, C:\AHK\config.ini, backpackCordsLowerRight, x
IniRead, byl, C:\AHK\config.ini, backpackCordsLowerRight, y

IniRead, Network_Address, C:\AHK\config.ini, Network, IP
IniRead, Network_Port, C:\AHK\config.ini, Network, Port

IniRead, oShields, C:\AHK\config.ini, MeleeOptions, Shields

return

IniWriteUpperPaperdoll:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, paperdollCordsUpperLeft, x
IniWrite, %y%, C:\ahk\config.ini, paperdollCordsUpperLeft, y
return

IniWriteLowerPaperdoll:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, paperdollCordsLowerRight, x
IniWrite, %y%, C:\ahk\config.ini, paperdollCordsLowerRight, y
return

IniWriteUpperBackpack:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, backpackCordsUpperLeft, x
IniWrite, %y%, C:\ahk\config.ini, backpackCordsUpperLeft, y
return

IniWriteLowerBackpack:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, backpackCordsLowerRight, x
IniWrite, %y%, C:\ahk\config.ini, backpackCordsLowerRight, y
return

; ------------PixelSearchHandlingNEW------------------

IniWriteWeaponPixel:
MouseGetPos, x, y
MouseMove, 0, 0
sleep 1000
PixelGetColor, color, %x%, %y%
IniWrite, %color%, C:\ahk\config.ini, Items, weapon
sleep 1000
MouseMove, x, y
return

IniWriteShieldPixel:
MouseGetPos, x, y
MouseMove, 0, 0
sleep 1000
PixelGetColor, color, %x%, %y%
IniWrite, %color%, C:\ahk\config.ini, Items, shield
sleep 1000
MouseMove, x, y
return


; ------------ItemSearchHandling------------------
SearchWeaponPaperdoll:
px := round((pxl - pxu )/2+ pxu)
py := round(pyu-(pyl - pyu ))
MouseClick, %kmenuclick%, %px%, %py%, 1
sleep 300
PixelSearch oX, oY, pxu, pyu, pxl, pyl, pweapon, 1, Fast
if ErrorLevel
Gosub, SearchWeaponBackpack
return
return

SearchShieldPaperdoll:
px := round((pxl - pxu )/2+ pxu)
py := round(pyu-(pyl - pyu ))
MouseClick, %kmenuclick%, %px%, %py%, 1
sleep 300
PixelSearch, oX, oY, pxu, pyu, pxl, pyl, pshield, 1, Fast
if ErrorLevel
Gosub, SearchShieldBackpack
return
return

SearchWeaponBackpack:
bx := round((bxl - bxu )/2 + bxu)
by := round((byl - byu )/2 + byu)
MouseClick, %kmenuclick%, %bx%, %by%, 1
sleep 300
PixelSearch, oX, oY, bxu, byu, bxl, byl, pweapon, 1, Fast
if ErrorLevel
return
else
MouseClick, %kmenuclick%, %oX%, %oY%, 3
return
return

SearchShieldBackpack:
bx := round((bxl - bxu )/2 + bxu)
by := round((byl - byu )/2 + byu)
MouseClick, %kmenuclick%, %bx%, %by%, 1
sleep 300
PixelSearch, oX, oY, bxu, byu, bxl, byl, pshield, 1, Fast
if ErrorLevel
return
else
MouseClick, %kmenuclick%, %oX%, %oY%, 3
return
return


Menu:
sleep 200
send % kmenuopen
sleep 200
return


; ------------ConnectionHandling------------------

Connection_Init:
OnExit, ExitSub ; For connection cleanup purposes.

socket := ConnectToAddress(Network_Address, Network_Port)
if socket = -1 ; Connection failed (it already displayed the reason).
ExitApp

Process, Exist ; This sets ErrorLevel to this script's PID (it's done this way to support compiled scripts).
DetectHiddenWindows On
ScriptMainWindowId := WinExist("ahk_class AutoHotkey ahk_pid " . ErrorLevel)
DetectHiddenWindows Off

NotificationMsg = 0x5555 ; An arbitrary message number, but should be greater than 0x1000.
OnMessage(NotificationMsg, "ReceiveData")

FD_READ = 1 ; Received when data is available to be read.
FD_CLOSE = 32 ; Received when connection has been closed.
if DllCall("Ws2_32\WSAAsyncSelect", "UInt", socket, "UInt", ScriptMainWindowId, "UInt", NotificationMsg, "Int", FD_READ|FD_CLOSE)
{
MsgBox % "WSAAsyncSelect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
ExitApp
}
return

SendviaNet:
Gui, Submit, NoHide
SendData(socket,SendText)
SentText =
return

ConnectToAddress(IPAddress, Port)
{
VarSetCapacity(wsaData, 32) ; The struct is only about 14 in size, so 32 is conservative.
result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Request Winsock 2.0 (0x0002)
if ErrorLevel
{
MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required.
return -1
}
if result ; Non-zero, which means it failed (most Winsock functions return 0 upon success).
{
MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}

AF_INET = 2
SOCK_STREAM = 1
IPPROTO_TCP = 6
socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
if socket = -1
{
MsgBox % "socket() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}

SizeOfSocketAddress = 16
VarSetCapacity(SocketAddress, SizeOfSocketAddress)
InsertInteger(2, SocketAddress, 0, AF_INET) ; sin_family
InsertInteger(DllCall("Ws2_32\htons", "UShort", Port), SocketAddress, 2, 2) ; sin_port
InsertInteger(DllCall("Ws2_32\inet_addr", "Str", IPAddress), SocketAddress, 4, 4) ; sin_addr.s_addr

if DllCall("Ws2_32\connect", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
{
MsgBox % "connect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
return -1
}
return socket ; Indicate success by returning a valid socket ID rather than -1.
}



ReceiveData(wParam, lParam)
{
global ShowRecieved
global khit
global kparrydown
global kparryup
global karm
global krest
global kmove
global kmenuopen
global kmenuclose
global kmenuclick
global oShields
global pxu
global pyu
global pxl
global pyl
global bxu
global byu
global bxl
global byl
global ActionArray
global pweapon
global pshield

socket := wParam
ReceivedDataSize = 4096
Loop
{
VarSetCapacity(ReceivedData, ReceivedDataSize, 0) ; 0 for last param terminates string for use with recv().
ReceivedDataLength := DllCall("Ws2_32\recv", "UInt", socket, "Str", ReceivedData, "Int", ReceivedDataSize, "Int", 0)
if ReceivedDataLength = 0 ; The connection was gracefully closed,
ExitApp
if ReceivedDataLength = -1
{
WinsockError := DllCall("Ws2_32\WSAGetLastError")
if WinsockError = 10035
return 1
if WinsockError <10054>> 8*(A_Index-1) & 0xFF)
}



ExitSub:
DllCall("Ws2_32\WSACleanup")
ExitApp


Reply with quote
Posted: June 8th, 2009, 4:46 am
 
wired123

Total Posts: 28
Joined: June 3rd, 2008, 6:08 am
wired123's Reps: 1
User avatar
premium
this is a script that has been posted without the writer's consent. please remove.


Reply with quote
Posted: June 8th, 2009, 11:35 am
 
ragsta9

Total Posts: 24
Joined: April 8th, 2009, 1:38 pm
ragsta9's Reps: 2
User avatar
I can also verify that this is a private script posted without consent.

Please remove and ban.


Reply with quote
Posted: June 8th, 2009, 5:14 pm
 
tault_frosaly

Total Posts: 19
Joined: August 21st, 2004, 4:40 pm
tault_frosaly's Reps: 0
User avatar
Cry more for me sharing a script I got from a friend. Stupid carebears.


Reply with quote
Posted: June 8th, 2009, 6:39 pm
 
wired123

Total Posts: 28
Joined: June 3rd, 2008, 6:08 am
wired123's Reps: 1
User avatar
premium
nobody here is crying, you post the macro as if you are taking credit for someone else's work.

don't be a tool.


Reply with quote
Posted: June 8th, 2009, 7:31 pm
 
tault_frosaly

Total Posts: 19
Joined: August 21st, 2004, 4:40 pm
tault_frosaly's Reps: 0
User avatar
I'm not trying to take credit for anything, Note how I said it took me hours to figure it out, not to make it. Besides, I'm already a full member.

My only purpose is sharing the wealth with everyone. This is an exploiters site not and intelectual property symposium.

Sue me.


Reply with quote
Posted: June 9th, 2009, 6:48 am
 
dabladest

Total Posts: 191
Joined: March 6th, 2009, 5:00 am
dabladest's Reps: 11
User avatar
Active User > 50 Posts
Ban ? What for ? I somewhat agree with the OP, that this is an Exploit site. He got his hand on something that helps "exploiting" the game and he posted it.
We would have more content if everybody did it.

But I do agree, that he should have given credit for it definately !


Reply with quote
Posted: June 9th, 2009, 8:59 am
 
tault_frosaly

Total Posts: 19
Joined: August 21st, 2004, 4:40 pm
tault_frosaly's Reps: 0
User avatar
I admit I didn't create it. Never said otherwise.

To me it's a mystery who made it, since I got it from the grapevine.

But, I give kudos to whoever created this script.


Reply with quote
Posted: June 9th, 2009, 10:53 am
 
Tault_admin

Total Posts: 29974
Joined: November 9th, 2002, 9:57 am
Tault_admin's Reps: 1444
User avatar
administrator
Mod in Training
So he found a macro from a friend, then posted it here, now members are made he posted it because only a few people knew it originally? Seems like some members are trying to just horde stuff instead of helping the community to me.


Reply with quote
Posted: June 9th, 2009, 1:10 pm
 
ragsta9

Total Posts: 24
Joined: April 8th, 2009, 1:38 pm
ragsta9's Reps: 2
User avatar
I believe we should all be helping eachother out, I just think people should give appropriate credit.

For instance, someone here named Eiles spent a lot of time writing a great macro and I appreciate it very much. I'm just all about the original "finder" getting credit. :)


Reply with quote
Posted: June 9th, 2009, 1:12 pm
 
Tault_admin

Total Posts: 29974
Joined: November 9th, 2002, 9:57 am
Tault_admin's Reps: 1444
User avatar
administrator
Mod in Training
I agree i think he needs to give credit as thats not acceptable but it seems more like there is a witch hunt for a few members that want to horde some scripts which if thats the case they have no sympathy as they are just hurting the community from greed.


Reply with quote
Posted: June 9th, 2009, 5:18 pm
 
tault_frosaly

Total Posts: 19
Joined: August 21st, 2004, 4:40 pm
tault_frosaly's Reps: 0
User avatar
Yup, the admin is in the know.

I could care less if I get tault bucks or not, since I'm already a full member for a year.

Only reason I can imagine for people wanting me banned and post deleted is they want to hoard it and prevent others from using it.

As a matter of fact, even if it gets yay'ed don't give me any bucks. Just to prove that I did it for the community and not to get some weird credit for myself.


Reply with quote
Posted: June 10th, 2009, 2:56 am
 
sztorm

Total Posts: 3
Joined: April 27th, 2006, 1:24 am
sztorm's Reps: 0
User avatar
Do not work SendData and other functions not defined


Reply with quote
Posted: June 10th, 2009, 9:11 am
 
tault_frosaly

Total Posts: 19
Joined: August 21st, 2004, 4:40 pm
tault_frosaly's Reps: 0
User avatar
Did you input the key configuration you use?

Also make sure that you NAT the port you will be using (I used 8750)

Save the script to C:\AHK as a .ahk (Server will save as server.ahk, Client will save as client.ahk

If you didn't get the winsock error then your IP should be correct...

Make sure you're setting up your paperdoll, backpack and weapon/shield correctly.

Maybe try running the Weapon Finder to see if it's recognizing your weapons.


Reply with quote
Posted: June 12th, 2009, 1:53 am
 
sztorm

Total Posts: 3
Joined: April 27th, 2006, 1:24 am
sztorm's Reps: 0
User avatar
Hello,

thats not a problem of setup. Code is not complete. For example i made server script as it is below try to run it. It do not need even darkfall to show errors. There are just missing parts i think. Can you send working client or server code? Not one file with two scripts but one file server second file client. I think merging two scripts into one file maybe made errors. I found original

Below just cut and past - error is

Line 539 Functions can not contain functions


; ------------------------------------------
; ------------SERVERSCRIPT------------------
; ---------------v-0.03b--------------------

; -----------KEY CONFIGURATION--------------
khit = {RButton}
kparrydown = {LButton down}
kparryup = {LButton up}
karm = {MButton}
krest = {7}
kmove = {numpad8}
kmenuopen = {PgDn}
kmenuclose = {PgDn}
kmenuclick = right

; -------CHECK CONFIGURATION SECTION--------
Gosub, IniReadSettings
if (Network_Address = "ERROR" )
{
Gosub, IPPORTGUI
return
}

if (oEmo = "ERROR" OR oHits = "ERROR" OR oShields = "ERROR" OR oHitDelay = "ERROR" OR oRest = "ERROR" OR oProfile = "ERROR" )
{
Gosub, MeleeOptionsGUI
return
}

if (oEmo = "" OR oHits = "" OR oShields = "" OR oHitDelay = "" OR oRest = "" OR oProfile = "" )
{
Gosub, MeleeOptionsGUI
return
}

if (pweapon = "" OR pweapon = "ERROR" OR pshield = "" OR pshield = "ERROR")
{
Gosub, BPSetup
return
}

if (pxu = "ERROR")
{
Gosub, BPSetup
return
}

Main:
Gui, Destroy
Gui, Add, Button, gIPPORTGUI, IP and Port Setup
Gui, Add, Button, gBPSetup, Backpack and Paperdoll Setup
Gui, Add, Button, gItemSearchGUI, Item Search Test
Gui, Add, Button, gKeySetupGUI, Key Setup
Gui, Add, Button, gTeleportGUI, Teleporthack
Gui, Add, Button, gMeleeOptionsGUI, Melee Options
Gui, Add, Button, gMeleeStart, Melee Start
Gui, Add, Button, gAbout, About
Gui, Show

Gosub Connection_Init

return

MeleeStart:
Gui, Submit, NoHide
loop
{
;Gosub, IniReadSettings
weapons = 1
counter = 1
;change = 10
dcast = 5000
darm = 1000
dsmall = 1000
dserver = 200

sleep 3000

loop
{
if(oProfile = 1 OR oProfile = 2)
{
;Hit start
SendText = parry %oHitDelay%
SendData(conectioncheck,SendText)
sleep dserver
send % khit
sleep oHitDelay
sleep 100
;Hit end
}
if(oProfile = 1 OR oProfile = 3 )
{
;Parry start
SendText = hit %oHitDelay%
SendData(conectioncheck,SendText)
dparry := oHitDelay - 400
sleep 500
send % kparrydown
sleep dparry
send % kparryup
;Parry end
}
sleep dserver
if(counter = oHits)
{
;Emo-donkey-mode
loop, % oEmo
{
;Hit start
SendText = hit %oHitDelay%
SendData(conectioncheck,SendText)
sleep dserver
send % khit
sleep oHitDelay
sleep 100
;Hit end
}
sleep 1000
SendText = rest %oRest%
SendData(conectioncheck,SendText)
counter = 0

;rest start
loop, % oRest
{
send % karm
sleep darm
send % krest
sleep dserver
send % khit
}

sleep darm

loop, 3
{
send % kmove
sleep dsmall
}

sleep 2000
;rest stop
send % kmenuopen
sleep 1000
;Weapon Change Start
Gosub, SearchWeaponPaperdoll
sleep 1000
if oShields = 1
Gosub, SearchShieldPaperdoll
sleep 2000
send % kmenuclose
sleep 1000
send % karm
sleep darm
;Weapon Change Stop
sleep 5000
}

counter++


}
}
SentText =
return

; ------------GUI-MISC------------------

Restart:
Reload
return

ItemSearchGUI:
Gui, Destroy
Gui, Add, Text,, Remove your weapon and shield from the paperdoll!
Gui, Add, Text,, Mouse have to be in menu mode, not mouselook mode:
Gui, Add, Text,, Click button 1 ingame to test weapon search and equip paperdoll.
Gui, Add, Text,, Click button 2 ingame to test shield search and equip paperdoll.
Gui, Add, Button, gRestart, Exit
Gui, Show
Loop
{
if GetKeyState("1","P")
{
Gosub, SearchWeaponPaperdoll
}
else if GetKeyState("2","P")
{
Gosub, SearchShieldPaperdoll
}
}
return

MeleeOptionsGUI:
Gui, Destroy
Gui, Add, Text,, Number of hits before going to emo:
Gui, Add, Edit, voHits
Gui, Add, Text,, Number of emo-hits:
Gui, Add, Edit, voEmo
Gui, Add, Text,, Delay between hits, in ms (1 sec = 1000 ms):
Gui, Add, Edit, voHitDelay
Gui, Add, Text,, How many times to rest 1200ms:
Gui, Add, Edit, voRest
Gui, Add, Text,, Check if using shields:
Gui, Add, Checkbox, voShields
Gui, Add, Text,, Profile 1: Server and client hit n parry
Gui, Add, Text,, Profile 2: Server hit only, client parry only
Gui, Add, Text,, Profile 3: Server parry only, client hit only
Gui, Add, Text,, Select a profile:
Gui, Add, DropDownList, voProfile, 1|2|3
Gui, Add, Button, gIniMelee, Save
Gui, Add, Button, gRestart, Exit
Gui, Show
return

IniMelee:
Gui, Submit
IniWrite, %oHits%, C:\ahk\config.ini, MeleeOptions, Hits
IniWrite, %oEmo%, C:\ahk\config.ini, MeleeOptions, Emo
IniWrite, %oShields%, C:\ahk\config.ini, MeleeOptions, Shields
IniWrite, %oHitDelay%, C:\ahk\config.ini, MeleeOptions, HitDelay
IniWrite, %oRest%, C:\ahk\config.ini, MeleeOptions, Rest
IniWrite, %oProfile%, C:\ahk\config.ini, MeleeOptions, Profile
Reload
return

KeySetupGUI:
MsgBox Not done yet, will be added in the future.
return

TeleportGUI:
MsgBox HAR! You damn dirty cheating punk! Got ya noob Razz
return

About:
MsgBox Network connection code was made by Zed Gecko @ Autohotkey forum. Thanks!
MsgBox Rest was made by a donkey. Yada yada blah blah... Version 0.03b
return

IPPORTGUI:
Gui, Destroy
Gui, Add, Text,, Please enter your network IP:
Gui, Add, Edit, vIP
Gui, Add, Text,, Please enter your network port:
Gui, Add, Edit, vPort
Gui, Add, Button, gIniIPPort, Save
Gui, Add, Button, gRestart, Exit
Gui, Show
return

IniIPPort:
Gui, Submit
IniWrite, %IP%, C:\ahk\config.ini, Network, IP
IniWrite, %Port%, C:\ahk\config.ini, Network, Port
Reload
return


; ------------TrainerSetupHandling------------------

BPSetup:
Gui, Destroy
Gui, Add, Text,, Paperdoll:
Gui, Add, Text,, Push key 1 in upper left above your weapon slots
Gui, Add, Text,, Push key 2 in lower right under your shield slots
Gui, Add, Text,, Backpack:
Gui, Add, Text,, Push key 3 in upper left (inside the wood please) corner of your backpack
Gui, Add, Text,, Push key 4 in lower right (inside the wood please) corner of your backpack
Gui, Add, Text,, Click the backpack, then push key 5 On your weapon and wait untill the mouse moves back (try to pick a unike color on that item, if possible)
Gui, Add, Text,, Click the backpack, then push key 6 On your shield and wait untill the mouse moves back (try to pick a unike color on that item, if possible)
Gui, Add, Button, gRestart, Done
Gui, Show
loop
{
if GetKeyState("1","P")
{
Gosub, IniWriteUpperPaperdoll
}
else if GetKeyState("2","P")
{
Gosub, IniWriteLowerPaperdoll
}
else if GetKeyState("3","P")
{
Gosub, IniWriteUpperBackpack
}
else if GetKeyState("4","P")
{
Gosub, IniWriteLowerBackpack
}
else if GetKeyState("5","P")
{
Gosub, IniWriteWeaponPixel
}
else if GetKeyState("6","P")
{
Gosub, IniWriteShieldPixel
}
}
return

IniReadSettings:
IniRead, pweapon, C:\AHK\config.ini, Items, weapon
IniRead, pshield, C:\AHK\config.ini, Items, shield

IniRead, pxu, C:\AHK\config.ini, paperdollCordsUpperLeft, x
IniRead, pyu, C:\AHK\config.ini, paperdollCordsUpperLeft, y

IniRead, pxl, C:\AHK\config.ini, paperdollCordsLowerRight, x
IniRead, pyl, C:\AHK\config.ini, paperdollCordsLowerRight, y

IniRead, bxu, C:\AHK\config.ini, backpackCordsUpperLeft, x
IniRead, byu, C:\AHK\config.ini, backpackCordsUpperLeft, y

IniRead, bxl, C:\AHK\config.ini, backpackCordsLowerRight, x
IniRead, byl, C:\AHK\config.ini, backpackCordsLowerRight, y

IniRead, Network_Address, C:\AHK\config.ini, Network, IP
IniRead, Network_Port, C:\AHK\config.ini, Network, Port

IniRead, oHits, C:\AHK\config.ini, MeleeOptions, Hits
IniRead, oEmo, C:\AHK\config.ini, MeleeOptions, Emo
IniRead, oShields, C:\AHK\config.ini, MeleeOptions, Shields
IniRead, oHitDelay, C:\AHK\config.ini, MeleeOptions, HitDelay
IniRead, oRest, C:\AHK\config.ini, MeleeOptions, Rest
IniRead, oProfile, C:\AHK\config.ini, MeleeOptions, Profile

return

IniWriteUpperPaperdoll:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, paperdollCordsUpperLeft, x
IniWrite, %y%, C:\ahk\config.ini, paperdollCordsUpperLeft, y
return

IniWriteLowerPaperdoll:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, paperdollCordsLowerRight, x
IniWrite, %y%, C:\ahk\config.ini, paperdollCordsLowerRight, y
return

IniWriteUpperBackpack:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, backpackCordsUpperLeft, x
IniWrite, %y%, C:\ahk\config.ini, backpackCordsUpperLeft, y
return

IniWriteLowerBackpack:
MouseGetPos, x, y
IniWrite, %x%, C:\ahk\config.ini, backpackCordsLowerRight, x
IniWrite, %y%, C:\ahk\config.ini, backpackCordsLowerRight, y
return

; ------------PixelSearchHandlingNEW------------------

IniWriteWeaponPixel:
MouseGetPos, x, y
MouseMove, 0, 0
sleep 1000
PixelGetColor, color, %x%, %y%
IniWrite, %color%, C:\ahk\config.ini, Items, weapon
sleep 1000
MouseMove, x, y
return

IniWriteShieldPixel:
MouseGetPos, x, y
MouseMove, 0, 0
sleep 1000
PixelGetColor, color, %x%, %y%
IniWrite, %color%, C:\ahk\config.ini, Items, shield
sleep 1000
MouseMove, x, y
return


; ------------ItemSearchHandling------------------
SearchWeaponPaperdoll:
px := round((pxl - pxu )/2+ pxu)
py := round(pyu-(pyl - pyu ))
MouseClick, %kmenuclick%, %px%, %py%, 1
sleep 300
PixelSearch oX, oY, pxu, pyu, pxl, pyl, pweapon, 1, Fast
if ErrorLevel
Gosub, SearchWeaponBackpack
return
return

SearchShieldPaperdoll:
px := round((pxl - pxu )/2+ pxu)
py := round(pyu-(pyl - pyu ))
MouseClick, %kmenuclick%, %px%, %py%, 1
sleep 300
PixelSearch, oX, oY, pxu, pyu, pxl, pyl, pshield, 1, Fast
if ErrorLevel
Gosub, SearchShieldBackpack
return
return

SearchWeaponBackpack:
bx := round((bxl - bxu )/2 + bxu)
by := round((byl - byu )/2 + byu)
MouseClick, %kmenuclick%, %bx%, %by%, 1
sleep 300
PixelSearch, oX, oY, bxu, byu, bxl, byl, pweapon, 1, Fast
if ErrorLevel
return
else
MouseClick, %kmenuclick%, %oX%, %oY%, 3
return
return

SearchShieldBackpack:
bx := round((bxl - bxu )/2 + bxu)
by := round((byl - byu )/2 + byu)
MouseClick, %kmenuclick%, %bx%, %by%, 1
sleep 300
PixelSearch, oX, oY, bxu, byu, bxl, byl, pshield, 1, Fast
if ErrorLevel
return
else
MouseClick, %kmenuclick%, %oX%, %oY%, 3
return
return


Menu:
sleep 200
send % kmenuopen
sleep 200
return

; ------------ConnectionHandling------------------

Connection_Init:
OnExit, ExitSub ; For connection cleanup purposes.

socket := PrepareForIncomingConnection(Network_Address, Network_Port)
if socket = -1 ; Connection failed (it already displayed the reason).
ExitApp

Process, Exist ; This sets ErrorLevel to this script's PID (it's done this way to support compiled scripts).
DetectHiddenWindows On
ScriptMainWindowId := WinExist("ahk_class AutoHotkey ahk_pid " . ErrorLevel)
DetectHiddenWindows Off

NotificationMsg = 0x5555 ; An arbitrary message number, but should be greater than 0x1000.
OnMessage(NotificationMsg, "ReceiveData")

FD_READ = 1 ; Received when data is available to be read.
FD_CLOSE = 32 ; Received when connection has been closed.
FD_CONNECT = 20 ; Recieved when connection has been made.
if DllCall("Ws2_32\WSAAsyncSelect", "UInt", socket, "UInt", ScriptMainWindowId, "UInt", NotificationMsg, "Int", FD_READ|FD_CLOSE|FD_CONNECT)
{
MsgBox % "WSAAsyncSelect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
ExitApp
}

Loop ; Wait for incomming connections
{
conectioncheck := DllCall("Ws2_32\accept", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
if conectioncheck> 1
{
MsgBox Incoming connection accepted
break
}
sleep 500
}
return

PrepareForIncomingConnection(IPAddress, Port)
{
VarSetCapacity(wsaData, 32) ; The struct is only about 14 in size, so 32 is conservative.
result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Request Winsock 2.0 (0x0002)
if ErrorLevel
{
MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required.
return -1
}
if result ; Non-zero, which means it failed (most Winsock functions return 0 upon success).
{
MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}

AF_INET = 2
SOCK_STREAM = 1
IPPROTO_TCP = 6
socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
if socket = -1
{
MsgBox % "socket() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}

SizeOfSocketAddress = 16
VarSetCapacity(SocketAddress, SizeOfSocketAddress)
InsertInteger(2, SocketAddress, 0, AF_INET) ; sin_family
InsertInteger(DllCall("Ws2_32\htons", "UShort", Port), SocketAddress, 2, 2) ; sin_port
InsertInteger(DllCall("Ws2_32\inet_addr", "Str", IPAddress), SocketAddress, 4, 4) ; sin_addr.s_addr

if DllCall("Ws2_32\bind", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
{
MsgBox % "bind() indicated ---- Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
return -1
}
if DllCall("Ws2_32\listen", "UInt", socket, "UInt", "SOMAXCONN")
{
MsgBox % "LISTEN() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
return -1
}

return socket ; Indicate success by returning a valid socket ID rather than -1.
}



ReceiveData(wParam, lParam)
{
global ShowRecieved
socket := wParam
ReceivedDataSize = 4096 ; Large in case a lot of data gets buffered due to delay in processing previous data.
Loop
{
VarSetCapacity(ReceivedData, ReceivedDataSize, 0)
ReceivedDataLength := DllCall("Ws2_32\recv", "UInt", socket, "Str", ReceivedData, "Int", ReceivedDataSize, "Int", 0)
if ReceivedDataLength = 0 ; The connection was gracefully closed,
ExitApp ; The OnExit routine will call WSACleanup() for us.
if ReceivedDataLength = -1
{
WinsockError := DllCall("Ws2_32\WSAGetLastError")
if WinsockError = 10035 ; WSAEWOULDBLOCK, which means "no more data to be read".
return 1
if WinsockError <10054> welcome, strlen(welcome) + 1, NULL);
}


InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
; The caller must ensure that pDest has sufficient capacity. To preserve any existing contents in pDest,
; only pSize number of bytes starting at pOffset are altered in it.
{
Loop %pSize% ; Copy each byte in the integer into the structure as raw binary data.
DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger>> 8*(A_Index-1) & 0xFF)
}



ExitSub: ; This subroutine is called automatically when the script exits for any reason.
DllCall("Ws2_32\WSACleanup")
ExitApp





============================

I found also original code for sending messages between PC. THis was the base for above client and server scripts and this code works. See:

; -------------------------------------------------
;-----------CLIENTSCRIPT----------------------
; -------------------------------------------------
; CONFIGURATION SECTION:

; Specify address and port of the server.
Network_Address = 127.0.0.1
Network_Port = 8765
; ----------------------------
; END OF CONFIGURATION SECTION
; ----------------------------

Gui, Add, Edit, w100 vSendText
Gui, Add, Button, gSendviaNet, Send
Gui, Add, Button, gConnection_Init, Connect
Gui, Show

return


Connection_Init:
OnExit, ExitSub ; For connection cleanup purposes.

; Connect to any type of server:
socket := ConnectToAddress(Network_Address, Network_Port)
if socket = -1 ; Connection failed (it already displayed the reason).
ExitApp

; Find this script's main window:
Process, Exist ; This sets ErrorLevel to this script's PID (it's done this way to support compiled scripts).
DetectHiddenWindows On
ScriptMainWindowId := WinExist("ahk_class AutoHotkey ahk_pid " . ErrorLevel)
DetectHiddenWindows Off

; When the OS notifies the script that there is incoming data waiting to be received,
; the following causes a function to be launched to read the data:
NotificationMsg = 0x5555 ; An arbitrary message number, but should be greater than 0x1000.
OnMessage(NotificationMsg, "ReceiveData")

; Set up the connection to notify this script via message whenever new data has arrived.
; This avoids the need to poll the connection and thus cuts down on resource usage.
FD_READ = 1 ; Received when data is available to be read.
FD_CLOSE = 32 ; Received when connection has been closed.
if DllCall("Ws2_32\WSAAsyncSelect", "UInt", socket, "UInt", ScriptMainWindowId, "UInt", NotificationMsg, "Int", FD_READ|FD_CLOSE)
{
MsgBox % "WSAAsyncSelect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
ExitApp
}
return

SendviaNet:
Gui, Submit, NoHide
SendData(socket,SendText)
SentText =
return

ConnectToAddress(IPAddress, Port)
; Returns -1 (INVALID_SOCKET) upon failure or the socket ID upon success.
{
VarSetCapacity(wsaData, 32) ; The struct is only about 14 in size, so 32 is conservative.
result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Request Winsock 2.0 (0x0002)
; Since WSAStartup() will likely be the first Winsock function called by this script,
; check ErrorLevel to see if the OS has Winsock 2.0 available:
if ErrorLevel
{
MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required.
return -1
}
if result ; Non-zero, which means it failed (most Winsock functions return 0 upon success).
{
MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}

AF_INET = 2
SOCK_STREAM = 1
IPPROTO_TCP = 6
socket := DllCall("Ws2_32\socket", "Int", AF_INET, "Int", SOCK_STREAM, "Int", IPPROTO_TCP)
if socket = -1
{
MsgBox % "socket() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError")
return -1
}

; Prepare for connection:
SizeOfSocketAddress = 16
VarSetCapacity(SocketAddress, SizeOfSocketAddress)
InsertInteger(2, SocketAddress, 0, AF_INET) ; sin_family
InsertInteger(DllCall("Ws2_32\htons", "UShort", Port), SocketAddress, 2, 2) ; sin_port
InsertInteger(DllCall("Ws2_32\inet_addr", "Str", IPAddress), SocketAddress, 4, 4) ; sin_addr.s_addr

; Attempt connection:
if DllCall("Ws2_32\connect", "UInt", socket, "UInt", &SocketAddress, "Int", SizeOfSocketAddress)
{
MsgBox % "connect() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") . "?"
return -1
}
return socket ; Indicate success by returning a valid socket ID rather than -1.
}



ReceiveData(wParam, lParam)
; By means of OnMessage(), this function has been set up to be called automatically whenever new data
; arrives on the connection.
{
global ShowRecieved
socket := wParam
ReceivedDataSize = 4096 ; Large in case a lot of data gets buffered due to delay in processing previous data.
Loop ; This loop solves the issue of the notification message being discarded due to thread-already-running.
{
VarSetCapacity(ReceivedData, ReceivedDataSize, 0) ; 0 for last param terminates string for use with recv().
ReceivedDataLength := DllCall("Ws2_32\recv", "UInt", socket, "Str", ReceivedData, "Int", ReceivedDataSize, "Int", 0)
if ReceivedDataLength = 0 ; The connection was gracefully closed,
ExitApp ; The OnExit routine will call WSACleanup() for us.
if ReceivedDataLength = -1
{
WinsockError := DllCall("Ws2_32\WSAGetLastError")
if WinsockError = 10035 ; WSAEWOULDBLOCK, which means "no more data to be read".
return 1
if WinsockError <> 10054 ; WSAECONNRESET, which happens when Network closes via system shutdown/logoff.
; Since it's an unexpected error, report it. Also exit to avoid infinite loop.
MsgBox % "recv() indicated Winsock error " . WinsockError
ExitApp ; The OnExit routine will call WSACleanup() for us.
}
; Otherwise, process the data received.
Loop, parse, ReceivedData, `n, `r
{
ShowRecieved = %ShowRecieved%%A_LoopField%
Tooltip % ShowRecieved
}
}
return 1 ; Tell the program that no further processing of this message is needed.
}

SendData(wParam,SendData)
{
socket := wParam
;MsgBox %socket% %SendData%
SendDataSize := VarSetCapacity(SendData)
SendDataSize += 1
sendret := DllCall("Ws2_32\send", "UInt", socket, "Str", SendData, "Int", SendDatasize, "Int", 0)
;send( sockConnected,> welcome, strlen(welcome) + 1, NULL);
}


InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4)
; The caller must ensure that pDest has sufficient capacity. To preserve any existing contents in pDest,
; only pSize number of bytes starting at pOffset are altered in it.
{
Loop %pSize% ; Copy each byte in the integer into the structure as raw binary data.
DllCall("RtlFillMemory", "UInt", &pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}



ExitSub: ; This subroutine is called automatically when the script exits for any reason.
; MSDN: "Any sockets open when WSACleanup is called are reset and automatically
; deallocated as if closesocket was called."
DllCall("Ws2_32\WSACleanup")
ExitApp


Reply with quote
Want Advertisements After The Last Post Removed? Create A Free Account!

blue large dot Who is online
Users browsing this forum: No registered users and 17 guests

Popular Sections
SWTOR Cheats
Guild Wars 2 Cheats
Guild Wars 2 Hacks
Guild Wars 2 Bots
Diablo 3 Cheats
Guild Wars 2 Mods

Popular Sections
WoW Cataclysm Cheats & Exploits
WoW Cataclysm Hacks & Bots
Star Wars The Old Republic Cheats
SWTOR Mods
Torchlight 2 Cheats
SWTOR Space Mission Bots
Site Nav and RSS
RSS Feed of Darkfall Online - Submissions RSS Feed 
Sitemap of Darkfall Online - Submissions Sitemap 
SitemapIndex SitemapIndex
RSS Feed RSS Feed
Channel list Channel list
left bottom corner Site and Contents Copyright 2001-2012 All Rights Reserved TaultUnleashed.com bottom corner
top left
top right
createaccount
Username:   Password:   Remember Me?