Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Final Fantasy XIV
You last visited: Today at 15:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



FF XIV Memory addresses

Discussion on FF XIV Memory addresses within the Final Fantasy XIV forum part of the MMORPGs category.

Reply
 
Old   #1
 
13ouncer's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 271
Received Thanks: 28
FF XIV Memory addresses

<Solved>
What you do in cheat engine to find the address.
If You want to use that address, just use "Go to address" and type in "Engine.dll"+002FC778. It will jump there. You can add it to the cheat table too.

Here is a example script of how these addresses are used in autoit to find the value of the pointer.
Keep in mind you have to edit this script for it to work for you!
Code:
#include <NomadMemory.au3>
#include <Array.au3>
$id = ProcessExists("ffxivgame.exe")
If $id = 0 Then
    MsgBox(0, "", "Application is not running. Please run it before starting this app.")
    Exit
EndIf
#comments-start
Sv types
BYTE 8bit(1byte) unsigned char 
BOOLEAN 8bit(1byte) unsigned char 
CHAR 8bit(1byte) ASCII char 
WCHAR 16bit(2byte) UNICODE wide char 
short 16bit(2bytes) signed integer 
USHORT 16bit(2bytes) unsigned integer 
WORD 16bit(2bytes) unsigned integer 
int 32bit(4bytes) signed integer 
long 32bit(4bytes) signed integer 
BOOL 32bit(4bytes) signed integer 
UINT 32bit(4bytes) unsigned integer 
ULONG 32bit(4bytes) unsigned integer 
DWORD 32bit(4bytes) unsigned integer 
INT64 64bit(8bytes) signed integer 
UINT64 64bit(8bytes) unsigned integer 
ptr 32 or 64bit unsigned integer (depending on if the x86 or x64 version of AutoIt is used) 
HWND 32bit(4bytes) integer 
HANDLE 32bit(4bytes) integer 
float 32bit(4bytes) floating point 
double 64bit(8bytes) floating point 
INT_PTR, LONG_PTR, LRESULT, LPARAM 32 or 64bit signed integer (depending on if the x86 or x64 version of AutoIt is used) 
UINT_PTR, ULONG_PTR, DWORD_PTR, WPARAM 32 or 64bit unsigned integer (depending on if the x86 or x64 version of AutoIt is used) 
Create arrays by adding '[size]' after the data type: DllStructCreate("int;char[128]")
#comments-end
$sv_Type = 'CHAR[16]'	

Global $Offset1[3] ;<----Sets a first address offsets(Cheatengine goes from bottom to top)
$Offset1[0] = 0 
$Offset1[1] = Dec("E0")
$Offset1[2] = Dec("0")
;$Offset1[3] = Dec("")
;$Offset1[4] = Dec("")
;$Offset1[5] = Dec("")
Global $Offset2[3] ;<----Sets a second address offsets(Cheatengine goes from bottom to top)
$Offset2[0] = 0 
$Offset2[1] = Dec("E0")
$Offset2[2] = Dec("0")
;$Offset2[3] = Dec("")
;$Offset2[4] = Dec("")
;$Offset2[5] = Dec("")

$Memory = _MemoryOpen($id) ;<----Opens process memory for reading
$Statpoints1 = "0x" & Hex(0x01281850) ;<----Enter the base address here 1st
$Statpoints2 = "0x" & Hex(0x01281870) ;<----Enter the base address here 2nd
$Value = _MemoryPointerRead($Statpoints1, $Memory, $Offset1, $sv_Type) ;<----Reads from the static pointer address given at $Statpoints1 and finds the value
_ArrayDisplay($Value) ;<----Displays $Value in an array list
$Value = _MemoryPointerRead($Statpoints2, $Memory, $Offset2, $sv_Type) ;<----Reads from the static pointer address given at $Statpoints2 and finds the value
_ArrayDisplay($Value) ;<----Displays $Value in an array list
13ouncer is offline  
Thanks
1 User
Old 08/09/2011, 17:19   #2
 
elite*gold: 0
Join Date: Feb 2006
Posts: 629
Received Thanks: 195
Start with the CE tutorial, then apply those techniques to the game.
lucid is offline  
Old 08/09/2011, 19:24   #3
 
