dirView = false fstatusView = false color0 = "#ffffff" color1 = "#404040" color2 = "#808080" color3 = "#ff0000" sq = 16 sqColor = "#ffff0040" local DIRECT = {"RD","LD","RU","LU"} preX = {} preY = {} preCheck = {} fbCheck = false for i = 0, 16 - 1 do addi = i * 0x10 preX[i] = memory.readbyte(0x7E1B0C + addi) preY[i] = memory.readbyte(0x7E1B0E + addi) preCheck[i] = true end prebt = 0 premr = 0 while true do battletime = memory.readword(0x7EFEF0) -- 戦闘中かどうかのフラグがわからないので無理やり battleflag = prebt ~= battletime and (battletime ~= 0 or prebt - battletime == 1) battlerand = memory.readdword(0x7E0338) if battlerand == 0 then brc = color1 else if battleflag then brc = color0 else brc = color2 end end gui.text(16, 210, "BR: " .. string.upper(string.format("%08x", battlerand)),brc) maprand = memory.readword(0x7E000C) if maprand == 0 then mrc = color1 else if battleflag then mrc = color2 else mrc = color0 end end gui.text(72, 210, "MR: " .. string.upper(string.format("%04x", maprand)),mrc) if battletime == 0 or battlerand ~= 0 then btc = color1 else btc = color0 end gui.text(112, 210, "BT: " .. string.upper(string.format("%04x", battletime)),btc) if battleflag then fbCheck = true actPoint = memory.readword(0x7E03AE) gui.text(16, 200, "AP: " .. actPoint) for i = 0, 4 - 1 do addi = i * 0x40 charid1 = memory.readbyte(0x7E1C00 + addi) charid2 = math.floor(memory.readbyte(0x7E1C01 + addi) / 0x40) if charid1 ~= 0xFF and charid2 ~= 0x00 and charid2 ~= 0x10 then posX = memory.readbyte(0x7E1C10 + addi) posY = memory.readbyte(0x7E1C12 + addi) cstatus = "" if fstatusView then clv = memory.readbyte(0x7E1C38 + addi) cstr = memory.readbyte(0x7E1C34 + addi) cspd = memory.readbyte(0x7E1C35 + addi) cvit = memory.readbyte(0x7E1C36 + addi) cint = memory.readbyte(0x7E1C37 + addi) cstatus = clv.." ".."\n"..cstr.." "..cspd.."\n"..cvit.." "..cint.."\n" end ctime = memory.readbyte(0x7E1C06 + addi) if ctime > 0 and memory.readbyte(0x7E1C07 + addi) ~= 0x0C then cstatus = cstatus .. ctime end stbit = memory.readbyte(0x7E1C39 + addi) for j = 0, 8 - 1 do if stbit % 2 > 0 then cstatus = cstatus .. "\nst" .. (j + 1) .. ":" .. memory.readbyte(0x7EEA00 + addi + j) end stbit = math.floor(stbit / 2) end p7 = memory.readbyte(0x7EEA00 + addi) gui.text(posX, posY, cstatus) end end jpmax = 0 jpid = 0 for i = 0, 16 - 1 do addi = i * 0x10 enemid = memory.readbyte(0x7E1B00 + addi) enemex = math.floor(memory.readbyte(0x7E1B01 + addi) / 0x40) if enemex == 0x02 then break end if enemex ~= 0x00 and enemid ~= 0x69 then for j = 0, 4 - 1 do if memory.readbyte(0x7E1A00 + j * 0x40) == enemid then etype = memory.readbyte(0x7E1A2F + j * 0x40) break end end if etype ~= 0x04 then ejp = memory.readword(0x7EAC04 + addi) if ejp >= jpmax then jpmax = ejp jpid = i end end end end for i = 0, 16 - 1 do addi = i * 0x10 enemid = memory.readbyte(0x7E1B00 + addi) enemex = math.floor(memory.readbyte(0x7E1B01 + addi) / 0x40) if enemex == 0x02 then break end if enemex ~= 0x00 then eysize = 0 for j = 0, 4 - 1 do if memory.readbyte(0x7E1A00 + j * 0x40) == enemid then eysize = memory.readbyte(0x7E1A05 + j * 0x40) break end end -- 戦闘開始時の敵の位置が前の先頭のが使われてしまう対処がやや強引 posX = memory.readbyte(0x7E1B0C + addi) posY = memory.readbyte(0x7E1B0E + addi) if preCheck[i] then if posX == 0 or posY == 0 or (posX == preX[i] and posY == preY[i]) then posX = memory.readbyte(0x7E1B0A + addi) * 32 + 16 posY = memory.readbyte(0x7E1B0B + addi) * 24 + 40 else preCheck[i] = false end end elv = memory.readbyte(0x7EAB00 + addi) ehp = memory.readword(0x7EAA00 + addi) eac = memory.readbyte(0x7EAC06 + addi) estatus = elv .. " " .. ehp .. "\n" .. eac eaa = memory.readbyte(0x7EAA02 + addi) if eaa > 0 then estatus = estatus .. " " .. string.upper(string.format("%x",eaa)) end ectime = memory.readbyte(0x7E1B06 + addi) if ectime > 0 and memory.readbyte(0x7E1B05 + addi) == 0x40 then estatus = estatus .. " " .. ectime end if dirView then dir = DIRECT[(memory.readbyte(0x7E1B04+ addi) / 0x40) + 1] estatus = estatus .. " " .. dir end if fstatusView or eysize > 1 then estr = memory.readbyte(0x7EAA03 + addi) espd = memory.readbyte(0x7EAA04 + addi) evit = memory.readbyte(0x7EAA05 + addi) eint = memory.readbyte(0x7EAA06 + addi) estatus = estatus .. "\n" .. estr.." "..espd.."\n"..evit.." "..eint end stbit = memory.readbyte(0x7EAA07 + addi) for j = 0, 8 - 1 do if stbit % 2 > 0 then estatus = estatus .. "\nst" .. (j + 1) .. ":" .. memory.readbyte(0x7EAA08 + addi + j) end stbit = math.floor(stbit / 2) end if i == jpid then eColor = color0 else eColor = color2 end gui.text(posX + 1, posY, estatus, eColor) end end else if fbCheck then fbCheck = false for i = 0, 16 - 1 do addi = i * 0x10 preX[i] = memory.readbyte(0x7E1B0C + addi) preY[i] = memory.readbyte(0x7E1B0E + addi) preCheck[i] = true end end -- ヘッドプラッカーを見たければ原始限定を外す if premr ~= maprand then encCheck = false hen = memory.readbyte(0x7E0A00) if hen == 1 then -- タイトルで表示されちゃっているので強引に修正(穴の中と同じマップっぽい? 座標が岩の上っぽい?) if memory.readbyte(0x7E0A02) ~= 0x18 or memory.readbyte(0x7E0A21) ~= 0x14 or memory.readbyte(0x7E0A29) ~= 0x17 then max = memory.readbyte(0x7E0A03) for i = 0, max do addi = i * 0x11 if memory.readbyte(0x7E1339+i*17) % 8 == 0 then -- ここを書き換えると見えるように -- memory.writebyte(0x7E1339 + addi, memory.readbyte(0x7E1339 + addi) + 2) if memory.readbyte(0x7E132E + addi) >= 128 then tx = (memory.readword(0x7E1332 + addi) - memory.readword(0x7E0028)) / 16 - 16 ty = (memory.readword(0x7E1334 + addi) - memory.readword(0x7E002A)) / 16 - 16 if tx < 0 then tx = tx + 4096 end if ty < 0 then ty = ty + 4096 end gui.box(tx, ty, tx + 16, ty + 16, sqColor, 0) --gui.text(tx + 3, ty - 3, i + 1) end end end end elseif hen == 0 or hen == 8 then encCheck = true eSum = memory.readbyte(0x7E01BB) eplus = memory.readbyte(0x7E0107) gui.text(16, 200, "ENC: ") if eSum < 32 then ecc = color2 elseif eSum + eplus * 4 >= 160 then ecc = color3 else ecc = color0 end gui.text(36, 200, eSum, ecc) gui.text(48, 200, " +" ..eplus) end if hen == 1 or hen == 2 or hen == 4 or hen == 7 or hen == 8 then mtime = memory.readword(0x7E0AE0) if mtime > 0 and (hen ~= 1 or mtime < 1201) then mtx = 16 if encCheck then mtx = 64 end gui.text(mtx, 200, mtime) end end end end premr = maprand prebt = battletime snes9x.frameadvance() end