PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Loading on 02 July, 2005, 14:59:27

Title: Simple TXT viewer with more commands
Post by: Loading on 02 July, 2005, 14:59:27
hi ppl

i have this script :


-- Simple TXT / file viewer by TTB

-- Requested by Pingelmonster

-- Made: 06-05-05

----------------------------------



-- ## Settings ## --



bot = "[BOT]TXT-assistent" -- botname

path = "extratxt" -- path for your txt file(s)



File1= "hublists.txt" -- filename

cmd1 = "#hublists" -- command



regbot = "0" -- Reg your bot?

PM = "1" -- Send your message by PM or in MAIN chat? 1 = PM, 0 = Main Chat.



-- NOTE: If you choose to send by PM, your bot will be REGGED anyway (can't send PM without sender).



-- ## Don't change below! ## --



function Main()

if regbot == "1" or PM == "1" then

frmHub:RegBot(bot)

end

end



function ChatArrival(curUser,data)

data = string.sub(data,1,string.len(data)-1)

s,e,cmd = string.find(data,"%b<>%s+(%S+)")

if cmd and cmd == cmd1 then

local sdata = LoadFile(File1)

if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

end

end



function LoadFile(file)

local handle = io.open(path.."/"..file,"r")

if handle then

local sdata = ""

local line = ""

for line in handle:lines() do

sdata = sdata..line.."\r\n"

end

return sdata

else

sdata = "File / command not available!"

return sdata

end

handle:close()

end

i want is :

more commands like :


<>     ?       !capas
<>     ?       !codecs
<>     ?       !cracks
<>     ?       !games
<>     ?       !gajas
<>     ?       !Grizas
<>     ?       !legendas
<>     ?       !players
<>     ?       !dance

each command have a txt file in a especific directory , and the commands is avaiable to anyone

can  anyone make this modification ?



best regards


Loading
Title:
Post by: jiten on 02 July, 2005, 15:14:18
Give "Rotating Message" a try or if it doesn't suit your needs, search the forum. I'm sure you'll find lots to choose from ;)

Cheers
Title:
Post by: Dessamator on 02 July, 2005, 15:29:09
or use the text support in ptokax !
Title:
Post by: Loading on 03 July, 2005, 01:04:24
hi ppl

i searched in the forum and i can't find a script can suit my needs

and i don't like the text support from the ptokax


so can you help me with tis script ?



best regards


Loading
Title:
Post by: Loading on 03 July, 2005, 19:07:28
tnks mutor
but isn't i want

instead this :
bot = "[BOT]TXT-assistent" -- botname



path = "extratxt" -- path for your txt file(s)







File1= "hublists.txt" -- filename



cmd1 = "#hublists" -- command

i want this:
bot = "[BOT]TXT-assistent" -- botname



path = "extratxt" -- path for your txt file(s)







File1= "codecs.txt" -- filename



cmd1 = "!codecs" -- command



File2= "cracks.txt" -- filename



cmd2 = "!cracks" -- command



File3 = "legendas.txt"        --filename



cmd3 = "!legendas"          --command



file4 = "players.txt"           --filename



cmd4 = "!players"            --command

you understand now ?

but with all this commands :
 !capas
 !codecs
 !cracks
 !games
 !gajas
 !Grizas
 !legendas
 !dance
 !players
 !hublists

can you help me ?


best regards


Loading
Title:
Post by: Markitos on 03 July, 2005, 19:21:12
well...othrwise u can use Release/request bot or entry bot by jiten.
U can add new things in new categorys were can be displayed in Pm by users and ofcourse with a rotating message were u can choose the hour and categ. to be displayed in the main (timed)
Title:
Post by: Loading on 03 July, 2005, 20:03:31
hi

but this script is more easy to configure

but tanks for the help  ;)

best regards


loading
Title:
Post by: Markitos on 03 July, 2005, 20:28:27
QuoteOriginally posted by Loading
hi

but this script is more easy to configure

but tanks for the help  ;)

best regards


loading

Try this (its in lua 4 try convert it too tired)
Bot = "Bot?"

gamerstxt = "gamers.txt" -- O ficheiro gamers.txt tem de estar criado na pasta script  


function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
   data=strsub(data,1,strlen(data)-1)
   s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      if (cmd=="!gamers") then
      ReadJokes(user, data)
        return 1
      end
   end
end

function ReadJokes(user, data)
local tmp = ""
   readfrom(gamerstxt)
   while 1 do
   local line = read()
      if (line == nil) then
         break
      else
    tmp = tmp..line.."\r\n"
      end
   end
   readfrom()
user:SendPM(Bot, tmp)
end


Cheers...
Title:
Post by: Loading on 03 July, 2005, 23:30:42
ok

i changed myself and it works  :)

-- Simple TXT / file viewer by TTB

-- Requested by Pingelmonster

-- Made: 06-05-05

-- More commands added by [PT]Loading  03/07/05

----------------------------------



-- ## Settings ## --



