# Forum > MMO > ArcheAge > ArcheAge Bots and Programs > [Auto-Clicker] Gift Claimer

## Defectuous

I've had this since the Christmas event. I mainly used it while during purses or attacking. 60% of this source is from a fishing script I found on here. It's simple and handy to use basically a setup and forget it.



```
; AutoIt Version: 3.0
; Language: English
; Platform: Win9x/NT
; Author: Richard Thompson ( Defectuous )

Global $Paused, $Showme, $Count = 0, $Acount = 0
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
WinActivate( "ArcheAge", "");activate the Archeage window
#include <Misc.au3>
#include <Constants.au3>
#requireadmin

SplashTextOn("Auto Gift Claimer", "Starting Setup. Please Standby... ", 400, 100, -2, -1, 0, "Ariel", 15)
Sleep(4000)
SplashOff()
Sleep("1000")
SplashTextOn("Auto Gift Claimer Setup", "Please Click on the Gift Location.", 400, 100, -2, -1, 0, "Ariel", 15)
While 1
Sleep ( 100 )
If _IsPressed("01") Then
$pos = MouseGetPos()
ExitLoop
EndIf
WEnd
SplashOff()
$res1 = $pos[0]
$res2 = $pos[1]
Sleep ( 1000 )

SplashTextOn("Auto Gift Claimer", "Auto Gift Claimer. Starting in 5 Seconds... ", 400, 100, -2, -1, 0, "Ariel", 15)
Sleep(4000)
SplashOff()
While 1
Sleep(Random(1800000, 1815000,1))
MouseClick ( "left" , $res1, $res2, 3 )

WEnd

Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
WEnd
ToolTip("")
EndFunc

Func Terminate()
MsgBox($MB_SYSTEMMODAL, "Quit Bot", "Have A Nice Day")
Exit 0
EndFunc
```

----------


## Value

Any simple auto clicker works, but thanks for the effort on the script

----------


## Defectuous

> Any simple auto clicker works, but thanks for the effort on the script


Yeah that does work, I was also thinking of setting it up so it only clicks 10 times then stops.

I generally do this while grinding or leveling with Archebuddy. So far so good. I've been looking at making a plugin once the API adds the function.

----------


## AutoScript

Hi Defectuous
It is impolite to use code by someone else without giving credit to the person who wrote part of or all of it. I do not mind, If you are rude, though you should read the rules on the forum.

Best 
Elzie

----------


## AutoScript

This bot has a AFK loop and Gift box clicker.

Note ( Ctrl + Q quits macro. )
Note ( Pause will Puase macro. )






