Ir para conteúdo

Thunderlaw

Campones
  • Total de itens

    7
  • Registro em

  • Última visita

Histórico de Reputação

  1. Upvote
    Thunderlaw recebeu reputação de Alexclusive em Abertura Oficial Avatar Legends   
    Já joguei e realmente recomendo a todos que estão presentes aqui, com relação ao cliente acredito que realmente seja problema em vossos computadores, pois mesmo em Windows XP & Windows 8 consegui logar no servidor utilizando o Launcher...
     
    Att,
    Thunderlaw
  2. Upvote
    Thunderlaw deu reputação a Demonbholder em Getspellname(Words)   
    Faaaaala galera! Tranquilo? Mas uma função feita à pedidos, que eu pude fazer hoje a tarde e vou apresentá-los a ela.
     
    Como funciona: O parâmetro usado deve ser as palavras necessárias para ativar a spell. O script vai retornar o nome da spell referente aquelas palavras. Se não existir, simplesmente irá dar erro.
     
     
    Função
     

    function getSpellName(spellwords) local info = io.open("data/spells/spells.xml", "r") local spell = info:read("*all") local line = nil local d = nil local finish = nil local start = nil for s, st in pairs(lines(spell)) do if string.find(st, spellwords) and string.sub(st, string.find(st, spellwords) + #spellwords, string.find(st, spellwords) + #spellwords) == '"' and string.find(st, "words", string.find(st, spellwords) + #spellwords) == nil then line = lines(spell)[s] break end end if line == nil then return error("Spell not found") end for i = 1, #line do if string.sub(line, i, i +3) == "name" then d = 1 end if string.sub(line, i, i) == '"' then if d == 1 then start = i + 1 d = 2 elseif d == 2 then finish = i - 1 d = 3 end end end return string.sub(line, start, finish) end function lines(str) local t = {} local j = {} local c = nil for i = 1, #str do if i == 1 then table.insert(t, 1) elseif string.byte(string.sub(str, i, i)) == 10 then table.insert(t, i) end end for i = 1, #t do c = t[i+1] and t[i+1] -1 table.insert(j, string.sub(str, t[i], c)) end return j end
     
     
    Exemplo:
     

    getSpellName("exevo mas san") retorna Divine Caldera
     
     
    Então é isso galera, acho que não há nenhum bug. Eu precisei usar uma outra função que eu criei, portanto, não retirem ela.
     
    Aproveitem, e até a próxima.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...