• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Scripts to Mods Transformer

Jano

oturhaN
Joined
Feb 21, 2008
Messages
876
Solutions
1
Reaction score
68
Location
Chile
Lua:
local inputFolder = "data/talkactions/scripts/"

local outputFolder = "mods/"

local myFile = "data/talkactions/talkactions.xml"

local function NahrutoFTW()
    local files, words, names = {}, {}, {}
    if io.open(myFile, "r") then
        for line in io.lines(myFile) do
            if (line:find('script') and not (line:find("<!--"))) then
                f = line:match('value=".*".*')
                file = f:sub(f:find('="') + 2, f:find('.lua') - 1)
                table.insert(files, file)
                
                w = line:match('words=".*".*')
                word = w:sub(w:find('="') + 2,w:find('" ') - 1)
                table.insert(words, word)
                
                n = line:match('words=".*".*')
                n_ = n:find('/') == 8 and 3 or 2
                name = n:sub(n:find('="') + n_, n:find('" ') - 1)
                table.insert(names, name)
            end
        end
    end
    return {files = files, words = words, names = names}
end

function onSay(cid, words, param, channel)
    local transform = NahrutoFTW()
    for k, file in ipairs(transform.files) do
        local _if, _end, endCount, text = 0, 0, 0, ""
        local file = inputFolder .. file .. ".lua"
        local open = io.open(file, "r")
        if open then
            for i in io.lines(file) do
                if (i:find("if")) then _if = _if + 1 end
                if (i:find("end")) then _end = _end + 1 end
            end
            for i in io.lines(file) do
            
                if (i:find("end")) then endCount = endCount + 1 end
                
                if not (i:find("function onSay")) and endCount < _end then
                    text = text .. "\n" .. i
                end
                
            end
            open:close()
        end
        local open = io.open(outputFolder .. transform.names[k] .. ".xml", "w")
        if open then
            open:write('<?xml version="1.0" encoding="UTF-8"?>\n<mod name="' .. transform.names[k] .. '" version="1.0" author="Nahruto\'s Scripts to Mods transformer" contact="in my house" enabled="yes">\n<talkaction words="' .. transform.words[k] .. '" event="buffer"><![CDATA[' .. text .. '\n]]></talkaction>\n</mod>')
            open:close()
        end
    end
    return true
end

yeah bitchas, this will transform your current scripts (talkactions for test) to mods mode, is not bug free, i dont know how to add access shit in mods so someone tellme and i will add it, tell me the bugs to make it perfect.
 
I don't like it too.
Elf 1 : 2 We!

@Nahruto:
Don't tell me bitch.
 
yes mods a lot better, as that old war system i done, can be done in one file easier to organize it, fix it, update it.

mods is da life
 
Make new command in talkactions.xml, some thing like !mods.
Then say "mods ..<Your lua file.lua>..".
 
how to use ?
create a new talk, what ever you want can be !mods / mods as you wish

and


local inputFolder = "data/talkactions/scripts/"

local outputFolder = "mods/"

local myFile = "data/talkactions/talkactions.xml"




inputFolder --> the folder where your talk scripts are placed

outputFolder --> where the scripts will be saved

myFile --> your talkactions.xml file

default values should be alright
 
Nice, but I don't like mods either...

I'm not saying they're bad, but I see them more like to release scripts here and that, so people can install them faster.
 
I got this error

[12/08/2009 02:53:10] Lua Script Error: [TalkAction Interface]
[12/08/2009 02:53:10] data/talkactions/scripts/mods.lua:eek:nSay

[12/08/2009 02:53:10] data/talkactions/scripts/mods.lua:13: attempt to index global 'f' (a nil value)
[12/08/2009 02:53:10] stack traceback:
[12/08/2009 02:53:10] data/talkactions/scripts/mods.lua:13: in function 'NahrutoFTW'
[12/08/2009 02:53:10] data/talkactions/scripts/mods.lua:31: in function <data/talkactions/scripts/mods.lua:30>

How i fix?
 
Hm. For me (Crying Damson 0.3.5pl1) it transformed lua scripts to mods perfectly.. Now I'll test these mods :>.

