9999 "Dump Commands List" Auto Assembler Script [ENABLE] {$lua} if syntaxcheck then return end local commands = readPointer("cmdList") if not commands or commands == 0 then print("please load a saved game first") assert(false,"can't activate yet") return end local size = readInteger(commands + 0x2C) if size <= 0 then print("please load a saved game first") assert(false,"can't activate yet") return elseif size > 3000 then size = 3000 -- just in case end commands = readPointer(commands + 0x20) if not commands or commands == 0 then print("please load a saved game first") assert(false,"can't activate yet") return end local paramtypes = { "int", nil, "float", "strVar", "strObj", "strChar", "strItem" } local COMMAND_LIST = "Index;Command Name\n" --local COMMAND_LIST2 = "Index;Table Address;Cmd Address;Name;# of Arguments\n" for i = 1, size do local addr = readPointer(commands) if addr and addr ~= 0 then local name = readPointer(addr + 0x08) if name and name ~= 0 then name = readString(name, 256, false) if type(name) == "string" then local self = readPointer(addr + 0x40) local faddr = readPointer(addr + 0x48) local numParam = readInteger(addr + 0x18) local argtable = readPointer(addr + 0x10) local cmdargs = "" for j = 1, numParam do local argcur = (j - 1) * 0x10 + argtable local argname = readPointer(argcur) local argtype = readInteger(argcur + 0x08) local isResult = readInteger(argcur + 0x0C) argtype = paramtypes[argtype] or "type"..tostring(argtype) if isResult ~= 1 then cmdargs = cmdargs.."-> " end cmdargs = cmdargs..argtype.." "..readString(argname, 256, false) if j ~= numParam then cmdargs = cmdargs..", " end end COMMAND_LIST = COMMAND_LIST..string.format("%d;%s ( %s )\n", i, name, cmdargs) -- COMMAND_LIST2 = COMMAND_LIST2..string.format("%d;%X;%X;%s;%d\n", i, commands, addr, name, numParam) end end end commands = commands + 0x08 end --print(COMMAND_LIST) local file = io.output('bg3_commandslist.csv') io.write(COMMAND_LIST) io.close(file) {$asm} [DISABLE]