Help with my first bot |Hilfe mit meinem ersten Bot

12/21/2009 07:27 yaunny#1
ENG: I've learned autoit and I am ready to make my first bot, but i have no idea how to script guild wars.
I have GWCA and everything I need..
I want to make a Jade Quarry bot, so what it has to do is:
Click the Enter Battle button
Run to the Yellow Quarry portal
tab to an opponent
Spam necessary skills
If it dies, it needs to repeat after res.

Now, I'm totally new to GW scripting, and since i dont speak german its very hard for me to navigate this website.

Can someone atleast give me a push in the right direction of where to start?

Ger:

Ich habe autoit gelernt und ich bin bereit, meine erste bot machen, aber ich habe keine Ahnung, wie das Skript guild wars.
Ich habe GWCA und alles, was ich brauche ..
Ich möchte eine Jadesteinbruch bot machen, um was es tun muss, ist:
Klicken Sie auf die Enter-Taste Battle
Run to the Yellow Steinbruch-Portal
Registerkarte, um einen Gegner
Spam notwendigen Fähigkeiten
Wenn es aber stirbt, muss sie nach res zu wiederholen.

Nun, ich bin völlig neuen GW-Scripting, und da i dont speak Deutsch seine sehr schwer für mich, diese Website zu navigieren.

Kann jemand mir ein atleast in die richtige Richtung, wo ich anfangen zu forcieren?
12/21/2009 10:15 buFFy!#2
A Little Example:
Code:
#include "GWCAConstants.au3"
#include "Inject.au3"

While $inject <> 1
	Sleep(100)
WEnd

$cGUI = GUICreate("GWCA")

GUIRegisterMsg(0x500, "WndCallback")

#Region Skills
Global Const $iBlood = 111, _
		$iSpoil = 1066, _
		$iPrice = 103, _
		$iNecro = 97

Global Const $Blood = 1, _
		$Spoil = 2, _
		$Price = 3, _
		$Necro = 8

Cmd($CA_SetSkillbarSkill, 1, $iBlood)
Cmd($CA_SetSkillbarSkill, 2, $iSpoil)
Cmd($CA_SetSkillbarSkill, 3, $iPrice)
Cmd($CA_SetSkillbarSkill, 4, 0)
Cmd($CA_SetSkillbarSkill, 5, 0)
Cmd($CA_SetSkillbarSkill, 6, 0)
Cmd($CA_SetSkillbarSkill, 7, 0)
Cmd($CA_SetSkillbarSkill, 8, $iNecro)

Sleep(1000)
#EndRegion Skills

#Region Check Settings
$cbType = "int"
CmdCB($CA_GetMapId)

If $cbVar[0] <> 129 Then
	DisplayError("Wrong Outpost", "Code = 0x500" & _
			@CRLF & "The Bot has detected a Wrong outpost: " & _
			$cbVar[0] & @CRLF & "Please go to Lutgards Conservatory!")
EndIf

CmdCB($CA_GetProfessions, -2)
If $cbVar[0] <> 4 And $cbVar[1] <> 4 Then
	DisplayError("Error in Profession", "Code = 0x750" & _
			@CRLF & "The Bot has detected that your 1st or 2nd Profession is not Necromancer: " & _
			@CRLF & "1st: " & $cbVar[0] & _
			@CRLF & "2nd: " & $cbVar[1])
EndIf

CmdCB($CA_GetGold)
If $cbVar[0] < 500 Then
	DisplayError("Error in Gold", "Code = 0x1000" & _
			@CRLF & "The Bot has detected a too low amount of Gold: " & _
			$cbVar[0] & @CRLF & "Please make sure you have got more than 500 Gold")
EndIf

CmdCB($CA_GetMyMaxHP)
If $cbVar[1] > 55 Then
	DisplayError("Error in HP", "Code = 0x2000" & _
			@CRLF & "The Bot has detected an too high amount of Healthpoints: " & _
			$cbVar[1] & @CRLF & "Please set HP < 55 and start again!")
