OK to ask for exploit/Scripting help here...

02/26/2020 20:31 sadusten#256
Quote:
Originally Posted by JohnyDee View Post
Hi and thanks, it still does not work very well so I am trying different things. I also found this func from an old thread:

Code:
func canUseCombo($skill, $target)
	if not isDllStruct($target) then $target = getAgentByID($target)
	if not isDllStruct($skill) then $skill = getSkillById($skill)
	switch dllStructGetData($skill, "comboReq")
		case 1
			return dllStructGetData($target, "laststrike") = 3
		case 2
			return dllStructGetData($target, "laststrike") = 1
		case 4
			return dllStructGetData($target, "laststrike") = 2
	endSwitch
	return true
endFunc
but I am not exactly sure how it should be called in the fighting function...
Okay i just spent some time trying to help you out with this, and finnaly got it working quite nicely actually, hope it will do the same for you. Who knows, maybe i'll use this in future bots :)

Code:
Func Killsin()
	Local $timerskills
	Local $timergetagentexist
	Local $ldistance
	Local $JSHITS = 0
	Local $FFHITS = 0
	Local $DBHITS = 0
	Local $JS = 1
	Local $FF = 2
	Local $DB = 3

	While getnumberoffoesinrangeofagent(-2, 1250) > 0
		If GetIsDead(-2) Then ExitLoop
		If Not GetTarget(-1) Then
			$timergetagentexist = TimerInit()
			Do
				TargetNearestEnemy()
				Sleep(getping() + 250)
			Until GetAgentExists(-1) Or TimerDiff($timergetagentexist) > 4000
		EndIf
		If CheckEnchantments() Then
			ControlSend(getwindowhandle(), "", "", "{space}") ;Moving to enemie
			Sleep(getping() + 200)
			$JSHITS = 0
			$FFHITS = 1
			$DBHITS = 1
			Do

				If $JSHITS = 0 Then
					If getenergy(-2) >= 5 Then
						If IsRecharged($JS) Then
							$timerskills = TimerInit()
							useskill($JS, -1)
							Do
								Sleep(getping() + 200)
							Until Not IsRecharged($JS) Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1) Or TimerDiff($timerskills) > 2500
							If getisbleeding(-1) Then
								$JSHITS += 1
								$FFHITS = 0
							EndIf
						EndIf
					ElseIf getenergy(-2) < 5 Then
						Do
							Sleep(getping())
						Until getenergy(-2) >= 5 Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1)
						If $JSHITS = 0 Then
							$timerskills = TimerInit()
							useskill($JS, -1)
							Do
								Sleep(getping() + 200)
							Until Not IsRecharged($JS) Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1) Or TimerDiff($timerskills) > 2500
							If getisbleeding(-1) Then
								$JSHITS += 1
								$FFHITS = 0
							EndIf
						EndIf
					EndIf
				EndIf


				If $FFHITS = 0 Then
					If getenergy(-2) >= 5 Then
						If IsRecharged($FF) Then
							$timerskills = TimerInit()
							useskill($FF, -1)
							Do
								Sleep(getping() + 200)
							Until Not IsRecharged($FF) Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1) Or TimerDiff($timerskills) > 2500
							$FFHITS += 1
							$DBHITS = 0
						EndIf
					ElseIf getenergy(-2) < 5 Then
						Do
							Sleep(getping() + 100)
						Until getenergy(-2) >= 5 Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1)
						If $FFHITS = 0 Then
							$timerskills = TimerInit()
							useskill($FF, -1)
							Do
								Sleep(getping() + 200)
							Until Not IsRecharged($FF) Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1) Or TimerDiff($timerskills) > 2500
							$FFHITS += 1
							$DBHITS = 0
						EndIf
					EndIf
				EndIf

				If $DBHITS = 0 Then
					If getenergy(-2) >= 5 Then
						If IsRecharged($DB) Then
							$timerskills = TimerInit()
							useskill($DB, -1)
							Do
								Sleep(getping() + 200)
							Until Not IsRecharged($DB) Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1) Or TimerDiff($timerskills) > 2500
							$DBHITS += 1
							$JSHITS = 0
						EndIf
					ElseIf getenergy(-2) < 5 Then
						Do
							Sleep(getping() + 100)
						Until getenergy(-2) >= 5 Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1)
						If $DBHITS = 0 Then
							$timerskills = TimerInit()
							useskill($DB, -1)
							Do
								Sleep(getping() + 200)
							Until Not IsRecharged($DB) Or getisdead(-1) Or getisdead(-2) Or Not GetAgentExists(-1) Or TimerDiff($timerskills) > 2500
							$DBHITS += 1
							$JSHITS = 0
						EndIf
					EndIf
				EndIf
			Until GetIsDead(-1) Or getisdead(-2) Or Not GetAgentExists(-1)
		EndIf
	WEnd
	Return False