13ouncer's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 271
Received Thanks: 28
I went through the tutorial ^^
13ouncer is offline  
Old 08/10/2011, 14:42   #4
 
elite*gold: 0
Join Date: Jan 2005
Posts: 54
Received Thanks: 1
Quote:
Originally Posted by 13ouncer View Post
While trying to search for the base address that sends text to the fishing widget, I keep getting the same address. That address being 0395EC90. This address resets each time FF XIV window is closed though, so I must be doing something wrong.

Using cheat engine to locate addresses.

This is what I am doing:
Value = Select a depth at which to fish
Add Address = 0395EC90
Search what writes to address.
Search Value = 0395EC90
Add address = 03F74430
Add pointer = 03F74430 (no offset)
Search access to pointer (This is what I am stuck on)

3 Values pop up, but not one value accesses a thing.
I would suggest that since this game uses pointers that aren't obvious (i.e. cheat engine will send you in a circle if you follow the tutorial method for locating them) that it would be easier to find the base addr of the game, then search memory for a signature, "i.e. FishWidget" or whatever they are calling it, then read from that addr using offsets

that way you don't have to dwell so much on tracing back a multi-level pointer, which could change from release to release anyway.

if you are scanning for a string in memory, then unless the offsets > from that string < change, you should be more future proofed.

if you do want to pursue the base pointer method, then you'll have to scroll up in the disassembly to find what the real pointer is .. look for asm instructions with [eax] [edi] [edi] etc earlier in the dissassembly as [] = pointer refs
elm33 is offline  
Old 08/10/2011, 15:04   #5
 
elite*gold: 0
Join Date: Feb 2006
Posts: 629
Received Thanks: 195
elm33 - Unfortunately, fishing information won't be quite as easy as you describe. While there are widget structures, the pointers are deeply nested and completely independent of the widget data. If it were that simple, I'd have done it already

If fishing data is easily made available somewhere, I have not found it.

13ouncer - No offense, but based upon what you've posted in this thread I would still recommend a couple trips through the CE tutorial. For example, it is made clear in the CE tutorial that some addresses can change when a program is closed:
Quote:
Originally Posted by 13ouncer
This address resets each time FF XIV window is closed though, so I must be doing something wrong.
Quote:
Originally Posted by Cheat Engine Tutorial Step 5 Text
Sometimes the location something is stored at changes when you restart the game, or even while you're playing...
The "changing address" theme exists in other steps of the tutorial as well, so it should come as no surprise to you.
lucid is offline  
Old 08/10/2011, 17:03   #6
 
elite*gold: 0
Join Date: Jan 2005
Posts: 54
Received Thanks: 1
Quote:
Originally Posted by lucid View Post
elm33 - Unfortunately, fishing information won't be quite as easy as you describe. While there are widget structures, the pointers are deeply nested and completely independent of the widget data. If it were that simple, I'd have done it already

If fishing data is easily made available somewhere, I have not found it.

13ouncer - No offense, but based upon what you've posted in this thread I would still recommend a couple trips through the CE tutorial. For example, it is made clear in the CE tutorial that some addresses can change when a program is closed:



The "changing address" theme exists in other steps of the tutorial as well, so it should come as no surprise to you.
lucid, I agree. I have spent a significant amount of time watching the game and how it "works". I am not a good enough coder myself to do anything with it, the widgets (structures) that the game initializes during different activities come and go though, so it appears to me with some "fancy" memory routines, that were fired off at the appropriate times you can fish off the widgets, if you are fishing when they actually "exist" in the heap
elm33 is offline  
Old 08/10/2011, 17:33   #7
 
elite*gold: 0
Join Date: Feb 2006
Posts: 629
Received Thanks: 195
Quote:
Originally Posted by elm33 View Post
lucid, I agree. I have spent a significant amount of time watching the game and how it "works". I am not a good enough coder myself to do anything with it, the widgets (structures) that the game initializes during different activities come and go though, so it appears to me with some "fancy" memory routines, that were fired off at the appropriate times you can fish off the widgets, if you are fishing when they actually "exist" in the heap
Sorry, but no. The information he wants is not in the fishing widget region of the game's memory at all.

