PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: TTB on 06 May, 2005, 02:19:19

Title: Simple TXT viewer by command
Post by: TTB on 06 May, 2005, 02:19:19
Hi, was a request from someone, maybe ppl wanna use it to...

-- 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

Don't forget to make the TXT files in the path.
Title:
Post by: badtrip on 10 May, 2005, 23:20:53
The new ptokax 16.xx and 17.xx have txt viewer
 ;)
Title:
Post by: plop on 15 May, 2005, 16:29:06
QuoteOriginally posted by badtrip
The new ptokax 16.xx and 17.xx have txt viewer
 ;)
it was introduced earlier, but by doing it with scripts you can add more features.
like locking a txt file 2 some profiles only, like my texter serie's.

plop
Title:
Post by: dima_b on 16 May, 2005, 08:02:16
QuoteZitat:
--------------------------------------------------------------------------------
Originally posted by badtrip
The new ptokax 16.xx and 17.xx have txt viewer
;)

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


it was introduced earlier, but by doing it with scripts you can add more features.
like locking a txt file 2 some profiles only, like my texter serie's.

plop


great!  but how to use it?  i mean the ptokax one
Title:
Post by: uffetjur on 16 May, 2005, 09:29:07
Place those textfiles you want to have in ptokax/texts folder
ex ptokax.txt


be sure to enable support fort textfiles in hubsoft

To read this specific file use !ptokax    to wiew the file from clientside