EndFunc   ;==>Killsin
02/27/2020 10:59 JohnyDee#257
Thanks, it seems well designed. I will try it later today and will let you know. I think it will be quite useful for your scripts too ;)
02/27/2020 22:06 FriendlyFarmer#258
I'll just write the answer here instead of in the private message. That function looks complicated in my opinion. I'm not going to write the full thing for you, but this answers your question about canUseCombo

Code:
func canUseCombo($skill, $target)
	if not isDllStruct($target) then $target = getAgentByID($target)
	if not isDllStruct($skill) then $skill = getSkillById($skill)
	switch dllStructGetData($skill, "comboReq")
		case 1
			return dllStructGetData($target, "laststrike") = 3
		case 2
			return dllStructGetData($target, "laststrike") = 1
		case 4
			return dllStructGetData($target, "laststrike") = 2
	endSwitch
	return true
endFunc

While (statement)
	If canUseCombo($db_ID, $lTarget) Then
		UseSkillCustom(...)
	ElseIf canUseCombo($fox_ID, $lTarget)
		UseSkillCustom(...)
	ElseIf Not canUseCombo($db_ID, $lTarget) and Not canUseCombo($fox_ID, $lTarget)
		UseSkillCustom(...)
	EndIf
wEnd
Then as your custom useskill function, you can make it do all the checks (GetIsDead(-2), GetIsDead($lTarget), GetEnergy(-2)>=5, ...) to avoid having to repeat the code 5 times.
03/06/2020 18:29 hknippon#259
thank you!
03/12/2020 12:16 sadusten#260
I remember using this function couple of years ago, where it didn't sell dual mod os shields, now it doesnt seem to work, any idea why?

Code:
Func Sell($BAGINDEX)
	Local $aitem
	Local $bag = GETBAG($BAGINDEX)
	Local $NUMOFSLOTS = DllStructGetData($bag, "slots")
	For $i = 1 To $NUMOFSLOTS
		$aitem = GETITEMBYSLOT($BAGINDEX, $i)
		If DllStructGetData($aitem, "ID") = 0 Then ContinueLoop
		Local $Requirement = GetItemReq($aitem)
		Local $lmodelid = DllStructGetData($aitem, "ModelID")
		If CanSell($aitem) Then
			sellitem($aitem)
		EndIf
		Sleep(GetPing() + 250)
	Next
EndFunc   ;==>Sell

Func CanSell($aitem)
	Local $lmodelid = DllStructGetData($aitem, "ModelID")
	Local $Requirement = GetItemReq($aitem)
	Local $lRarity = getrarity($aitem)
	Local $WeaponType = DllStructGetData($aitem, 'Type')
	If ValEquipReturnTrue($aitem) Then Return False
	Return True
EndFunc   ;==>CanSell

Func ValEquipReturnTrue($aitem)
	Local $ModStruct = GetModStruct($aitem)
	Local $lmodelid = DllStructGetData($aitem, 'ModelID')
	Local $WeaponType = DllStructGetData($aitem, 'Type')

	If IsWandFocusShield($WeaponType) Then
		If HasTwoUsefulMods($ModStruct) Or IsHCT20($ModStruct) Then Return True
	EndIf