```
; Author Elzie and Bones
#include <Misc.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include <StructureConstants.au3>
#RequireAdmin

#Region START
$Form2 = GUICreate("Gift Box", 175, 105, 254, 432, -1, $WS_EX_TOPMOST)
$Prog = GUICtrlCreateProgress(8, 72, 158, 20, $PBS_MARQUEE)
$Button1 = GUICtrlCreateButton("Start", 8, 40, 155, 25)
$Checkbox1 = GUICtrlCreateCheckbox("Away form Keyboard", 8, 8, 153, 17)
GUISetState(@SW_SHOW)
#EndRegion START
Dim $pos[2]
HotKeySet("^q", "Terminate")
HotKeySet("{PAUSE}", "TogglePause")
Global $In3 = TimerInit()
Global $Paused, $on = 1
Global $title = WinGetTitle("[CLASS:ArcheAge]", "")

While 1
	GUICtrlSendMsg($Prog, $PBM_SETMARQUEE, 1, 20)
	$msg = GUIGetMsg()
	Switch $msg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			SplashTextOn("Auto Gift Box Setup", "Please Click Gift Box.", 400, 100, -2, -1, 0, "Ariel", 15); first mouse po. Helmet
			While 1
				Sleep(100)
				If _IsPressed("01") Then; @@ Bones notes: Ispressed checks to see if key 01 is pressed
					$pos = MouseGetPos()
					ExitLoop
				EndIf
			WEnd
			SplashOff()
			$res1 = $pos[0]
			$res2 = $pos[1]
			Sleep(200)
			SplashTextOn("Auto Gift Box Setup", "Auto Gift Box Setup Is Complete. Starting in 5 Seconds... ", 400, 100, -2, -1, 0, "Ariel", 15)
			Sleep(5000)
			SplashOff()
			While $on = 1
				$minutes3 = 1800000
				$t3 = TimerDiff($In3)
				If $t3 > $minutes3 Then
					Local $hWnd = WinWait("[CLASS:ArcheAge]", "", 2)
					WinActivate($hWnd)
					Sleep(Random(110, 140, 1))
					MouseMove($res1 , $res2 , 3)
					Sleep(321)
					MouseDown("primary")
					Sleep(Random(110, 160, 1))
					MouseUp("primary")
					$In3 = TimerInit()
				EndIf
				If _IsChecked($Checkbox1) Then ; Bones Afk Macro
					Local $iRand = Chr(Random(76, 80, 1))
					$iAFKwait = Random(600000, 610000, 1)
					ControlSend($title, "", "", "{" & $iRand & " down}")
					Sleep(Random(110, 140, 1))
					ControlSend($title, "", "", "{" & $iRand & " up}")
					Sleep($iAFKwait)
					ControlSend($title, "", "", "{" & $iRand & " down}") ; Close the window
					Sleep(Random(110, 140, 1))
					ControlSend($title, "", "", "{" & $iRand & " up}")
					Sleep(100)
				EndIf
			WEnd
	EndSwitch


WEnd


Func _IsChecked($idControlID)
	Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

Func Terminate();===================== Quit ======================
	MsgBox(0, "Quit Bot", "Have A Nice Day")
	Exit 0
EndFunc   ;==>Terminate

Func TogglePause();===================== Pause ======================
	$title = WinGetTitle("[CLASS:ArcheAge]", "")
	$Paused = Not $Paused
	While $Paused
		$on = 0
		ToolTip("Paused")
	WEnd
	$on = 1
	ToolTip("")
EndFunc   ;==>TogglePause
```

Enjoy
Elzie

----------


## Defectuous

> Hi Defectuous
> It is impolite to use code by someone else without giving credit to the person who wrote part of or all of it. I do not mind, If you are rude, though you should read the rules on the forum.
> 
> Best 
> Elzie


I did not mean to be impolite, I honestly did not remember the author's name. Which after a little more research than my search for your script was you. I did at least note most of the work is someone from this forum. Also reading your second post is amazing.

----------


## Mr187

How does this work exactly? I got it running but nothing happens

----------


## XTai

> This bot has a AFK loop and Gift box clicker.
> 
> Note ( Ctrl + Q quits bot. )
> Note ( Pause will Puase bot. )
> 
> Enjoy
> Elzie


hi, does the 


> #include <Misc.au3>
> #include <ButtonConstants.au3>
> #include <GUIConstantsEx.au3>
> #include <ProgressConstants.au3>
> #include <WindowsConstants.au3>
> #include <GuiStatusBar.au3>
> #include <StructureConstants.au3>


mean i have to have those .au3 file? Does this script allow you to minimize the archeage windows to save power consumption?

----------


## bakaas

hi, this is my first post and i'm not a pro in using autoit 3.0. What I did with this script was that I pasted it onto autoit and run it. however it doesn't seems to be working. I waited for the gift to reach maturity but nothing happened.

Please enlighten me on this script if possible..

----------


## Bonesalot

> hi, does the 
> 
> mean i have to have those .au3 file? Does this script allow you to minimize the archeage windows to save power consumption?


It does not. That could be a featuer request though. It requires and actively drawn window to move and click the mouse. It calls the window before clicking, We could add a part to minimize window after the click. ie pop up, click the gift, minimize.

----------


## Bonesalot

I took a look at Elzies code. He changed what I gave him and it looks off. I can't see what it is though. He is trying to do more than I intended. Here's is a simple script to run Gift box and AFK nothing fancy. Run at 1920x1080 for now. it will activate window then minimize it... as per requested feature.