Quote:
Originally Posted by 13ouncer
sends text to the fishing widget
lucid is offline  
Old 08/10/2011, 18:53   #8
 
13ouncer's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 271
Received Thanks: 28
I found a neat and quick way to find base addresses, but I have not tested them with FF XIV yet. I am just messing around with Diablo II to get a "feel" for it. Since I found the static address I now want to add it to a code using autoit, but since the address has many pointers I am not sure how to add them all to point to the address. So far what I have is this.

Code:
#RequireAdmin ;User Account must have Administrator privlidges 
#include <NomadMemory.au3> ;Include the NomadMemory functions in this script 

$Adresse = 0x00016580
Dim $Offset[6] = [0, 0x124, 0x70, 0x14, 0x2C4, 0xD4]

while 1
    $Process = _MemoryOpen(ProcessExists("Game.exe"))
    If Not @error Then
            $Value = _MemoryPointerRead($Adresse, $Process, $Offset)
            If Not @error Then ToolTip($Value[1],0,0)

            _MemoryClose($Process)
    EndIf

    Sleep(100);<<<<<<< Note this sleep this is how fast we read memory
WEnd


One problem I run into is that my Address="D2sound.dll"+00016580 and I am not sure if nomad can read that.

I also do not know if I am adding the offsets correctly.

Edit: Maybe I have to search each offset individually?
13ouncer is offline  
Old 08/10/2011, 19:05   #9
 
elite*gold: 0
Join Date: Jan 2005
Posts: 54
Received Thanks: 1
Quote:
Originally Posted by lucid View Post
Sorry, but no. The information he wants is not in the fishing widget region of the game's memory at all.
Ahh that may be. I have not looked at the fishing itself. You can find certain values in memory offset from the craft widget reliably, so I assumed the same was true for the fish widget. my mistake
elm33 is offline  
Old 08/10/2011, 19:23   #10
 
elite*gold: 0
Join Date: Feb 2006
Posts: 629
Received Thanks: 195
Base offset is almost always 0x0400000, but can be dynamic in some environments as I understand it, so it is a bit more proper to get it automatically so you never have to worry.

I seem to recall having to write a function to get a base address because nomad and "memory" (similar lib) did not include one. The core component for getting the base address is a call to VirtualQueryEx via DllCall().

You can read about VirtualQueryEx on MSDN:

Get ready to become real friendly with WinAPI if you're going to be writing more advanced bots.

Your original bot didn't have any function declarations (or very few), if that is the case with your new bot as well then I would recommend you take time off of memory-related work and become more familiar with general programming concepts before moving on. If you aren't familiar with those kinds of things, or don't include them from the start, then your new bot will almost certainly need to be completely rewritten.

Can you tell me more about your prior programming experiences so I know what kinds of concepts you're already familiar with? They're going to play a critical role in your new code.
lucid is offline  
Old 08/10/2011, 19:38   #11
 
13ouncer's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 271
Received Thanks: 28
At this point I am researching, that is all. I do not have any prior programming experience with major programming languages, but please do not belittle my ability to learn.

Besides, I do this for fun.
13ouncer is offline  
Old 08/10/2011, 20:03   #12
 
elite*gold: 0
Join Date: Jan 2005
Posts: 54
Received Thanks: 1
Quote:
Originally Posted by 13ouncer View Post
At this point I am researching, that is all. I do not have any prior programming experience with major programming languages, but please do not belittle my ability to learn.

Besides, I do this for fun.
Caution: Your mileage may very, I am just learning myself

Visual Studio VB.NET and C#.NET are totally free from Microsoft and will do just about anything you want as far as this application. I would suggest checking them out-

Before I embarked on learning C#, I reviewed several e-books that are available in print form.

The one I settled on is "Illustrated C# 2010 - D. Solis (Apress, 2010).

I like this book because it leaves out the ASP.NET, ADO.NET, and the other web stuff and really just focuses on C# without all the other fluff to cloud your understanding, when you are on the learning curve.