EndFunc   ;==>ValEquipReturnTrue

Func IsWandFocusShield($WeaponType)
	If $WeaponType == 22 Then Return True
	If $WeaponType == 12 Then Return True
	If $WeaponType == 24 Then Return True
EndFunc   ;==>IsWandFocusShield


Func HasTwoUsefulMods($ModStruct)
	Local $UsefulMods = 0
	Local $aModStrings[159] = ["05320823", "0500F822", "0F00D822", "000A0822", "000AA823", "00140828", "00130828", "0A0018A1", "0A0318A1", "0A0B18A1", "0A0518A1", "0A0418A1", "0A0118A1", "0A0218A1", "02008820", "0200A820", "05147820", "05009821", "000AA823", "00142828", "00132828", "0100E820", "000AA823", "00142828", "00132828", "002D6823", "002C6823", "002B6823", "002D8823", "002C8823", "002B8823", "001E4823", "001D4823", "001C4823", "14011824", "13011824", "14021824", "13021824", "14031824", "13031824", "14041824", "13041824", "14051824", "13051824", "14061824", "13061824", "14071824", "13071824", "14081824", "13081824", "14091824", "13091824", "140A1824", "130A1824", "140B1824", "130B1824", "140D1824", "130D1824", "140E1824", "130E1824", "140F1824", "130F1824", "14101824", "13101824", "14201824", "13201824", "14211824", "13211824", "14221824", "13221824", "14241824", "13241824", "0A004821", "0A014821", "0A024821", "0A034821", "0A044821", "0A054821", "0A064821", "0A074821", "0A084821", "0A094821", "0A0A4821", "01131822", "02131822", "03131822", "04131822", "05131822", "06131822", "07131822", "08131822", "09131822", "0A131822", "0B131822", "0D131822", "0E131822", "0F131822", "10131822", "20131822", "21131822", "22131822", "24131822", "01139823", "02139823", "03139823", "04139823", "05139823", "06139823", "07139823", "08139823", "09139823", "0A139823", "0B139823", "0D139823", "0E139823", "0F139823", "10139823", "20139823", "21139823", "22139823", "24139823"]
	Local $NumMods = 158
	For $i = 0 To $NumMods
		Local $ModStr = StringInStr($ModStruct, $aModStrings[$i], 0, 1) ;
		If ($ModStr <= 0) Then
			$UsefulMods += 1
		EndIf
	Next
	If $UsefulMods == 2 Then Return True
EndFunc   ;==>HasTwoUsefulMods
03/12/2020 16:31 Zvend#261
Quote:
Originally Posted by sadusten View Post
I remember using this function couple of years ago, where it didn't sell dual mod os shields, now it doesnt seem to work, any idea why?

Code:
Func Sell($BAGINDEX)
	Local $aitem
	Local $bag = GETBAG($BAGINDEX)
	Local $NUMOFSLOTS = DllStructGetData($bag, "slots")
	For $i = 1 To $NUMOFSLOTS
		$aitem = GETITEMBYSLOT($BAGINDEX, $i)
		If DllStructGetData($aitem, "ID") = 0 Then ContinueLoop
		Local $Requirement = GetItemReq($aitem)
		Local $lmodelid = DllStructGetData($aitem, "ModelID")
		If CanSell($aitem) Then
			sellitem($aitem)
		EndIf
		Sleep(GetPing() + 250)
	Next
EndFunc   ;==>Sell

Func CanSell($aitem)
	Local $lmodelid = DllStructGetData($aitem, "ModelID")
	Local $Requirement = GetItemReq($aitem)
	Local $lRarity = getrarity($aitem)
	Local $WeaponType = DllStructGetData($aitem, 'Type')
	If ValEquipReturnTrue($aitem) Then Return False
	Return True
EndFunc   ;==>CanSell