Copy code,
open script editor
paste code
*SAVE THE FILE*
hit F5 to run
F11 to exit.
_Enjoy_



```
; AutoIt Version: 3.0
; Language:  	English
; Platform:    	Win9x/NT
; Author:		Bones
; Kudos: 		Elzie
; Version:		1.0

HotKeySet("{F11}", "_exit")
AutoItSetOption("WinTitleMatchMode", 4)

Global $iKey, $iCasttime
Global $title = WinGetTitle("[CLASS:ArcheAge]", "")
Global $hHandle = WinGetHandle($title,"")

While 1
   _Lunabox()
   _AFK()
   Sleep(1000)
WEnd

Func _Hotkey_($iKey,$iCasttime)	; Cast time is in miliseconds. 2000 = 2 seconds 0 = instant.
	  ControlSend($title, "", "", "{" & $iKey & " down}",0)
		 Sleep(Random(110, 150, 1))
	  ControlSend($title, "", "", "{" & $iKey & " up}",0)

		 Sleep(Random($iCasttime, $iCasttime + 50, 1))
EndFunc

Func _AFK()
   Local Static $bFirst_pass = TRUE
   Local Static $iAFKwait = 0
   Local Static $iAFKTimer = 0
   Local Static $iAFKTimed = 0
   Local $iRand = Chr(Random(76, 80, 1))
   $iAFKTimed = TimerDiff($iAFKTimer)

   Select
   Case	$bFirst_pass
	  $bFirst_pass = FALSE
	  $iAFKTimer = TimerInit()
	  $iAFKwait = Random(150000, 300000, 1)
	  _Hotkey_($iRand,100)
		Sleep(Random(1100, 1200, 1))
	  _Hotkey_($iRand,100)
   Case $iAFKTimed >= $iAFKwait
	  _Hotkey_($iRand,100)
		Sleep(Random(1100, 1200, 1))
	  _Hotkey_($iRand,100)
	  $iAFKwait = Random(150000, 300000, 1)
	  $iAFKTimer = TimerInit()
   EndSelect
EndFunc

Func _Lunabox()
   Local Static $bFirst_pass = TRUE
   Local Static $iLunawait = 0
   Local Static $iLunaTimer = 0
   Local Static $iLunaTimed = 0
   AutoItSetOption("MouseCoordMode",0)
   $iLunaTimed = TimerDiff($iLunaTimer)

   $iX = Random(10,50,1) ; The "X" range For The Mouse To Click
   $iY = Random(965,1010,1) ; The "Y" Pos For The Mouse To Click

   Select
	  Case $bFirst_pass
		 $bFirst_pass = FALSE
		 $iLunaTimer = TimerInit()
		 $iLunawait = Random(1800000,2700000,1)
		 WinSetState($title, "", @SW_MAXIMIZE)
			Sleep(500)
		 WinActivate($title)
		 If WinActive($title) Then
			MouseClick("Primary",$iX,$iY,1)
			Sleep(500)
			WinSetState($title, "", @SW_MINIMIZE)
		 Return
		 Else
			Traytip("Lunabox","Can not find your Archeage window.",100000)
		 Return
		 EndIf
	  Case $iLunaTimed >= $iLunawait
		 $iLunawait = Random(1800000,2700000,1)
		 $iLunaTimer = TimerInit()
		 WinSetState($title, "", @SW_MAXIMIZE)
			Sleep(100)
		 WinActivate($title)
		 If WinActive($title) Then
			MouseClick("Primary",$iX,$iY,1)
			Sleep(500)
			WinSetState($title, "", @SW_MINIMIZE)
	  Return
		 EndIf
   EndSelect
EndFunc

Func _exit()
   WinSetState($title, "", @SW_MAXIMIZE)
	  Sleep(500)
   WinActivate($title)
   Exit
EndFunc
```

If you want to run it at different resolutions, find out what your own coordinates are and change these two lines

$iX = Random(10,50,1) ; The "X" range For The Mouse To Click (Left Most, Right Most, Increment)
$iY = Random(965,1010,1) ; The "Y" Pos For The Mouse To Click (Top Most, Bottom Most, Increment)

----------