bot = "?FBI??" -- botname

path = "URLs" -- path for your txt file(s)



File1= "hublists.txt" -- filename

cmd1 = "+listas" -- command

File2= "Codecs.txt" -- filename

cmd2 = "+codecs" -- command

File3= "legendas.txt" -- filename

cmd3 = "+legendas" -- command

File4= "Players.txt" -- filename

cmd4 = "+players" -- command

File5= "jogos.txt" -- filename

cmd5 = "+jogos"        -- command

File6= "cracks.txt" -- filename

cmd6 = "+cracks" -- command

File7= "capas.txt" -- filename

cmd7 = "+capas"        -- command

File8= "grizas.txt" -- filename

cmd8 = "+grizas" -- command

File9= "ptokax.txt" -- filename

cmd9 = "+ptokax" -- command

File10= "musica.txt" -- filename

cmd10 = "+musica"        -- command

cmd11 = "+showhelp"        -- command



regbot = "1" -- Reg your bot?

PM = "1" -- Send your message by PM or in MAIN chat? 1 = PM, 0 = Main Chat.



-- NOTE: If you choose to send by PM, your bot will be REGGED anyway (can't send PM without sender).



-- ## Don't change below! ## --



function Main()

if regbot == "1" or PM == "1" then

frmHub:RegBot(bot)

end

end



function ChatArrival(curUser,data)

data = string.sub(data,1,string.len(data)-1)

s,e,cmd = string.find(data,"%b<>%s+(%S+)")

   if cmd == "+listas" then

local sdata = LoadFile(File1)

if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

            elseif cmd == "+codecs" then

            local sdata = LoadFile(File2)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

            elseif cmd == "+legendas" then

            local sdata = LoadFile(File3)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

            elseif cmd == "+players" then

            local sdata = LoadFile(File4)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

            elseif cmd == "+jogos" then

            local sdata = LoadFile(File5)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

            elseif cmd == "+cracks" then

            local sdata = LoadFile(File6)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

            elseif cmd == "+capas" then

            local sdata = LoadFile(File7)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

            elseif cmd == "+grizas" then

            local sdata = LoadFile(File8)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

            elseif cmd == "+ptokax" then

            local sdata = LoadFile(File9)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1

elseif cmd == "+showhelp" then
local sdata = "Lista de comandos disponiveis\r\n\r\n"..
"\t-=======<>Comandos disponiveis<>=======-\r\n"..
" +listas\t\t\t-\t\tMostra a lista de hubs nacionais e internacionais\r\n"..
" +codecs\t\t-\t\tMostra a lista de url's para sacar os codecs mais precisos\r\n"..
" +legendas\t\t-\t\tMostra a lista de url's para sacar legendas\r\n"..
" +players\t\t\t-\t\tMostra a lista de url's para sacar os melhores players\r\n"..
" +jogos\t\t-\t\tMostra a lista de url's de Jogos\r\n"..
" +cracks\t\t-\t\tMostra a lista de url's para sacar os mais variados cracks\r\n"..
" +capas\t\t-\t\tMostra a lista de url's para sacar capas para jogos/filmes\r\n"..
" +grizas\t\t-\t\tMostra a lista de url's para grizas\r\n"..
" +ptokax\t\t-\t\tMostra a lista de url's para ir buscar os melhores scripts para este fabuloso programa de Hubs\r\n"..
" +musica\t\t-\t\tMostra a lista de url's de dance music\r\n"..
" +showhelp\t\t-\t\Mostra este menu de ajuda\r\n"

              if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

                else

                        curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

                end
           
                return 1


            elseif cmd == "+musica" then

            local sdata = LoadFile(File10)

            if PM == "1" then

curUser:SendPM(bot,"\r\n"..sdata)

else

curUser:SendData(bot,"\r\n\r\n"..sdata.."\r\n")

end

return 1



end

end


function LoadFile(file)

local handle = io.open(path.."/"..file,"r")

if handle then

local sdata = ""

local line = ""

for line in handle:lines() do

sdata = sdata..line.."\r\n"

end

return sdata

else

sdata = "File / command not available!"

return sdata

end

handle:close()

end

best regards

Loading
Title:
Post by: Loading on 04 July, 2005, 03:15:26
hi mutor

this script take me 4 hours to modify

and hi have proud to see it works perfectly

i don't like the ptokax because is to  confusion
 i like scripts to make the "job"

best regards

Loading
Title:
Post by: Markitos on 04 July, 2005, 09:38:41
QuoteOriginally posted by Loading
hi mutor

this script take me 4 hours to modify

and hi have proud to see it works perfectly

i don't like the ptokax because is to  confusion
 i like scripts to make the "job"

best regards

Loading

Lol loading but PX jt want to make ur life easy adding that text support ;)
BTW u spent 4 h moding a script that could be made in an easier way
Title:
Post by: Dessamator on 04 July, 2005, 10:14:56
yap and the script is messy, full of repition, and does the exact same thing that plop's script, or ptokax text support does !