Func ValEquipReturnTrue($aitem)
	Local $ModStruct = GetModStruct($aitem)
	Local $lmodelid = DllStructGetData($aitem, 'ModelID')
	Local $WeaponType = DllStructGetData($aitem, 'Type')

	If IsWandFocusShield($WeaponType) Then
		If HasTwoUsefulMods($ModStruct) Or IsHCT20($ModStruct) Then Return True
	EndIf
EndFunc   ;==>ValEquipReturnTrue

Func IsWandFocusShield($WeaponType)
	If $WeaponType == 22 Then Return True
	If $WeaponType == 12 Then Return True
	If $WeaponType == 24 Then Return True
EndFunc   ;==>IsWandFocusShield


Func HasTwoUsefulMods($ModStruct)
	Local $UsefulMods = 0
	Local $aModStrings[159] = ["05320823", "0500F822", "0F00D822", "000A0822", "000AA823", "00140828", "00130828", "0A0018A1", "0A0318A1", "0A0B18A1", "0A0518A1", "0A0418A1", "0A0118A1", "0A0218A1", "02008820", "0200A820", "05147820", "05009821", "000AA823", "00142828", "00132828", "0100E820", "000AA823", "00142828", "00132828", "002D6823", "002C6823", "002B6823", "002D8823", "002C8823", "002B8823", "001E4823", "001D4823", "001C4823", "14011824", "13011824", "14021824", "13021824", "14031824", "13031824", "14041824", "13041824", "14051824", "13051824", "14061824", "13061824", "14071824", "13071824", "14081824", "13081824", "14091824", "13091824", "140A1824", "130A1824", "140B1824", "130B1824", "140D1824", "130D1824", "140E1824", "130E1824", "140F1824", "130F1824", "14101824", "13101824", "14201824", "13201824", "14211824", "13211824", "14221824", "13221824", "14241824", "13241824", "0A004821", "0A014821", "0A024821", "0A034821", "0A044821", "0A054821", "0A064821", "0A074821", "0A084821", "0A094821", "0A0A4821", "01131822", "02131822", "03131822", "04131822", "05131822", "06131822", "07131822", "08131822", "09131822", "0A131822", "0B131822", "0D131822", "0E131822", "0F131822", "10131822", "20131822", "21131822", "22131822", "24131822", "01139823", "02139823", "03139823", "04139823", "05139823", "06139823", "07139823", "08139823", "09139823", "0A139823", "0B139823", "0D139823", "0E139823", "0F139823", "10139823", "20139823", "21139823", "22139823", "24139823"]
	Local $NumMods = 158
	For $i = 0 To $NumMods
		Local $ModStr = StringInStr($ModStruct, $aModStrings[$i], 0, 1) ;
		If ($ModStr <= 0) Then
			$UsefulMods += 1
		EndIf
	Next
	If $UsefulMods == 2 Then Return True
EndFunc   ;==>HasTwoUsefulMods
There is a lot of unnecessary stuff ... uff