EndIf

CmdCB($CA_GetMyMaxEnergy)
If $cbVar[1] < 40 Then
	DisplayError("Error in Energy", "Code = 0x3000" & _
			@CRLF & "The Bot has detected an too low amount of Energy: " & _
			$cbVar[1] & @CRLF & "Please set Energy >= 40 and start again!")
EndIf

CmdCB($CA_GetSkillbarSkillId, 1)
If $cbVar[0] <> $iBlood Then
	DisplayError("Error in Build", "Code = 0x4001" & _
			@CRLF & "The Bt has detected a wrong Skill at Skillslot 1: " & _
			$cbVar[0] & @CRLF & "Maybe you haven't got the Skill 'Awaken The Blood'")
EndIf

CmdCB($CA_GetSkillbarSkillId, 2)
If $cbVar[0] <> $iSpoil Then
	DisplayError("Error in Build", "Code = 0x4002" & _
			@CRLF & "The Bt has detected a wrong Skill at Skillslot 2: " & _
			$cbVar[0] & @CRLF & "Maybe you haven't got the Skill 'Spoil Victor'")
EndIf

CmdCB($CA_GetSkillbarSkillId, 3)
If $cbVar[0] <> $iPrice Then
	DisplayError("Error in Build", "Code = 0x4003" & _
			@CRLF & "The Bt has detected a wrong Skill at Skillslot 3: " & _
			$cbVar[0] & @CRLF & "Maybe you haven't got the Skill 'Price of Failure'")
EndIf

CmdCB($CA_GetSkillbarSkillId, 8)
If $cbVar[0] <> $iNecro Then
	DisplayError("Error in Build", "Code = 0x4008" & _
			@CRLF & "The Bt has detected a wrong Skill at Skillslot 8: " & _
			$cbVar[0] & @CRLF & "Maybe you haven't got the Skill 'Necroctic Traversal'")
EndIf
#EndRegion Check Settings

