Jump to content

DAoC Lagger program - Needs work


Nezoic
 Share

Recommended Posts

This is a program I wrote to basically drag your chat window around in DAoC. It works to some extent but not as well as if you do it manually. I cannot figure out a way to make the mouse movements any quicker to completely lockup the chat window. As it is now it will keep moving it around and create a small amount of lagg and in some cases 5-10 seconds of straight lockup altho it is not consistant.

For those that dont know, this makes your character ghost in game and people cannot hit you if it works right. This program is just in testing phase and currently has about 50 / 50 chance to work under the right conditions.

Rightclick in game on the Chatwindow Resize to lock the mouse position. Click run, then use NUMPAD 0 and NUMPADOT in game to start / pause the script.

My first program with AutoIT so dont laugh too much

Global $Paused
Global $x
Global $y
#include <GUIConstants.au3>
GUICreate("Ghost Lagger v1.0", 400, 230)
$helpmenu = GUICtrlCreateMenu ("?")
$infoitem = GUICtrlCreateMenuitem ("Info",$helpmenu)
 
$btnOK = GUICtrlCreateButton("Exit", 230, 165, 60)
$btnRun = GUICtrlCreateButton("Run", 110, 165, 60)

GUICtrlCreateLabel ( "Current Position", 5, 15, 90, 30)
$xPos = GUICtrlCreateInput ( 0, 100, 15, 40, 20)
$yPos = GUICtrlCreateInput ( 0, 155, 15, 40, 20)

GUICtrlCreateLabel ( "Lock Position", 5, 35, 90, 30); 
$xPosLock = GUICtrlCreateInput ( 0, 100, 35, 40, 20)
$yPosLock = GUICtrlCreateInput ( 0, 155, 35, 40, 20)

GUISetState()

while 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE OR $msg = $btnOK Then ExitLoop   
    If $msg = $GUI_EVENT_CLOSE OR $msg = $btnRUN Then Main()
    If $msg = $infoitem Then Msgbox(0,"Info","Run DAOC In Windowed _
    Mode. Move mouse over your chat window resizer in game and right_
    click. When mouse position is locked click run. Use Numberpad 0_
    to start and .to stop.")

    $pos = MouseGetPos()
    GUICtrlSetData($xPos, $pos[0])
    GUICtrlSetData($yPos, $pos[1])
    If _IsPressed('02') = 1 Then PosLock()

    sleep(10)
Wend

Func PosLock()
   GUICtrlSetData($xPosLock, $pos[0])
   GUICtrlSetData($yPosLock, $pos[1])
EndFunc

Func Main() 
GUISetState()
$win_title = "Dark Age of Camelot, Copyright © 2001-04 Mythic Entertainment, Inc."
If WinExists($win_title) Then
     WinActivate($win_title, "") 
     WinSetOnTop($win_title, "", 0) 
   else 
     MsgBox(0, "Forget Something?", "DAoC Not Running")
     Exit
EndIf

Opt("MouseClickDelay", 1)     

$x = GUICtrlRead($xPosLock)
$y = GUICtrlRead($yPosLock)

While 1
  $msg = GUIGetMsg()
  If $msg = $GUI_EVENT_CLOSE OR $msg = $btnOK Then ExitLoop  
  If _IsPressed('6e') = 1 Then Pause()
  If _IsPressed('60') = 1 Then Start()
  Sleep(10)
Wend
EndFunc

Func Start()
GUISetState()
sleep(1000)
  MouseMove($x, $y, 1)
  MouseDown("left")
    sleep(100)
       while 1
       Opt("WinWaitDelay", 0)
       $msg = GUIGetMsg()
       If $msg = $GUI_EVENT_CLOSE OR $msg = $btnOK Then ExitLoop  
       If _IsPressed('6e') = 1 Then Pause()
      MouseMove(520, 530, 0) 
      MouseMove(415, 390, 0)
      MouseMove(530, 418, 0)
       Wend

EndFunc

Func Pause()
   MouseMove($x, $y, 1)
   Mouseup("left")
   $Paused = NOT $Paused
   While $Paused
       $msg = GUIGetMsg()
       If $msg = $GUI_EVENT_CLOSE OR $msg = $btnOK Then ExitLoop  
       If _IsPressed('60') = 1 Then Start()
       sleep(100)
       ToolTip('Script is "Paused"',0,0)
   WEnd
   ToolTip("")
EndFunc

Func _IsPressed($hexKey)
  Local $aR, $bO
  
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  
  Return $bO
EndFunc

Thanks to those that helped with my newb problems! I plan on making this into a full scale macro program for crafting and or other automated tasks such as savage buffs, caster debuffs, ect.

Any comments or improvements are definitly welcome, still looking for a way to make the mouse movements more natural and quicker, I've tried setting the speed to 1 but thats way to slow as well, I've also tried MouseDrag, but that basically lets go of the window after the first set of coords.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...