1. Why you create so much Local variables and never use them?
2. If you use sth like 'Local $aModStrings[159] = ["05320823", "0500F822",.......' as a constant var. then please use static!
----> Local Static Local $aModStrings[159] = ["05320823", "0500F822", .....

3. Local $ModStr = StringInStr($ModStruct, $aModStrings[$i], 0, 1)
so you are checking if the modstring is inside ur modstring. So StringInStr returns this:
Code:
Success:	the position of the substring.
Failure:	0 if substring not found.
Error:	1 = Invalid "start" or "occurrence" parameter given.
Now you have this little piece:
Code:
If ($ModStr <= 0) Then
			$UsefulMods += 1
		EndIf
Which checks if StringInStr is failed or is smaller than 0 (which is not possible)
so advice u to use:
Code:
If ($ModStr > 0) Then
			$UsefulMods += 1
		EndIf
[/CODE]

4. Im not quite sure about this (I sadly forgot it) but i think that this line:
Code:
If $UsefulMods == 2 Then Return True
should be
Code:
If $UsefulMods >= 2 Then Return True
Because for two hand weapons it can be 3 mods inside. I know
you re especially checking for shields but to write it like that makes the function possible to use it for every weapon.

here is the complete code, please try

Code:
Func Sell($BAGINDEX)
	Local $aitem
	Local $bag = GETBAG($BAGINDEX)
	Local $NUMOFSLOTS = DllStructGetData($bag, "slots")
	For $i = 1 To $NUMOFSLOTS
		$aitem = GETITEMBYSLOT($BAGINDEX, $i)
		If DllStructGetData($aitem, "ID") = 0 Then ContinueLoop
		;Local $Requirement = GetItemReq($aitem)                  Unused
		;Local $lmodelid = DllStructGetData($aitem, "ModelID")    Unused
		If CanSell($aitem) Then
			sellitem($aitem)
		EndIf
		Sleep(GetPing() + 250)
	Next
EndFunc   ;==>Sell

Func CanSell($aitem)
	;Local $lmodelid = DllStructGetData($aitem, "ModelID")        Unused
	;Local $Requirement = GetItemReq($aitem)                      Unused
	;Local $lRarity = getrarity($aitem)                           Unused
	;Local $WeaponType = DllStructGetData($aitem, 'Type')         Unused
	If ValEquipReturnTrue($aitem) Then Return False
	Return True
EndFunc   ;==>CanSell

Func ValEquipReturnTrue($aitem)
	Local $ModStruct = GetModStruct($aitem)
	;Local $lmodelid = DllStructGetData($aitem, 'ModelID')        Unused
	Local $WeaponType = DllStructGetData($aitem, 'Type')

	If IsWandFocusShield($WeaponType) Then
		If HasTwoUsefulMods($ModStruct) Or IsHCT20($ModStruct) Then Return True
	EndIf
EndFunc   ;==>ValEquipReturnTrue

Func IsWandFocusShield($WeaponType)
	If $WeaponType == 22 Then Return True
	If $WeaponType == 12 Then Return True
	If $WeaponType == 24 Then Return True
	Return False                                                  ; Added this line. (Bad style leaving it)
EndFunc   ;==>IsWandFocusShield


Func HasTwoUsefulMods($ModStruct)
	Local $UsefulMods = 0
	Local Static $aModStrings[159] = ["05320823", "0500F822", "0F00D822", "000A0822", "000AA823", "00140828", "00130828", "0A0018A1", "0A0318A1", "0A0B18A1", "0A0518A1", "0A0418A1", "0A0118A1", "0A0218A1", "02008820", "0200A820", "05147820", "05009821", "000AA823", "00142828", "00132828", "0100E820", "000AA823", "00142828", "00132828", "002D6823", "002C6823", "002B6823", "002D8823", "002C8823", "002B8823", "001E4823", "001D4823", "001C4823", "14011824", "13011824", "14021824", "13021824", "14031824", "13031824", "14041824", "13041824", "14051824", "13051824", "14061824", "13061824", "14071824", "13071824", "14081824", "13081824", "14091824", "13091824", "140A1824", "130A1824", "140B1824", "130B1824", "140D1824", "130D1824", "140E1824", "130E1824", "140F1824", "130F1824", "14101824", "13101824", "14201824", "13201824", "14211824", "13211824", "14221824", "13221824", "14241824", "13241824", "0A004821", "0A014821", "0A024821", "0A034821", "0A044821", "0A054821", "0A064821", "0A074821", "0A084821", "0A094821", "0A0A4821", "01131822", "02131822", "03131822", "04131822", "05131822", "06131822", "07131822", "08131822", "09131822", "0A131822", "0B131822", "0D131822", "0E131822", "0F131822", "10131822", "20131822", "21131822", "22131822", "24131822", "01139823", "02139823", "03139823", "04139823", "05139823", "06139823", "07139823", "08139823", "09139823", "0A139823", "0B139823", "0D139823", "0E139823", "0F139823", "10139823", "20139823", "21139823", "22139823", "24139823"]
	;     ^----- Added
	;Local $NumMods = 158                                         Totally unnecessary! Use UBound!
	For $i = 0 To (UBound(aModStrings) - 1)                       ; Changed to UBound
		Local $ModStr = StringInStr($ModStruct, $aModStrings[$i], 0, 1) ;
		If ($ModStr > 0) Then                                     ; changed operator
			$UsefulMods += 1    
		EndIf
	Next
	If $UsefulMods >= 2 Then Return True                          ; changed operator
	Return False                                                  ; Added this line. (Bad style leaving it)
EndFunc   ;==>HasTwoUsefulMods
03/13/2020 00:49 sadusten#262
Quote:
Originally Posted by Zvend View Post
There is a lot of unnecessary stuff ... uff

1. Why you create so much Local variables and never use them?
[/code]
It's not me who made the functions, i got this from an old bot , believe it was from a open sourced mantid bot.

The reason why theres local variables like type,rarity,modelid is because when i posted the functions i removed everything except valequipment function to make it easier and clearer for people to read, felt like it was unneccesery to upload my full sell function :)