I particularly appreciate this book because the author uses lots of diagrams to relate how your classes, methods, and so forth are actually work on the stack and heap. This adds a layer of understanding to whats really happening in the computer that I found very valuable.

It also serves as a good reference book.

My only complaint with the book is that the code examples are not always realistic, so sometimes you may want a better code snippet to understand the application of what you are learning. Of course code snippets are widely available on the net.

If you want a book that uses more applicable code, you can check out Murach's C#, it uses very applicable code examples, but I find the book to be more convoluted in explanation.

Edit: I agree with Lucid that if you don't have a good foundational understanding of the language you are coding in, that your setting yourself up for a frustrating experience. I have in the past tried to dive in head first using example code others have produced (there is a plethora on cheat engine forums for example) but its really not very productive if you don't really understand the why behind it all. So as aggravating as it may be, there is alot to be gained by spending some time on the fundamentals, even though it puts a "project" on hold
elm33 is offline  
Old 08/10/2011, 20:19   #13
 
elite*gold: 0
Join Date: Feb 2006
Posts: 629
Received Thanks: 195
Quote:
Originally Posted by 13ouncer View Post
At this point I am researching, that is all. I do not have any prior programming experience with major programming languages, but please do not belittle my ability to learn.

Besides, I do this for fun.
I didn't intend to belittle you, sorry if that's how it came across. It's just that functions are a core idea in many programming languages, and they do a -tremendous- amount in terms of keeping your code clean and understandable if they are named reasonably well. They also condense your code, making it easier to debug as a result of less vertical scrolling and the inherent descriptiveness of additional function names acting as metadata within the code.

When you have thousands of lines of code and an error happens "somewhere", it can be a real challenge to find if they're all within one large loop. You're already using functions all the time, they are just built-in functions.

Functions will allow you to do the same thing over and over without having to rewrite the code.

Here's an example of how this can help you. Given this example:
Code:
If $Check_1 <> $Recent_Check_1 Then
			$Pixel_Error = 0
			$Location = 1
			GUICtrlSetData($Craft_Edit, "At location " & $Location & ". Moving to location " & $Craft_Item_Location & @CRLF,1) 
			If $Location = $Craft_Item_Location Then 
				Sleep ($Sleep_Each_Select)
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Enter}")
				Sleep ($Sleep_Open_Window)
				$Selected = 1
				ExitLoop
			ElseIf $Craft_Item_Location > 1 Then
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Down}")
				Sleep ($Sleep_Each_Select)	
			ElseIf $Craft_Item_Location < 1 Then
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Up}")
				Sleep ($Sleep_Each_Select)						
			Endif
		EndIf	
		If $Check_2 <> $Recent_Check_2 Then
			$Pixel_Error = 0
			$Location = 2
			GUICtrlSetData($Craft_Edit, "At location " & $Location & ". Moving to location " & $Craft_Item_Location & @CRLF,1) 
			If $Location = $Craft_Item_Location Then 
				Sleep ($Sleep_Each_Select)
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Enter}")
				Sleep ($Sleep_Open_Window)
				$Selected = 1
				ExitLoop
			ElseIf $Craft_Item_Location > 2 Then
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Down}")
				Sleep ($Sleep_Each_Select)	
			ElseIf $Craft_Item_Location < 2 Then
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Up}")
				Sleep ($Sleep_Each_Select)						
			Endif
		EndIf
		If $Check_3 <> $Recent_Check_3 Then
			$Pixel_Error = 0
			$Location = 3
			GUICtrlSetData($Craft_Edit, "At location " & $Location & ". Moving to location " & $Craft_Item_Location & @CRLF,1) 
			If $Location = $Craft_Item_Location Then 
				Sleep ($Sleep_Each_Select)
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Enter}")
				Sleep ($Sleep_Open_Window)
				$Selected = 1
				ExitLoop
			ElseIf $Craft_Item_Location > 3 Then
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Down}")
				Sleep ($Sleep_Each_Select)	
			ElseIf $Craft_Item_Location < 3 Then
				ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Up}")
				Sleep ($Sleep_Each_Select)						
			Endif
		EndIf
