determinate determinate

Author Topic: Record Bot  (Read 9681 times)

0 Members and 2 Guests are viewing this topic.

Offline jiten

  • Scripter
  • Forum Legend
  • ******
  • Posts: 1 585
  • Karma: +71/-5
RecordBot 1.6 - LUA 5.0/5.1
« Reply #70 on: November 08, 2006, 02:38:20 pm »
As requested, I've updated this script to LUA 5.1. Please check in its Finished Scripts section.

IMPORTANT: I've changed the database structure in the version, so, you must delete your existing .tbl so that the script can work properly.

If needed, I'll post a converter.

Offline speedX

  • Lord
  • ***
  • Posts: 436
  • Karma: +57/-19
Re: Record Bot
« Reply #71 on: November 08, 2006, 02:44:09 pm »
If needed, I'll post a converter.
plzz, coz I cant delete my old one
Thanking You,

speedX

Offline jiten

  • Scripter
  • Forum Legend
  • ******
  • Posts: 1 585
  • Karma: +71/-5
RecordBot 1.5a - 1.6 DB Converter
« Reply #72 on: November 09, 2006, 09:57:34 am »
Here you go then:

Code: [Select]
--[[

RecordBot 1.5a to 1.6 DB Converter by jiten (11/8/2006)

Requested by: speedX

CHANGELOG:

1. Place your old tRecord.tbl under your scripts' folder;
2. Run this script and the new file "tRecord(new).tbl" will appear in the same folder;
3. Backup your old DB (just in case) and rename the new one to the default format: tRecord.tbl
4. And that's it!

]]--

-- File to convert
fConvert = "tRecord.tbl"
-- Output file
fConverted = "tRecord(new).tbl"

tConvert = {}

Main = function()
if loadfile(fConvert) then dofile(fConvert) end; tConvert = Record.tDB
local hFile = io.open(fConverted, "w+") Serialize(tConvert, "tRecord", hFile); hFile:close()
end

Serialize = function(tTable, sTableName, hFile, sTab)
sTab = sTab or "";
hFile:write(sTab..sTableName.." = {\n");
for key, value in pairs(tTable) do
if (type(value) ~= "function") then
local sKey = (type(key) == "string") and string.format("[%q]", key) or string.format("[%d]", key);
if(type(value) == "table") then
Serialize(value, sKey, hFile, sTab.."\t");
else
local sValue = (type(value) == "string") and string.format("%q", value) or tostring(value);
hFile:write(sTab.."\t"..sKey.." = "..sValue);
end
hFile:write(",\n");
end
end
hFile:write(sTab.."}");
end

 

determinate determinate