|
GG偏移判断和偏移修改的脚本教程和模板 提供:[size=1em]zhoubo5256
[size=1em]
没有人教很苦恼。
思路,找到了一个特征码,以及多个副特征码,综合判断后,以主特征码为基准,偏移到特定值进行修改。要改的装备和数量有点多,就琢磨着写个脚本。本人纯小白,花了两天时间终于搞定了。大佬勿喷。
(因为主特征码搜出来比较多,有无关数据,需要配合副特征码进行判断是否为所需要的值)
以内存JH,数据类型D,主特征码为12345 副特征码偏移16为20、偏移24为66、偏移40为789,需要修改主特征码偏移12、偏移20、偏移36的值为88、99、33为例,脚本如下:
function split(szFullString, szSeparator) local nFindStartIndex = 1 local nSplitIndex = 1 local nSplitArray = {} while true do local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex) if not nFindLastIndex then nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString)) break end nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1) nFindStartIndex = nFindLastIndex + string.len(szSeparator) nSplitIndex = nSplitIndex + 1 end return nSplitArray end function xgxc(szpy, qmxg) for x = 1, #(qmxg) do xgpy = szpy + qmxg[x]["offset"] xglx = qmxg[x]["type"] xgsz = qmxg[x]["value"] xgdj = qmxg[x]["freeze"] if xgdj == nil or xgdj == "" then gg.setValues({[1] = {address = xgpy, flags = xglx, value = xgsz}}) else gg.addListItems({[1] = {address = xgpy, flags = xglx, freeze = xgdj, value = xgsz}}) end xgsl = xgsl + 1 xgjg = true end end function xqmnb(qmnb) gg.clearResults() gg.setRanges(qmnb[1]["memory"]) gg.searchNumber(qmnb[3]["value"], qmnb[3]["type"]) if gg.getResultCount() == 0 then gg.toast(qmnb[2]["name"] .. "开启失败") else gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) if gg.getResultCount() == 0 then gg.toast(qmnb[2]["name"] .. "开启失败") else sl = gg.getResults(999999) sz = gg.getResultCount() xgsl = 0 if sz > 999999 then sz = 999999 end for i = 1, sz do pdsz = true for v = 4, #(qmnb) do if pdsz == true then pysz = {} pysz[1] = {} pysz[1].address = sl.address + qmnb[v]["offset"] pysz[1].flags = qmnb[v]["type"] szpy = gg.getValues(pysz) pdpd = qmnb[v]["lv"] .. ";" .. szpy[1].value szpd = split(pdpd, ";") tzszpd = szpd[1] pyszpd = szpd[2] if tzszpd == pyszpd then pdjg = true pdsz = true else pdjg = false pdsz = false end end end if pdjg == true then szpy = sl.address xgxc(szpy, qmxg) end end if xgjg == true then gg.toast(qmnb[2]["name"] .. "开启成功,共修改" .. xgsl .. "条数据") else gg.toast(qmnb[2]["name"] .. "开启失败") end end end end
--以上为核心调用
function Main()
SN = gg.multiChoice({
"多偏移修改",
"退出脚本"
}, nil, "随便写点什么")
if SN == nil then else
if SN[1] == true then a() end
if SN[2] == true then Exit() end
end XGCK = -1 end
--以上为菜单,可自定义增加或修改
function a()
qmnb = {
{["memory"] = 2},
--Jh=2;Ch=1;Ca=4;Cd=8;Cb=16;PS=262144;A=32;J=65536;S=64;As=524288;;=-1032320;B=131072;Xa=16384;Xs=32768;mr=262207
{["name"] = "xiugai"},
{["value"] = 12345, ["type"] = gg.TYPE_DWORD},
{["lv"] = 20, ["offset"] = 16, ["type"] = gg.TYPE_DWORD},
{["lv"] = 66, ["offset"] = 24, ["type"] = gg.TYPE_DWORD},
{["lv"] = 789, ["offset"] = 40, ["type"] = gg.TYPE_DWORD},
}
qmxg = {
{["value"] = 88, ["offset"] =12, ["type"] = gg.TYPE_DWORD},
{["value"] = 99, ["offset"] = 20, ["type"] = gg.TYPE_DWORD},
{["value"] = 33, ["offset"] = 36, ["type"] = gg.TYPE_DWORD},
}
xqmnb(qmnb)
end
--以上为偏移判断、偏移修改(可以加冻结:)
--以下为退出脚本
function Exit()
os.exit()
end
while true do
if gg.isVisible(true) then
XGCK = 1
gg.setVisible(false)
end
gg.clearResults()
if XGCK == 1 then
Main()
end
end
--以上为退出脚本
|
|