You're effectively just pressing a different button each time. Instead of writing sleeps all over your application, you could take an approach like this:

Code:
		Func FFKeyPress($KeyString)
		    ControlSend("[CLASS:RAPTURE]", "", $HWND, $KeyString)
		    Sleep ($Sleep_Each_Select)
		EndFunc

                Func Check($CheckValue, $RecentCheck, $Location)
		    If $CheckValue <> $RecentCheck Then
                        $Pixel_Error = 0
                        ; Location is passed into this function instead of being statically set
			GUICtrlSetData($Craft_Edit, "At location " & $Location & ". Moving to location " & $Craft_Item_Location & @CRLF,1) 
			If $Location = $Craft_Item_Location Then 
				Sleep ($Sleep_Each_Select)
				FFKeyPress({Enter}")
				$Selected = 1
				ExitLoop
			ElseIf $Craft_Item_Location > $Location Then
				FFKeyPress("{Down}")
			ElseIf $Craft_Item_Location < $Location Then
				FFKeyPress("{Up}")
			EndIf
                    EndIf
                End Func

		Check($Check_1, $Recent_Check1, 1)
		Check($Check_2, $Recent_Check2, 2)
		Check($Check_3, $Recent_Check3, 3)
This probably wouldn't exactly work (due to scope issues), but the code length is indeed very similar to this, which is less than half as many lines. ControlSend is called 214 times within your original bot, so the code could be substantially condensed.

You could then load the $Check_x and $Recent_Checkx variables into an array and use the counter (as you loop through) as the $Location argument, which would further condense the code.

I hope you don't misinterpret this post, I'm just trying to give you some insight so your new bot will be even better!

Quote:
Originally Posted by elm33 View Post
Edit: I agree with Lucid that if you don't have a good foundational understanding of the language you are coding in, that your setting yourself up for a frustrating experience. I have in the past tried to dive in head first using example code others have produced (there is a plethora on cheat engine forums for example) but its really not very productive if you don't really understand the why behind it all. So as aggravating as it may be, there is alot to be gained by spending some time on the fundamentals, even though it puts a "project" on hold
elm is right on!
lucid is offline  
Old 08/10/2011, 20:29   #14
 
13ouncer's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 271
Received Thanks: 28
That is good advice lucid and one that I have been trying to work on. I notice my code be be severely shortened by adding functions such as that. Take for example
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Func jig;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func Fish_Jig()
Local $Check_1, $Check_2, $Check_3, $Check_4, $Check_5, $Check_6, $Check_7
$Pixel_Error = 0	
$Nibbles = 0
$Jig = 0
$Jig_Count = 1
$x = 0
	While $On = True
		$Pixel_Error = $Pixel_Error + 1
		If $Pixel_Error = $Error_Count_Defined Then
			GUICtrlSetData($Fish_Edit, "Cannot find window 3, fish got away, lost, obtained. or tired pixels. Please confirm again." & @CRLF,1)	
			$Pixel_Error = 0
			Exitloop	
		Endif	
		$Check_1 = PixelGetColor(426, 203, $sHWND);Jigbox3window
		$Check_2 = PixelGetColor(121, 249, $sHWND) ;Fishgotaway
		$Check_3 = PixelGetColor(129, 240, $sHWND);Fishlost
		$Check_4 = PixelGetColor(102, 243, $sHWND);Fishobtain
		$Check_5 = PixelGetColor(180, 232, $sHWND);Tired
		$Check_6 = PixelGetColor(482, 26, $sHWND)
		$Check_7 = PixelGetColor(482, 143, $sHWND)		
			If $Jig_Count = 1 Then
				GUICtrlSetData($Fish_Edit, "Jig number " & $Jig_Count & " performed." & @CRLF,1)		
				Sleep ($Sleep_Jig_1)
				ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
				Sleep ($Sleep_Each_Select)
				$Check_1 = PixelGetColor(426, 203, $sHWND)
				$Pixel_Error = 0
				While $On = True
					Sleep (100)
						$Pixel_Error = $Pixel_Error + 1
						If $Pixel_Error = $Error_Count_Defined Then
							GUICtrlSetData($Fish_Edit, "Cannot find window 3, fish got away, lost, obtained. or tired pixels. Please confirm again." & @CRLF,1)	
							$Pixel_Error = 0
							Exitloop	
						Endif	
					$Check_1 = PixelGetColor(426, 203, $sHWND)	
					$Check_6 = PixelGetColor(482, 26, $sHWND)
					$Check_7 = PixelGetColor(482, 143, $sHWND)
					If $Check_1 = $Jig_Box_3 then ExitLoop
					If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then ExitLoop						
				WEnd	
					If $Check_1 = $Jig_Box_3 Then
						$Jig_Count = $Jig_Count + 1
						Sleep ($Sleep_Each_Select)
						$Check_5 = PixelGetColor(180, 232, $sHWND)	
						If $Check_5 = $Fish_Tired Then $Jig_Count = $Jig_Count - 1						
						ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
					Endif
				If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then $Jig_Count = 0	
			Elseif $Jig_Count = 2 Then
				GUICtrlSetData($Fish_Edit, "Jig number " & $Jig_Count & " performed." & @CRLF,1)	
				Sleep ($Sleep_Jig_2) ;246 232
				ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
				Sleep ($Sleep_Each_Select)
				$Check_1 = PixelGetColor(426, 203, $sHWND)
				$Pixel_Error = 0
				While $On = True
					Sleep (100)
						$Pixel_Error = $Pixel_Error + 1
						If $Pixel_Error = $Error_Count_Defined Then
							GUICtrlSetData($Fish_Edit, "Cannot find window 3, fish got away, lost, obtained. or tired pixels. Please confirm again." & @CRLF,1)	
							$Pixel_Error = 0
							Exitloop	
						Endif	
					$Check_1 = PixelGetColor(426, 203, $sHWND)	
					$Check_6 = PixelGetColor(482, 26, $sHWND)
					$Check_7 = PixelGetColor(482, 143, $sHWND)
					If $Check_1 = $Jig_Box_3 then ExitLoop
					If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then ExitLoop						
				WEnd	
					If $Check_1 = $Jig_Box_3 Then
						$Jig_Count = $Jig_Count + 1
						Sleep ($Sleep_Each_Select)
						$Check_5 = PixelGetColor(180, 232, $sHWND)	
						If $Check_5 = $Fish_Tired Then $Jig_Count = $Jig_Count - 1						
						ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
					Endif
				If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then $Jig_Count = 0	
			Elseif $Jig_Count = 3 Then
				GUICtrlSetData($Fish_Edit, "Jig number " & $Jig_Count & " performed." & @CRLF,1)	
				Sleep ($Sleep_Jig_3)
				ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
				Sleep ($Sleep_Each_Select)
				$Check_1 = PixelGetColor(426, 203, $sHWND)
				$Pixel_Error = 0
				While $On = True
					Sleep (100)
						$Pixel_Error = $Pixel_Error + 1
						If $Pixel_Error = $Error_Count_Defined Then
							GUICtrlSetData($Fish_Edit, "Cannot find window 3, fish got away, lost, obtained. or tired pixels. Please confirm again." & @CRLF,1)	
							$Pixel_Error = 0
							Exitloop	
						Endif	
					$Check_1 = PixelGetColor(426, 203, $sHWND)	
					$Check_6 = PixelGetColor(482, 26, $sHWND)
					$Check_7 = PixelGetColor(482, 143, $sHWND)
					If $Check_1 = $Jig_Box_3 then ExitLoop
					If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then ExitLoop						
				WEnd	
					If $Check_1 = $Jig_Box_3 Then
						$Jig_Count = $Jig_Count + 1
						Sleep ($Sleep_Each_Select)
						$Check_5 = PixelGetColor(180, 232, $sHWND)	
						If $Check_5 = $Fish_Tired Then $Jig_Count = $Jig_Count - 1						
						ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
					Endif
				If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then $Jig_Count = 0		
			Elseif $Jig_Count = 4 Then
				GUICtrlSetData($Fish_Edit, "Jig number " & $Jig_Count & " performed." & @CRLF,1)	
				Sleep ($Sleep_Jig_4)
				ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
				Sleep ($Sleep_Each_Select)
				$Check_1 = PixelGetColor(426, 203, $sHWND)
				$Pixel_Error = 0
				While $On = True
					Sleep (100)
						$Pixel_Error = $Pixel_Error + 1
						If $Pixel_Error = $Error_Count_Defined Then
							GUICtrlSetData($Fish_Edit, "Cannot find window 3, fish got away, lost, obtained. or tired pixels. Please confirm again." & @CRLF,1)	
							$Pixel_Error = 0
							Exitloop	
						Endif	
					$Check_1 = PixelGetColor(426, 203, $sHWND)	
					$Check_6 = PixelGetColor(482, 26, $sHWND)
					$Check_7 = PixelGetColor(482, 143, $sHWND)
					If $Check_1 = $Jig_Box_3 then ExitLoop
					If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then ExitLoop						
				WEnd	
					If $Check_1 = $Jig_Box_3 Then
						$Jig_Count = $Jig_Count + 1
						Sleep ($Sleep_Each_Select)
						$Check_5 = PixelGetColor(180, 232, $sHWND)	
						If $Check_5 = $Fish_Tired Then $Jig_Count = $Jig_Count - 1						
						ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
					Endif
				If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then $Jig_Count = 0	
			Elseif $Jig_Count = 5 Then
				GUICtrlSetData($Fish_Edit, "Jig number " & $Jig_Count & " performed." & @CRLF,1)	
				Sleep ($Sleep_Jig_5)
				ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
				Sleep ($Sleep_Each_Select)
				$Check_1 = PixelGetColor(426, 203, $sHWND)
				$Pixel_Error = 0
				While $On = True
					Sleep (100)
						$Pixel_Error = $Pixel_Error + 1
						If $Pixel_Error = $Error_Count_Defined Then
							GUICtrlSetData($Fish_Edit, "Cannot find window 3, fish got away, lost, obtained. or tired pixels. Please confirm again." & @CRLF,1)	
							$Pixel_Error = 0
							Exitloop	
						Endif	
					$Check_1 = PixelGetColor(426, 203, $sHWND)	
					$Check_6 = PixelGetColor(482, 26, $sHWND)
					$Check_7 = PixelGetColor(482, 143, $sHWND)
					If $Check_1 = $Jig_Box_3 then ExitLoop
					If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then ExitLoop						
				WEnd	
					If $Check_1 = $Jig_Box_3 Then
						$Jig_Count = $Jig_Count + 1
						Sleep ($Sleep_Each_Select)
						$Check_5 = PixelGetColor(180, 232, $sHWND)	
						If $Check_5 = $Fish_Tired Then $Jig_Count = $Jig_Count - 1						
						ControlSend("[CLASS:RAPTURE]", "", "", "{Enter}")
					Endif
				If $Check_6 = $Depth_Top or $Check_7 = $Depth_Bottom Then $Jig_Count = 0					
			ElseIf $Check_2 = $Fish_GotAway Then 
				$Fish_Losts = $Fish_Losts + 1
				$Fish_Total = $Fish_Total + 1	
				GUICtrlSetData($Fish_Edit, "Fish got away." & @CRLF,1)
				GUICtrlSetData($Fish_Lost_Text, $Fish_Losts & " fish out of " & $Fish_Total & " lost.")				
				Sleep ($Sleep_Open_Window)
				ExitLoop		
			Elseif $Check_3 = $Fish_Lost Then 
				$Fish_Losts = $Fish_Losts + 1
				$Fish_Total = $Fish_Total + 1	
				GUICtrlSetData($Fish_Edit, "Fish was lost." & @CRLF,1)
				GUICtrlSetData($Fish_Lost_Text, $Fish_Losts & " fish out of " & $Fish_Total & " lost.")				
				Sleep ($Sleep_Open_Window)
				ExitLoop
			Elseif $Check_4 = $Fish_Obtain Then 
				$Fish_Caught = $Fish_Caught + 1
				$Fish_Total = $Fish_Total + 1
				GUICtrlSetData($Fish_Edit, "Fish caught!" & @CRLF,1)
				GUICtrlSetData($Fish_Caught_Text, $Fish_Caught & " fish out of " & $Fish_Total & " caught.")
				Sleep ($Sleep_Open_Window)
				ExitLoop
			Endif		
	Wend			
$Pixel_Error = 0			
$Jig_Count = 1	
Endfunc
Was turned into this.
Code:
Func Fishing_4()
Local $Sleep_Jig
$Pixel_Error = 0	
	While $On = True
		$Pixel_Error = $Pixel_Error + 1
		If $Pixel_Error = $Pixel_Error_Count Then
			GUICtrlSetImage($Error_Watcher, "Artwork/Error.ico", 22)
			SoundPlay ( "Sounds/Error_Sound.wav")
			$Error_Message = $Error_Message & @CRLF & "Loop time out @ Func Fishing_4()!"
			Call ("Stop_Bot")
		EndIf	
		$Sleep_Jig = IniRead ("Shadow 13ot.ini", "Timers", "Jig" & $Jig_Count, "")
		Sleep ($Sleep_Jig)
		ControlSend("[CLASS:RAPTURE]", "", $HWND, "{enter}")	
		Sleep ($Send_Key_Wait)
		ExitLoop
	Wend			
EndFunc
I would say that is quite an improvement ^^
13ouncer is offline  
Old 08/10/2011, 20:49   #15
 
elite*gold: 0
Join Date: Feb 2006
Posts: 629
Received Thanks: 195
Quote:
Originally Posted by 13ouncer View Post
I would say that is quite an improvement ^^
Definitely a big improvement, but it seems like a lot of code was missing: the first set of code you quoted appears to be from your first bot and the second set is the new bot; does it simply push the code elsewhere? The refactoring I did to your code does not leave any of the code required to recreate the originally quoted logic out-- it isn't moved to some other function or system, I included all of the code required to make that portion work; it is just coded flexibly (using parameters), so the same code does not need to be repeated.

Anytime you copy/paste code, stop yourself. It is a red flag that you should be making that existing function more accessible or more flexible. This is often referred to as "DRY" (Do Repeat Yourself): Don't repeat yourself - Wikipedia, the free encyclopedia

Your function is named Fishing_4, are there Fishing_1, Fishing_2, Fishing_3, etc? If so, that cries out for a function argument ($Location in my example).
lucid is offline  
Reply

Tags
address, ffxiv, memory, offsets, pointers


Similar Threads Similar Threads
anyone have 12 Sky 1 memory addresses?
08/25/2009 - General Gaming Discussion - 1 Replies
Has anyone tried memory scanning for 12 sky 1? I tried the method in the post on 12 sky 2, but to no avail. when i'd find 4-6 addresses... i'd try to change value and nothing happened... also i noticed that if watched the values and didn't mess with them.. .they'd cycle through different values fairly quickly. I'm sure this is probably a method to prevent hacking. I also buffed... scanned for all unknown initial value... then immediately scanned for unchanged values (buff still on) and got...
Memory addresses
03/18/2008 - Conquer Online 2 - 13 Replies
did a search but didnt come up with much.. anyone know how to find the new memory addresses?
Memory addresses...
03/29/2006 - Conquer Online 2 - 19 Replies
Well I'm gonna try for my first hack ever to do a simple fun client side editting one. It'll mainly be for fun nothing else. So far all I have is address for money I need address for dex, vitality, mana, and strength. If anyone knows any other numeric entrys please tell me. Once I figure out the number letter thing for server, name, guild, spouces name then I'll make an even more advanced one. Tonight I'm gonna try at getting dex and stuff but the easyest way is the way of using dragonballs to...
Memory addresses... for co2!!!
11/02/2005 - Conquer Online 2 - 2 Replies
Well so far I have the money and xp address again. I'm kinda poor on my server so no money to re-locate my points to "easyly" get the status points so if anyone with a bunch of time, or much better skilled then me could get me as many memory addresses as possible that'd be great :)



All times are GMT +2. The time now is 15:06.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.