|
You last visited: Today at 10:54
Advertisement
Beginner Bot programming questions
Discussion on Beginner Bot programming questions within the GW Bots forum part of the Guild Wars category.
01/22/2024, 13:15
|
#16
|
elite*gold: 0
Join Date: Dec 2023
Posts: 15
Received Thanks: 0
|
Quote:
Originally Posted by Mrjambix
The headers are accurate, are you trying to ONLY Salvage? or is there more functions to this? Post the entire script so we can take a look at it.
|
Simple, I press a button and call a function with:
Code:
$aitem = GetItemBySlot(1, 1)
StartSalvage($aitem)
it seems the StartSalvage goes trough but then the client crashes.
It seems I am missing something / not understanding how it (should) work, for now I just want to salvage items to get materials without any further logic.
|
|
|
01/22/2024, 18:31
|
#17
|
elite*gold: 258
Join Date: Jan 2021
Posts: 132
Received Thanks: 142
|
Quote:
Originally Posted by dhanvin
Simple, I press a button and call a function with:
Code:
$aitem = GetItemBySlot(1, 1)
StartSalvage($aitem)
it seems the StartSalvage goes trough but then the client crashes.
It seems I am missing something / not understanding how it (should) work, for now I just want to salvage items to get materials without any further logic.
|
Try the following:
Code:
$aItem = GetItemBySlot(1, 1)
Local $lItemID = DllStructGetData($aItem, 'ID')
$itemStruct = GetItemByItemID($lItemID)
Local $lItemName = GetItemName($itemStruct)
If FindSalvageKit() <> 0 Then
StartSalvage($aItem)
EndIf
What it does is this checks for the availability of a salvage kit using FindSalvageKit().
If a salvage kit is found (indicated by FindSalvageKit() returning a non-zero value), it proceeds to call StartSalvage($aItem)
|
|
|
01/23/2024, 16:11
|
#18
|
elite*gold: 0
Join Date: Dec 2023
Posts: 15
Received Thanks: 0
|
Quote:
Originally Posted by Mrjambix
Try the following:
Code:
$aItem = GetItemBySlot(1, 1)
Local $lItemID = DllStructGetData($aItem, 'ID')
$itemStruct = GetItemByItemID($lItemID)
Local $lItemName = GetItemName($itemStruct)
If FindSalvageKit() <> 0 Then
StartSalvage($aItem)
EndIf
What it does is this checks for the availability of a salvage kit using FindSalvageKit().
If a salvage kit is found (indicated by FindSalvageKit() returning a non-zero value), it proceeds to call StartSalvage($aItem)
|
I tried that, still crashes. Is it maybe because I'm doing in the pre?
I had to change "Case 2992 to Case 2993", because in gwtoolbox it shows me as ID 2993.
Code:
;~ Description: Returns item ID of salvage kit in inventory.
Func FindSalvageKit()
Local $lItem
Local $lKit = 0
Local $lUses = 101
For $i = 1 To 16
For $j = 1 To DllStructGetData(GetBag($i), 'Slots')
$lItem = GetItemBySlot($i, $j)
Switch DllStructGetData($lItem, 'ModelID')
Case 2993
If DllStructGetData($lItem, 'Value') / 2 < $lUses Then
$lKit = DllStructGetData($lItem, 'ID')
$lUses = DllStructGetData($lItem, 'Value') / 2
EndIf
ContinueLoop
EndSwitch
Next
Next
Return $lKit
EndFunc ;==>FindSalvageKit
Code:
*--> Crash <--*
Exception: c0000005
Memory at address ffffffff could not be written
App: Gw.exe
BaseAddr: 00520000
ProgramId: 1
Build: 37325
When: 1/23/2024 21:39:54
Flags: 0
|
|
|
01/24/2024, 21:57
|
#19
|
elite*gold: 0
Join Date: May 2011
Posts: 111
Received Thanks: 94
|
There needs to be a sleep between each salvage, you aren't trying to salvage multiple items rapidly are you? If you do this even normally without a script it will crash your game. So if you have a loop to search for an item and salvage, there needs to be a sleep called in that loop.
|
|
|
01/25/2024, 19:13
|
#20
|
elite*gold: 258
Join Date: Jan 2021
Posts: 132
Received Thanks: 142
|
Quote:
Originally Posted by Underavelvetmoon
There needs to be a sleep between each salvage, you aren't trying to salvage multiple items rapidly are you? If you do this even normally without a script it will crash your game. So if you have a loop to search for an item and salvage, there needs to be a sleep called in that loop.
|
I replicated his issue and it's coming from elsewhere.
not using the sleep between salvage isn't what's causing that crash, although you are 100% right, it will cause another crash if he doesn't add it.
The issue so far I've traced it back to the Command SalvageFunction and SalvageGlobal.
Code:
_('CommandSalvage:')
_('push eax')
_('push ecx')
_('push ebx')
_('mov ebx,SalvageGlobal')
_('mov ecx,dword[eax+4]')
_('mov dword[ebx],ecx')
_('add ebx,4')
_('mov ecx,dword[eax+8]')
_('mov dword[ebx],ecx')
_('mov ebx,dword[eax+4]')
_('push ebx')
_('mov ebx,dword[eax+8]')
_('push ebx')
_('mov ebx,dword[eax+c]')
_('push ebx')
_('call SalvageFunction')
_('add esp,C')
_('pop ebx')
_('pop ecx')
_('pop eax')
_('ljmp CommandReturn')
Code:
SetValue('SalvageFunction', MemoryRead(GetValue('ScanSalvageFunction') + 8) - 18)
SetValue('SalvageGlobal', MemoryRead(MemoryRead(GetValue('ScanSalvageGlobal') + 8) + 1))
SetValue('SalvageFunction', '0x' & Hex(GetScannedAddress('ScanSalvageFunction', -10), 8))
SetValue('SalvageGlobal', '0x' & Hex(MemoryRead(GetScannedAddress('ScanSalvageGlobal', 1) - 0x4), 8))
Need to verify if the address above are still valid and the Patterns below which is currently the right one if it didn't change to something else.
Code:
AddPattern('5F5E5B741A6860EA0000')
_('ScanSalvageFunction:')
;====================
AddPattern('8BFA8BD9897DF0895DF4') ;8BD9897DG0895DF4
;or
AddPattern('33C58945FC8B45088945F08B450C8945F48B45108945F88D45EC506A10C745EC75') ; was 'ec76' dec 18th, 2020 fix -P34
_('ScanSalvageGlobal:')
|
|
|
01/27/2024, 13:13
|
#21
|
elite*gold: 0
Join Date: Dec 2023
Posts: 15
Received Thanks: 0
|
Quote:
Originally Posted by Mrjambix
I replicated his issue and it's coming from elsewhere.
not using the sleep between salvage isn't what's causing that crash, although you are 100% right, it will cause another crash if he doesn't add it.
The issue so far I've traced it back to the Command SalvageFunction and SalvageGlobal.
Code:
_('CommandSalvage:')
_('push eax')
_('push ecx')
_('push ebx')
_('mov ebx,SalvageGlobal')
_('mov ecx,dword[eax+4]')
_('mov dword[ebx],ecx')
_('add ebx,4')
_('mov ecx,dword[eax+8]')
_('mov dword[ebx],ecx')
_('mov ebx,dword[eax+4]')
_('push ebx')
_('mov ebx,dword[eax+8]')
_('push ebx')
_('mov ebx,dword[eax+c]')
_('push ebx')
_('call SalvageFunction')
_('add esp,C')
_('pop ebx')
_('pop ecx')
_('pop eax')
_('ljmp CommandReturn')
Code:
SetValue('SalvageFunction', MemoryRead(GetValue('ScanSalvageFunction') + 8) - 18)
SetValue('SalvageGlobal', MemoryRead(MemoryRead(GetValue('ScanSalvageGlobal') + 8) + 1))
SetValue('SalvageFunction', '0x' & Hex(GetScannedAddress('ScanSalvageFunction', -10), 8))
SetValue('SalvageGlobal', '0x' & Hex(MemoryRead(GetScannedAddress('ScanSalvageGlobal', 1) - 0x4), 8))
Need to verify if the address above are still valid and the Patterns below which is currently the right one if it didn't change to something else.
Code:
AddPattern('5F5E5B741A6860EA0000')
_('ScanSalvageFunction:')
;====================
AddPattern('8BFA8BD9897DF0895DF4') ;8BD9897DG0895DF4
;or
AddPattern('33C58945FC8B45088945F08B450C8945F48B45108945F88D45EC506A10C745EC75') ; was 'ec76' dec 18th, 2020 fix -P34
_('ScanSalvageGlobal:')
|
That was it!
Somehow the whole CommandSalvage push memory code was commented out and also wrong Patterns.
Thank you very much.
Thanks everyone for helping / answers.
|
|
|
01/28/2024, 18:25
|
#22
|
elite*gold: 258
Join Date: Jan 2021
Posts: 132
Received Thanks: 142
|
Quote:
Originally Posted by dhanvin
That was it!
Somehow the whole CommandSalvage push memory code was commented out and also wrong Patterns.
Thank you very much.
Thanks everyone for helping / answers.
|
That's great! Did you manage to find the working patterns?
Working Patterns are the following:
Code:
_('ScanSalvageFunction:')
AddPattern('33C58945FC8B45088945F08B450C8945F48B45108945F88D45EC506A10C745EC75')
_('ScanSalvageGlobal:')
AddPattern('8B5104538945F48B4108568945E88B410C578945EC8B4110528955E48945F0')
|
|
|
02/01/2024, 09:20
|
#23
|
elite*gold: 0
Join Date: Dec 2023
Posts: 15
Received Thanks: 0
|
ignore
|
|
|
03/07/2024, 04:53
|
#24
|
elite*gold: 0
Join Date: Jan 2022
Posts: 6
Received Thanks: 1
|
im trying like heck to figure out how to code this and im kinda **** at doing it anyway. (by kinda **** i mean the only thing i have coded myself so far is making my character run around day 2 of trying)
Essentially I'm using a dervish feather farm bot and i cant stand leaving behind unid'd blues (crazy i know) going through the code i have seen some of how looting works. this is what im seeing
lots of Global Const $model_id_blah blah blah
I believe this section is saying what can be picked up so i added
; === Armor ===
Global Const $model_id_sensali_Garb = 1156
Global Const $model_id_Sensali_crestguard = 1159
#EndRegion Constants
Further down im seeing can pick up and this is in it
Local $lRarity = GetRarity($lItem)
If ($lRarity == 2624) And ($PickUpGolds == True) Then Return True ; 2624 = golden Items
Return False
How do i make it get rarity on the sensali armors and pick up blues and purples as well?
|
|
|
 |
|
Similar Threads
|
beginner in private server programming
11/14/2014 - CO2 Private Server - 3 Replies
Hello, I'm daniel and I'm a c# and vb.net programmer (well everything I write in a language i can manage and write it in the other language). I am not a professional since I am a self taught orgrammmer.
I've downloaded Redux source by pro4never and successfully ran the server. Well it was pretty easy to figure out how to add new npc and these basic stuff but for example when I go to the function or the procedure of writing the NPC I don't understand most of the code written inside them. In...
|
Beginner sucht Beginner
04/04/2014 - Starcraft 2 - 7 Replies
Moinmoin,
Suche einen "Beginner", d.H erstmal gegen K.I üben, wenn man das nachher dann abgehakt hat, vllt mal gegen echte Spieler.
Zu mir: 17 Jahre alt, Headset vorhanden, im Moment viel Zeit.
Zu euch: Mindestens über 18 und Stimmlich bitte weit über 18...
Headset solltet ihr ein Funktionstüchtiges haben, zum quatschen und absprechen.
Könnt mich ja mal in Steam adden, oder eine PM an mich, dann gebe ich euch Battle.net ID und Code
Steam ID: DLIKP, habe ein Engelsbild
|
All times are GMT +1. The time now is 10:54.
|
|