An example of using SEARCHVALIDADDR to search for a base address _seraphzone

Source: Internet
Author: User
Tags chr sin
Copy Code code as follows:

#SetArgsOnCompile

#诛仙基址搜索工具脚本. This script is designed to help friends who cannot use the official base address.
#使用方法:
#首先在参数中填入自己角色的HP和MP值, it is appropriate to modify the search scope if necessary. Then start the script in the game of sin.
#当输出 "Search to the possible base address", write down the base address of the output and set the parameter "base address" in the script of blaming sin.
#如果输出多个基址, then quit the game more search several times, find a constant address to use.
#如果没有输出, adjust the range to search again, but do not search the range too large, the speed will be very slow.

Dim myhp, Mymp

function Logprint (msg)
Print (msg)
Writelog ("Search results. txt", msg)
End Function

function hexstr (num)
Str= ""
While Num>0
N=num MoD 16
If N<10 Then
STR=CHR (N+ASC ("0")) &str
Else
STR=CHR (N-10+ASC ("A")) &str
End If
Num=num\16
Wend
Hexstr=str
End Function

function tryaddr (ByRef addfirst)
Tryaddr=false

If not searchvalidaddr (AddFirst, &h0000000, Addresult) Then
Exit function
End If

Addfirst=addresult

If not Readmemoryex (AddFirst, 2, Number1, 1) Then
Exit function
End If

Addsecond=number1+40
If not Readmemoryex (Addsecond, 2, Number3, 1) Then
Exit function
End If

addnowblood=number3+596
Addallblood=addnowblood+&h18
Addnowmp=addnowblood+&h4
Addallmp=addnowblood+&h1c

If not Readmemoryex (Addnowblood, 2, Nowblood, 1) Then
Exit function
End If
If NOWBLOOD&LT;&GT;MYHP Then
Exit function
End If

If not Readmemoryex (Addallblood, 2, Allblood, 1) Then
Exit function
End If
If ALLBLOOD&LT;&GT;MYHP Then
Exit function
End If

If not Readmemoryex (ADDNOWMP, 2, NOWMP, 1) Then
Exit function
End If
If Nowmp<>mymp Then
Exit function
End If

If not Readmemoryex (ADDALLMP, 2, ALLMP, 1) Then
Exit function
End If
If Allmp<>mymp Then
Exit function
End If

Tryaddr=true
End Function

Function Main
Dim progress[11]
For I=1 to 11
Progress[i]=false
Next
Myhp=getconfignumber ("Current blood value")
Mymp=getconfignumber ("Current MP value")
Startaddr=cnum (getconfigstring ("Search start Address")
Endaddr=cnum (getconfigstring ("Search End Address"))
Print ("Start Address: &h" & Hexstr (STARTADDR))
Print ("End Address: &h" & Hexstr (ENDADDR))
Print ("Search hp Value:" &AMP;MYHP)
Print ("Search MP Value:" &AMP;MYMP)
Logprint ("Start search ...")
For ADDR=STARTADDR to ENDADDR step 4
If Tryaddr (addr) Then
Logprint ("Search to a possible base address: &h" & Hexstr (addr))
End If
Prg=int ((ADDR-STARTADDR)/(ENDADDR-STARTADDR) *10)
If Prg>10 Then
prg=10
End If
If not progress[prg+1] Then
Print (% completed & (PRG*10))
Progress[prg+1]=true
End If
Next
End Function

The code above is a copy of the code that is used to search the base address. Let me explain the principle.
The address of the blood is [[[[Base]+40]+596]
is to read the base address +40, read the data +596, and then read the data is the location of the blood
The principle of our search base is that we know the formula, but the base address is changed. We try it from a broad range, as a base address, until we find the blood value that matches the parameter settings by using this formula.
SEARCHVALIDADDR is to search from within the specified address, until an address is found, his value is greater than the value we specify (in this case 0), and then return to this address. So we're going to ask, why can't we just write a loop and read it Readmemoryex? The answer is to use this function 1000 times times faster.
After finding that address, we read it with Readmemoryex, of course, it is possible to read the failure, to judge. If you read it, follow that formula, read the level three address, and then try to read the data. Read all the way down until you read the successful data and match the values you specified. So let's just say this could be the base address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.