Func ScanForCharname($aModuleBase, $aModuleSize)
Local $lCharNameCode = BinaryToString('0x8BF86A03680F0000C08BCFE8')
ConsoleWrite("$lCharNameCode : " & $lCharNameCode & [MENTION=3576271]CRLF[/MENTION])
Local $lCurrentSearchAddress = $aModuleBase
Local $lMBI[7], $lMBIBuffer = DllStructCreate('dword;dword;dword;dword;dword;dword;dword')
Local $lSearch, $lTmpMemData, $lTmpAddress, $lTmpBuffer = DllStructCreate('ptr'), $i
While $lCurrentSearchAddress < $aModuleBase + $aModuleSize
Local $lMBI[7]
DllCall($mKernelHandle, 'int', 'VirtualQueryEx', 'int', $mGWProcHandle, 'int', $lCurrentSearchAddress, 'ptr', DllStructGetPtr($lMBIBuffer), 'int', DllStructGetSize($lMBIBuffer))
For $i = 0 To 6
$lMBI[$i] = StringStripWS(DllStructGetData($lMBIBuffer, ($i + 1)), 3)
ConsoleWrite("DllStructGetData($lMBIBuffer, (" & $i & " + 1) : " & DllStructGetData($lMBIBuffer, ($i + 1)) & [MENTION=3576271]CRLF[/MENTION])
Next
_ArrayDisplay($lMBI, "$lMBI")
If $lMBI[4] = 4096 Then
Local $lBuffer = DllStructCreate('byte[' & $lMBI[3] & ']')
DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $lCurrentSearchAddress, 'ptr', DllStructGetPtr($lBuffer), 'int', DllStructGetSize($lBuffer), 'int', '')
$lTmpMemData = DllStructGetData($lBuffer, 1)
$lTmpMemData = BinaryToString($lTmpMemData)
ConsoleWrite("$lTmpMemData : " & $lTmpMemData & [MENTION=3576271]CRLF[/MENTION])
$lSearch = StringInStr($lTmpMemData, $lCharNameCode, 2)
If $lSearch > 0 Then
$lTmpAddress = $lCurrentSearchAddress + $lSearch - 1
DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $lTmpAddress - 0x42, 'ptr', DllStructGetPtr($lTmpBuffer), 'int', DllStructGetSize($lTmpBuffer), 'int', '')
Return DllStructGetData($lTmpBuffer, 1) - $aModuleBase
EndIf
$lCurrentSearchAddress += $lMBI[3]
ConsoleWrite [MENTION=3576271]CRLF[/MENTION] & "$lCurrentSearchAddress : " & $lCurrentSearchAddress & [MENTION=3576271]CRLF[/MENTION])
EndIf
WEnd
_ArrayDisplay($lMBI)
_WinAPI_DisplayStruct($lMBIBuffer,"")
Return False
EndFunc ;==>ScanForCharname
Func MemoryRead($aAddress, $aType = 'dword')
Local $lBuffer = DllStructCreate($aType)
DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $aAddress, 'ptr', DllStructGetPtr($lBuffer), 'int', DllStructGetSize($lBuffer), 'int', '')
Return DllStructGetData($lBuffer, 1)
EndFunc ;==>MemoryRead
Func GetModuleInfo(ByRef $aModuleBase, ByRef $aModuleSize)
Local $lProcName = _WinAPI_GetProcessName($mGWProcId)
Local $lProcNameLength = StringLen($lProcName)
Local $lModules = _WinAPI_EnumProcessModules($mGWProcId)
;_ArrayDisplay($lModules, "$lModules")
For $i = 1 To $lModules[0][0]
Local $lModuleName = StringRight($lModules[$i][1], $lProcNameLength)
ConsoleWrite [MENTION=3576271]CRLF[/MENTION] & "$lModuleName : " & $lModuleName & [MENTION=3576271]CRLF[/MENTION])
If StringCompare($lModuleName, $lProcName, $STR_NOCASESENSE) = 0 Then
Local $lModuleInfo = _WinAPI_GetModuleInformation($mGWProcHandle, $lModules[$i][0])
ConsoleWrite [MENTION=3576271]CRLF[/MENTION] & "$lModuleInfoEntryPoint : " & DllStructGetData($lModuleInfo, "EntryPoint") & [MENTION=3576271]CRLF[/MENTION])
$aModuleBase = DllStructGetData($lModuleInfo, 'BaseOfDll')
$aModuleSize = DllStructGetData($lModuleInfo, 'SizeOfImage')
Return True
EndIf
Next
Return False
EndFunc ;==>GetModuleInfo
Func MyScanForCurrentlyLoggedIn($aModuleBase)
Local $lCurrentSearchAddress = $aModuleBase + 0x6292D0
Local $lLoggedInCharacter = MemoryRead($lCurrentSearchAddress,'wchar[30]')
;ConsoleWrite("Found logged-in character: " & $lLoggedInCharacter & [MENTION=3576271]CRLF[/MENTION])
Return $lLoggedInCharacter
EndFunc ;==>MyScanForCurrentlyLoggedIn
Func UseMercantile()
If $UseMercantile = True Then
out("Using Merchant-Stone selected")
Else
out("No Merchant-Stone selected")
EndIf
GetNumberOfFreeSlots <= 10 Then
If CountItemInBagsByModelID(31154) > 0 Then
useitem(31154)
Sleep(500
out("Cleaning Ineventory")
EndIf
$i = 0;
Do
If FindIDKit() = 0 Then
EndIf
BuyIDKit()
Do
Sleep(200)
Until FindIDKit() <> 0
GetNumberOfFreeSlots = 10 Then
Ident()
Sleep(GetPing())
$i += 1
Until FindIDKit() <> 0 Or $i > 4
Sell()
Sleep(300)
EndIf
If GetGoldCharacter() > 97000 Then
Out("Buying Lockpick")
BuyLockPick
Sleep(GetPing()+500) EndIf
If GetGoldCharacter() > 10000 Then
EndFunc
What did you want to do with last If? You might not even need it.Quote:
Im looking to add a func to use merch stones for vaettir bot but im not sure how to go about writing it as im newer to coding with 0 background any help would be wonderful. The issue I have is its telling me that on the endfunc its got no matching If Statment but idn where it needs one...Here is what i have so far
If GetGoldCharacter() > 97000 Then
Out("Buying Lockpick")
BuyLockPick
Sleep(GetPing()+500) EndIf
If GetGoldCharacter() > 10000 Then
EndFunc[/code]
Func ToggleRendering()
$RenderingEnabled = Not $RenderingEnabled
If $RenderingEnabled Then
EnableRendering()
WinSetState(GetWindowHandle(), "", [MENTION=330060]Sw_[/MENTION]SHOW)
Else
DisableRendering()
WinSetState(GetWindowHandle(), "", [MENTION=330060]Sw_[/MENTION]HIDE)
ClearMemory()
EndIf
EndFunc ;==>ToggleRendering
What i was aiming to do is make it so if the gold value is 10k then end the func for merch stoneQuote:
What did you want to do with last If? You might not even need it.
I have added this function to an old bot i had and whenever i activate it, rendering is off BUT bot also stops at that location. Am i doing something wrong or did something change in gw?
Code:Func ToggleRendering() $RenderingEnabled = Not $RenderingEnabled If $RenderingEnabled Then EnableRendering() WinSetState(GetWindowHandle(), "", [MENTION=330060]Sw_[/MENTION]SHOW) Else DisableRendering() WinSetState(GetWindowHandle(), "", [MENTION=330060]Sw_[/MENTION]HIDE) ClearMemory() EndIf EndFunc ;==>ToggleRendering
Put option to stop in your buylockpick function.Quote:
What i was aiming to do is make it so if the gold value is 10k then end the func for merch stone
If gold > 97k then
buylockpick()
EndIf
func buylockpick
while GetGoldCharacter() > 10000
buy 1 lockpick part
WEnd
Endfunc
To do so, you need to go through your inventory in order to detect white item, then find the first available slot in your storage and then move item into this slot.Quote:
i'd like to setup a func to pull multiple item from inventory to chest (white item)
I have all Global Const ID and Func Canpickup ....
but need help how to pull them from inv to chest
Any help is really appreciated
Func StoreWhiteItems() Local $aItem Local $slot Local $full = False For $bagIndex = 1 To 4 For $slotIndex = 1 To DllStructGetData(GetBag($bagIndex), 'Slots') $aItem = GetItemBySlot($bagIndex, $slotIndex) If DllStructGetData($aItem, 'ID') = 0 Then ContinueLoop If GetRarity($aItem) == $RARITY_White Then ;2621 For $storePan = 8 To 12 $slot = FindEmptySlot($storePan) If $slot <> 0 Then ExitLoop EndIf Next If $slot <> 0 Then MoveItem($aItem, $storePan, $slot) Sleep(GetPing()+500) Else ExitLoop 2 ;Full storage... EndIf EndIf Next Next EndFunc ;==>StoreWhiteItems Func FindEmptySlot($bagIndex) Local $aItem For $slotIndex = 1 To DllStructGetData(GetBag($bagIndex), 'Slots') $aItem= GetItemBySlot($bagIndex, $slotIndex) If DllStructGetData($aItem, 'ID') = 0 Then ;Means empty slot Return $slotIndex EndIf Next Return 0 EndFunc ;==>FindEmptySlot
Local $lItemStruct = DllStructCreate('long Id;long AgentId;byte Unknown1[4];ptr Bag;ptr ModStruct;long ModStructSize;ptr Customized;byte unknown2[4];byte Type;byte unknown4;short ExtraId;short Value;byte unknown4[2];short Interaction;long ModelId;ptr ModString;byte unknown5[4];ptr NameString;ptr SingleItemName;byte Unknown4[10];byte IsSalvageable;byte Unknown6;byte Quantity;byte Equiped;byte Profession;byte Type2;byte Slot')
struct Item { // total: 0x54/84
/* +h0000 */ uint32_t item_id;
/* +h0004 */ uint32_t agent_id;
/* +h0008 */ Bag *bag_equipped; // Only valid if Item is a equipped Bag
/* +h000C */ Bag *bag;
/* +h0010 */ ItemModifier *mod_struct; // Pointer to an array of mods.
/* +h0014 */ uint32_t mod_struct_size; // Size of this array.
/* +h0018 */ wchar_t *customized;
/* +h001C */ uint32_t model_file_id;
/* +h0020 */ uint8_t type;
/* +h0021 */ uint8_t h0021;
/* +h0022 */ uint16_t extra_id;
/* +h0024 */ uint16_t value;
/* +h0026 */ uint16_t h0026;
/* +h0028 */ uint32_t interaction;
/* +h002C */ uint32_t model_id;
/* +h0030 */ wchar_t *info_string;
/* +h0034 */ wchar_t *name_enc;
/* +h0038 */ wchar_t *complete_name_enc; // with color, quantity, etc.
/* +h003C */ wchar_t *single_item_name; // with color, w/o quantity, named as single item
/* +h0040 */ uint8_t h0040[10];
/* +h004A */ uint8_t is_material_salvageable; // Only valid for type 11 (Materials)
/* +h004B */ uint8_t h004B; // probably used for quantity extension for new material storage
/* +h004C */ uint16_t quantity;
/* +h004E */ uint8_t equipped;
/* +h004F */ uint8_t profession;
/* +h0050 */ uint8_t slot;
MemoryRead(DllStructGetData($aItem, 'singleItemName'),'dword') MemoryRead(DllStructGetData($aItem, 'singleItemName'),'STR') MemoryRead(DllStructGetData($aItem, 'singleItemName'),'WSTR')
MemoryRead(DllStructGetData($aItem, 'singleItemName'),'Byte[x]') MemoryRead(DllStructGetData($aItem, 'singleItemName'),'wchar[x]')