I did test it now, and it works good. So far it has not sold shields containing 2 mods wich is either +1-30 hp, +1-45 ench, -2 ench, -2stance. But it has sold dual modded shields with the mods of Plants/Dragons/Dazed etc.
So i assume those mods is not inside the modstrings, wich i can easy get myself and add if i'd want to.

Thanks alot!:)
03/13/2020 00:52 Zvend#263
Quote:
Originally Posted by sadusten View Post
It's not me who made the functions, i got this from an old bot , believe it was from a open sourced mantid bot.

The reason why theres local variables like type,rarity,modelid is because when i posted the functions i removed everything except valequipment function to make it easier and clearer for people to read, felt like it was unneccesery to upload my full sell function :)

I did test it now, and it works good. So far it has not sold shields containing 2 mods wich is either +1-30 hp, +1-45 ench, -2 ench, -2stance. But it has sold dual modded shields with the mods of Plants/Dragons/Dazed etc.
So i assume those mods is not inside the modstrings, wich i can easy get myself and add if i'd want to.

Thanks alot!:)
I'm glad it helped
04/15/2020 00:23 natanders#264
I have a question on why my scripts seems to make reading names/foes blink a dozen of times in the area..

what am I looking at what needs change.. ?
04/15/2020 07:02 phat34#265
You can put a semicolon before these lines in func getagentbyname()

Code:
DISPLAYALL(TRUE)
DISPLAYALL(FALSE)
also they may be in func getagentname() as well...

However I don't believe these functions are working... please let me know if they seem to be working for you?
04/21/2020 00:21 natanders#266
Quote:
Originally Posted by phat34 View Post
You can put a semicolon before these lines in func getagentbyname()

Code:
DISPLAYALL(TRUE)
DISPLAYALL(FALSE)
also they may be in func getagentname() as well...

However I don't believe these functions are working... please let me know if they seem to be working for you?


Thanks I made it work.
04/22/2020 04:31 phat34#267
but the function is not working right?
04/28/2020 12:49 arno223#268
Hi

I've been working with gwa2 and gwca++ api for a while now with success.

Now there is one thing i'm still struggling with and that's the automated trading between 2 players.
I can send the correct packages for doing a request, offer and accept.
But even thought both clients are sending the correct packages, 1 client is staying in the "View/Decline" prompt and causes an error. If i manually click the "View" button the trade goes fine.

Any idea how I can fix this is or work around?
05/04/2020 15:29 LamaChoco#269
Hey, anyone knows a way to get the Guild Name/Tag of an agent ?
05/31/2020 04:41 phat34#270
When trying to fix get agentbyname I noticed the guild tags coming across the registers as well.. I should be able to make a dll call to pull the guild names and will let you know what I come up with... sorry for the delay!