Func Main()
	While 1

		CmdCB($CA_SwitchMode, 1)

		#Region Wayout + Bossway
		$cbType = "float"
		MoveTo(-7581, 1823)

		$cbType = "int"
		While $cbVar[0] <> 1
			CmdCB($CA_GetMapLoading)
			Sleep(0)
		WEnd
		Sleep(1000)

		AdlibEnable("DeathCheck", 2000)

		$cbType = "float"
		MoveTo(-11520, 8928)
		#EndRegion Wayout + Bossway

		#Region Bossfight
		$cbType = "int"
		Cmd($CA_TargetNearestFoe)

		CmdCB($CA_GetCurrentTarget)
		$TargetId = $cbVar[0]

		ConsoleWrite($TargetId & @CRLF)

		If $TargetId <= 0 Then
			CmdCBEx($CA_GetCurrentTarget)
			$TargetId = $cbVar[0]
			ConsoleWrite($TargetId & @CRLF)
		EndIf

		$cbType = "float"
		CmdCB($CA_GetMyDistanceToAgent, $TargetId)

		If ($cbVar[0] > 1300) Then
			While $cbVar[0] > 1300 * Sleep(1000)
				CmdCB($CA_GetMyDistanceToAgent, $TargetId)
				Sleep(0)
			WEnd
		EndIf

		$cbType = "int"

		UseSkillEx($Blood)

		UseSkillEx($Spoil, $TargetId)
		ConsoleWrite("now" & @CRLF)

		UseSkillEx($Price, $TargetId)

		For $i = 1 To 2
			CmdCB($CA_GetCurrentTarget)
			If $cbVar[0] <> 0 Then

				CmdCB($CA_SkillRecharge, $Spoil)
				While $cbVar[0] <> 0
					CmdCB($CA_SkillRecharge, $Spoil)
					Sleep(0)
				WEnd

			EndIf
			CmdCB($CA_GetCurrentTarget)
			If $cbVar[0] <> 0 Then
				UseSkillEx($Spoil, $TargetId)
			EndIf
		Next

		CmdCB($CA_GetCurrentTarget)
		While $cbVar[0] <> 0
			CmdCB($CA_GetCurrentTarget)
			Sleep(0)
		WEnd
		#EndRegion Bossfight
		
		AdlibDisable()
		
		#Region Pickup Items
		CmdCB($CA_GetMyId)
		$MyId = $cbVar[0]

		CmdCB($CA_GetNearestItemToAgentEx, $MyId)
		If $cbVar[0] <> 0 Then

			Cmd($CA_UseSkillbarSkill, $Necro, $TargetId)

			Do
				$aItem = CmdCB($CA_GetNearestItemToAgentEx, -2)
				ConsoleWrite($aItem[0] & @CRLF)
				If $aItem[0] <> 0 Then
					Cmd($CA_PickupItem, $aItem[0])
				EndIf
			Until $aItem[0] = 0
		EndIf
		#EndRegion Pickup Items

		#Region Resign
		Cmd($CA_Resign)
		CmdCB($CA_GetDead)
		Do
			Sleep(2500)
			CmdCB($CA_GetDead)
		Until $cbVar[0] = 1

		Cmd($CA_ReturnToOutpost)
		$cbVar[0] = 1

		While $cbVar[0] <> 0
			CmdCB($CA_GetMapLoading)
			Sleep(0)
		WEnd
		Sleep(1000)
		#EndRegion Resign

		#Region Sell
		$b_BackPack = _BagCountItems(1)
		$b_BeltPouch = _BagCountItems(2)

		If (($b_BackPack[0] + $b_BeltPouch[0]) > 26) Then

			TravelTo(283)
			$cbType = 'float'
			MoveTo(-12910, 13597)

			$cbType = 'int'
			Cmd($CA_TargetNearestAlly)
			CmdCB($CA_GetCurrentTarget)

			Sleep(100)

			Cmd($CA_GoNpc, $cbVar[0])

			Sleep(1000)

			For $bag = 1 To 2
				For $slot = 1 To 20
					If $bag = 2 And $slot = 6 Then ExitLoop
					Cmd($CA_IdentifyItem, $bag, $slot)
				Next
			Next

			For $bag = 1 To 2
				For $slot = 1 To 20
					If $bag = 2 And $slot = 6 Then ExitLoop
					Cmd($CA_SellItem, $bag, $slot)
				Next
			Next

			CmdCB($CA_GetIdKit)
			$id_IdKit = $cbVar[0]

			If $id_IdKit = 0 Then
				Cmd($CA_BuySuperiorIdKit)
				CmdCB($CA_GetIdKit)
				$id_IdKit = $cbVar[0]

				MoveItemById($id_IdKit, 3, 1)
			EndIf
		EndIf

		#EndRegion Sell
	WEnd
EndFunc   ;==>Main

Func DeathCheck()
	$oldCbType = $cbType

	$cbType = 'int'
	
	ConsoleWrite("Dead" & @CRLF)

	CmdCB($CA_GetIsDead)
	If $cbVar[0] = 1 Then
		#Region Resign
		Cmd($CA_Resign)
		CmdCB($CA_GetDead)
		Do
			Sleep(2500)
			CmdCB($CA_GetDead)
		Until $cbVar[0] = 1

		Cmd($CA_ReturnToOutpost)
		$cbVar[0] = 1

		While $cbVar[0] <> 0
			CmdCB($CA_GetMapLoading)
			Sleep(0)
		WEnd
		Sleep(1000)
		#EndRegion Resign
	EndIf
	
	$cbType = $oldCbType
	
	Main()
EndFunc   ;==>DeathCheck

Main()
Take a look at this: [Only registered and activated users can see links. Click Here To Register...]