Reload mods:
Code:
[12/08/2009 14:33:19] >> Reloading mods...
[12/08/2009 14:33:19] Loading !deathlist.xml... done.
[12/08/2009 14:33:19] Loading !frags.xml... done.
[12/08/2009 14:33:19] Loading !hunt.xml... done.
[12/08/2009 14:33:19] Loading !online.xml... done.
[12/08/2009 14:33:19] Loading !pos.xml... done.
[12/08/2009 14:33:19] Loading !pvp.xml... done.
[12/08/2009 14:33:19] Loading !q.xml... done.
[12/08/2009 14:33:19] Loading !serverinfo.xml... done.
[12/08/2009 14:33:19] Loading !uptime.xml... done.
[12/08/2009 14:33:19] Loading a.xml... done.
[12/08/2009 14:33:19] Loading alana som.xml... done.
[12/08/2009 14:33:19] Loading b.xml... done.
[12/08/2009 14:33:19] Loading bc.xml... done.
[12/08/2009 14:33:19] Loading buypremium_command.xml... done.
[12/08/2009 14:33:19] Loading c.xml... done.
[12/08/2009 14:33:19] Loading changender_command.xml... done.
[12/08/2009 14:33:19] Loading clean.xml... done.
[12/08/2009 14:33:19] Loading cliport.xml... done.
[12/08/2009 14:33:19] Loading closeserver.xml... done.
[12/08/2009 14:33:19] Loading commands.xml... done.
[12/08/2009 14:33:19] Loading config.xml... done.
[12/08/2009 14:33:19] Loading custommonsters.xml... done.
[12/08/2009 14:33:19] Loading customspells.xml... done.
[12/08/2009 14:33:19] Loading deathlist.xml... done.
[12/08/2009 14:33:19] Loading down.xml... done.
[12/08/2009 14:33:19] Loading firstitems.xml... done.
[12/08/2009 14:33:19] Loading gethouse.xml... done.
[12/08/2009 14:33:19] Loading goto.xml... done.
[12/08/2009 14:33:19] Loading highscorebook.xml... done.
[12/08/2009 14:33:20] Loading i.xml... done.
[12/08/2009 14:33:20] Loading info.xml... done.
[12/08/2009 14:33:20] Loading kick.xml... done.
[12/08/2009 14:33:20] Loading m.xml... done.
[12/08/2009 14:33:20] Loading mc.xml... done.
[12/08/2009 14:33:20] Loading mkick.xml... done.
[12/08/2009 14:33:20] Loading mode.xml... done.
[12/08/2009 14:33:20] Loading mods.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/mods.xml
[12/08/2009 14:33:20] Line: 55, Info: Extra content at the end of the document


[12/08/2009 14:33:20]  failed!
[12/08/2009 14:33:20] Loading n.xml... done.
[12/08/2009 14:33:20] Loading newtype.xml... done.
[12/08/2009 14:33:20] Loading notations.xml... done.
[12/08/2009 14:33:20] Loading online.xml... done.
[12/08/2009 14:33:20] Loading openserver.xml... done.
[12/08/2009 14:33:20] Loading owner.xml... done.
[12/08/2009 14:33:20] Loading pos.xml... done.
[12/08/2009 14:33:20] Loading pvp.xml... done.
[12/08/2009 14:33:20] Loading r.xml... done.
[12/08/2009 14:33:20] Loading raid.xml... done.
[12/08/2009 14:33:20] Loading reload.xml... done.
[12/08/2009 14:33:20] Loading reports.xml... done.
[12/08/2009 14:33:20] Loading s.xml... done.
[12/08/2009 14:33:20] Loading save.xml... done.
[12/08/2009 14:33:20] Loading send.xml... done.
[12/08/2009 14:33:20] Loading serverinfo.xml... done.
[12/08/2009 14:33:20] Loading shutdown.xml... done.
[12/08/2009 14:33:20] Loading squelch.xml... done.
[12/08/2009 14:33:20] Loading storage.xml... done.
[12/08/2009 14:33:20] Loading t.xml... done.
[12/08/2009 14:33:20] Loading town.xml... done.
[12/08/2009 14:33:20] Loading unban.xml... done.
[12/08/2009 14:33:20] Loading up.xml... done.
[12/08/2009 14:33:20] Loading uptime.xml... done.
[12/08/2009 14:33:20] Loading valentines_cards.xml... done.
[12/08/2009 14:33:20] Loading wp.xml... done.
[12/08/2009 14:33:20] Loading x.xml... done.
[12/08/2009 14:33:20] Loading y.xml... done.
[12/08/2009 14:33:20] Loading z.xml... done.
[12/08/2009 14:33:20] > 66 mods were loaded.
[12/08/2009 14:33:20] Reloaded mods.
So it works perfectly :). Because only mod 'mods transformer' failed xD. But it going to delete from mods. Rep+ to Nahruto. Great Thing.
 
Last edited:
fail, i cant get it to work ;D
How do you use the script ingame? !mods <scriptname?> (for example)
and the script is to advanced for me to understand o.o
 
Last edited:
Back
Top