一个用SearchValidAddr搜索基址的例子(search方法)全程干货

随心笔谈12个月前发布 admin
97 0

#SetArgsOnCompile

#诛仙基址搜索工具脚本。此脚本用于帮助一些使用不了官方发布的基址的朋友。

#使用方法:

#首先在参数中填入自己角色的HP和MP值,需要的话适合修改搜索范围。然后在诛仙游戏中启动脚本。

#当输出”搜索到可能的基址”字样时,记下输出的基址,在诛仙打怪脚本中设置参数”基地址”。

#如果输出多个基址,那么退出游戏多搜索几次,找一个不变的地址使用。

#如果没有输出,调整范围再搜索,但是不要一次搜索的范围太大,速度会很慢。

dim myHP, myMP

function LogPrint(msg)

Print(msg)

WriteLog(“搜索结果.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<>myHP then

exit function

end if

if not ReadMemoryEx(addAllBlood, 2, AllBlood, 1) then

exit function

end if

if AllBlood<>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(“当前血值”)

myMP=GetConfigNumber(“当前MP值”)

startAddr=CNum(GetConfigString(“搜索起始地址”))

endAddr=CNum(GetConfigString(“搜索结束地址”))

Print(“起始地址:&H”& HexStr(startAddr))

Print(“结束地址:&H”& HexStr(endAddr))

Print(“搜索HP值:”&myHP)

Print(“搜索MP值:”&myMP)

LogPrint(“开始搜索…..”)

for addr=startAddr to endAddr step 4

if TryAddr(addr) then

LogPrint(“搜索到可能的基址: &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(“已完成 %”&(prg*10))

progress[prg+1]=true

end if

next

end function

© 版权声明

相关文章