Advertisement
namofure

DQ9_MapFloor.lua

Apr 23rd, 2024 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | Gaming | 0 0
  1. -- メモリから256バイトの値を取得
  2. function getValues(address)
  3.     local values = {}
  4.     for i = 0, 255 do
  5.         local value = memory.readbyte(address + i)
  6.         table.insert(values, value)
  7.     end
  8.     return values
  9. end
  10.  
  11. local Mapfloor_addr = 0x0230FB04 -- 地形アドレス
  12. local ImMapfloor_addr = 0x0230FA04 -- 偽地形アドレス
  13. local Mapfloors = getValues(Mapfloor_addr)
  14. local ImMapfloors = getValues(ImMapfloor_addr)
  15.  
  16. -- テキストファイルで出力
  17. function outputMapData(MapData, ImMapData)
  18.  
  19.     local file = io.open("MapFloor.txt", "w")
  20.     if file == nil then
  21.        error("File could not be opened.")
  22.     end
  23.  
  24.     for i = 1, 16 do
  25.         local MapDataRow = {}
  26.         for j = 1, 16 do
  27.             table.insert(MapDataRow, string.format("%02X", MapData[(i - 1) * 16 + j]))
  28.  
  29.         end
  30.         file:write(table.concat(MapDataRow, " ") .. "\n")
  31.     end
  32.  
  33.     file:write("\n")
  34.  
  35.     for k = 1, 16 do
  36.         local ImMapDataRow = {}
  37.         for l = 1, 16 do
  38.             table.insert(ImMapDataRow, string.format("%02X", ImMapData[(k - 1) * 16 + l]))
  39.         end
  40.         file:write(table.concat(ImMapDataRow, " ") .. "\n")
  41.     end
  42. end
  43. file:close()
  44. outputMapData(Mapfloors, ImMapfloors)
  45.  
Tags: DQ9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement