headpiece switcher?

05/02/2018 16:53 george2324#1
Just wondering if anyone knows of a mod or bot that can switch headpieces with a hotkey command?

toolbox allows you to use consumables with a hotkey but not equipment for some reason
05/02/2018 20:51 DerMoench14#2
Code:
EquipItem($aItem)
or
Code:
SendPacket(0x8, 0x34, $aItemID)
are your Friends :-)
05/03/2018 00:37 george2324#3
I'm not much of a coder. I understand what that line means but starting a script from scratch and setting up a hotkey to activate it isn't something I have a clue how to do unfortunately
05/03/2018 07:41 mhaendler#4

Here a basic script to do that. It binds the {PAUSE}-Button and Switches the Armor / Weapon / Headpice on Bag 4 Slot 1. Thats hardcoded and not the best way to do it. You probably want to load it via the model id and then equip it, but thats your turn. get into coding. develop stuff and share it ;)

I did not test it, but i dont see a point why it should not work

_
mhaendler
05/03/2018 17:42 george2324#5
Quote:
Originally Posted by mhaendler View Post

Here a basic script to do that. It binds the {PAUSE}-Button and Switches the Armor / Weapon / Headpice on Bag 4 Slot 1. Thats hardcoded and not the best way to do it. You probably want to load it via the model id and then equip it, but thats your turn. get into coding. develop stuff and share it ;)

I did not test it, but i dont see a point why it should not work

_
mhaendler
hi thanks for this, could you help me out by explaining a piece of code that i dont understand how it works.


i see the pause key binds to the func ActiveSwitchToHpArmor

however the func that actually does the stuff i need is called SwitchToHpArmor

so how does this Func ActiveSwitchToHpArmor()
$equipHpArmor = not $equipHpArmor

call the other func without naming it?

hope what i am trying to explain can be understood thanks


also a second question if you dont mind..

my bots often DC ive tried everything to fix the DC issue to no avail so im trying to make the bot relog.

how can you make the bot relog after a crash?

i have found the code below: however if i put that function in my code, how do i make sure that function is called, does the auto it language automatically call everything in order of the file?
also this code only seems to press the button to reconnect, what if a relog is needed?
Id really like to get into coding these but getting to grips with the first bit of understanding is going to be tough
thanks

Func DisconnectCheck()
Static Local $gs_obj = GetValue('PacketLocation')
While MemoryRead($gs_obj ) = 0 ; While Disconnected
ControlSend($mGWHwnd,'','','{ENTER}') ; Hit enter key until you log back in
Sleep(Random(5000,10000,1))
WEnd
EndFunc

or


Func DCCheck()
Local $aX, $aY
$aX = DllStructGetData(GetAgentByID(-2), "X&quot
$aY = DllStructGetData(GetAgentByID(-2), "Y&quot
If $aX = 0 And $aY = 0 Then ; Is this the correct check for this type of DC?
Sleep(3000)
Send("{ENTER}&quot ; Presses OK in the error 007 window
Sleep(3000)
Send("{ENTER}&quot ; Selects the last used character and travels to the last used outpost
Sleep(8000)
EndIf
EndFunc

the only way i can understand the answer to my first question is that this code:
$equipHpArmor = not $equipHpArmor

changes the $equipHpArmor variable to true? but thats just a wild guess as the wording of the code does not imply that it does that at all to me?
05/03/2018 20:20 mhaendler#6
Yea, the function changes the value of $equipHpArmor to the opossite value:

false => true
true => false

In the Loop:

Code:
While True
	if($equipHpArmor) Then
		SwitchToHpArmor()
                $equipHpArmor = false
	EndIf
    Sleep(100) ; Little sleep to reduce CPU usage
WEnd
You wait until the $equipHpArmor is true, then you execute the stuff to change the headpice / armor / whatsoever

You call the function "ActiveSwitchToHpArmor" by pressing the hotkey: {PAUSE}

HotKeySet("{PAUSE}", "ActiveSwitchToHpArmor") ; Bind the Pause / Start Bot Function to the Pause Key

So Basicly the bot waits until the value of $equipHpArmor is true, once the value is true it executes the "armor switch" once this is finsihed it turns $equipHpArmor to false again

The value $equipHpArmor is changed via the Function "ActiveSwitchToHpArmor", why gets executed via the hotkeypress "PAUSE".

Unterstood?

Sorry no idea of D/C Functions :D none of my bots have one and never looked into that kind of stuff
05/03/2018 22:14 george2324#7
yeah thats what i thought it did.

So the command not does that just reverse the current value of a boolean variable?

it just didnt make sense to me as i would expect it to be something like:
variable == false;


i understand it now, with this i think ive managed to change it so that it can equip several different sets.

it equips all the different sets based on the item slot. problem is the item slot changes when u change headpiece.

how can i find the item id number of Pvp custom armor pieces though?

ill keep messing with the DC function to see if i can get it to work..

ive found this func in several of the bots i have
Code:
Func DISCONNECTED()
	Out("Disconnected!")
	Out("Attempting to reconnect.")
	ControlSend(GETWINDOWHANDLE(), "", "", "{Enter}")
	Local $LCHECK = False
	Local $LDEADLOCK = TimerInit()
	Do
		Sleep(20)
		$LCHECK = GETMAPLOADING() <> 2 And GETAGENTEXISTS(-2)
	Until $LCHECK Or TimerDiff($LDEADLOCK) > 60000
	If $LCHECK = False Then
		Out("Failed to Reconnect!")
		Out("Retrying.")
		ControlSend(GETWINDOWHANDLE(), "", "", "{Enter}")
		$LDEADLOCK = TimerInit()
		Do
			Sleep(20)
			$LCHECK = GETMAPLOADING() <> 2 And GETAGENTEXISTS(-2)
		Until $LCHECK Or TimerDiff($LDEADLOCK) > 60000
		If $LCHECK = False Then
			Out("Could not reconnect!")
			Out("Exiting.")
		EndIf
	EndIf
	Out("Reconnected!")
	Sleep(5000)
EndFunc
problem is not a single one of them actually ever call the function so it doesnt work.

would i be able to put a function call within a main loop in the bot somehow that will call it to check if the game is disconnected and then run this?


update:::

ive managed to get my bots to call this function, the bots detects that it is disconnected but that code doesnt work. it doesnt appear to press the yes button when it says do you want to reconnect...