Hi,
I'm searching for a script wich send a random information. This information will be in a txt file.
For example I have 20 text lines in a txt file, and the script sends one random line per min (or hour, or other timer...).
Is someone has this kind of script.
-- Timer bot by piglja - 25/04/03 | Nooblike mod by GoldMember - 30/04/03
-- Editable (start)
botname = "Info"
minutes = 25
file1 = "timer/adress.txt"
file2 = "timer/any.txt"
file3 = "timer/50GB.txt"
-- Editable (end)
countmin = "2"
function Main()
SetTimer(minutes*60000)
StartTimer()
end
function OnTimer()
MessageToAll()
end
function MessageToAll()
if countmin=="0" then
local handle = openfile(file1, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
SendToAll(botname,line)
line = read(handle)
end
closefile(handle)
countmin = "1"
end
elseif countmin=="1" then
local handle = openfile(file2, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
SendToAll(botname,line)
line = read(handle)
end
closefile(handle)
countmin = "2"
end
elseif countmin=="2" then
local handle = openfile(file3, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
SendToAll(botname,line)
line = read(handle)
end
end
closefile(handle)
countmin = "0"
end
end
enjoy it.....
Thanks.... that's what I search!!
Will this script use much of resources, if i want to set it as Tip of the day?
good one :]
can this be done so it opens different text documents in a folder rather than just one line in 1 text document.
folder name: anouncements (which will have say 10 text.doc inside it)
ie. it shows text in
text1.doc 1st hour
text2.doc 2nd hours
etc,etc
QuoteOriginally posted by [[SU]]Special-Ops
can this be done so it opens different text documents in a folder rather than just one line in 1 text document.
folder name: anouncements (which will have say 10 text.doc inside it)
ie. it shows text in
text1.doc 1st hour
text2.doc 2nd hours
etc,etc
hmm i dont quite understand, can you explain a little what you mean?
ok let me explain more clearly.
what i want is a folder to go in my scripts folder with as many text documents as i wish. ie an folder named something like "announcments"
these text documents will each contain a different message.
i would like the script to send a message from a text document of my choice using a command.
example command:
!sendtext1
!sendtext2
and so on.
this way i can have as many messages pop up in main chat at my command.
ie
text1.doc = rules
text2.doc = hub ad
text3.doc = ask users to register
text4.doc = hub website advert
u with me now????
oh and by the way
HAPPY NEW YEAR to all of you..
happy year year dude and
-- Jason 0.5, by Phatty
-- Jason 0.1 wrote on 5th October 2k3
-- You can add ur own files
-- For example make a file named help.txt in the docs folder and then type in main !show help
-- ATM you cant make files with spaces like....Friday the 13th.txt <<< this will not work, but will add soon :)
-- Don't forget to make a folder named docs inside script folder
-- Added no such file error
-- Added who-to now, !show = example !show pmme test
-- There is pmme, me, or all
-- Added !lock
-- Added !version
-- Added self prefix
-- Fixed 1 line read only
Bot = "J???"
Version = "0.5"
mcmd="#"
Blacklist={}
function Main()
frmHub:RegBot(Bot)
end
function WhileRead(user,data)
while 1 do
line = read("*a")
if line == nil then
user:SendData(Bot,"I know of no such file")
break end
if to == "me" then
user:SendData(Bot,line)
elseif to == "all" then
SendToAll(Bot,line)
elseif to == "pmme" then
user:SendPM(Bot,line)
end
readfrom()
return 1
end
end
function LockOut(user)
if arg == "on" then
user:SendData(Bot,"You have blacklisted: "..to)
Blacklist[to]=1
buser = GetItemByName(to)
buser:SendPM(Bot,"You have been blacklisted")
return 1
elseif arg == "off" then
user:SendData(Bot,"You have removed "..to.." from the blacklist")
Blacklist[to]=nil
buser = GetItemByName(to)
buser:SendPM(Bot,"You have been removed from the blacklist")
return 1
end
end
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd,to,arg = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)")
if cmd == mcmd.."show" then
if Blacklist[user.sName]==nil then
readfrom("docs/"..arg..".txt")
WhileRead(user,data)
return 1
else
user:SendData(Bot,"I am denying you access to this command")
return 1
end
elseif cmd == mcmd.."lock" then
if user.bOperator then
LockOut(user)
return 1
end
end
end
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == mcmd.."version" then
user:SendData(Bot,"I am Jason "..Version..", by Phatty")
return 1
end
end
;)
-- Jason 0.6, by Phatty
-- Jason 0.1 wrote on 5th October 2k3
-- You can add ur own files
-- For example make a file named help.txt in the docs folder and then type in main !show help
-- ATM you cant make files with spaces like....Friday the 13th.txt <<< this will not work, but will add soon :)
-- Don't forget to make a folder named docs inside script folder
-- Added no such file error
-- Added who-to now, !show = example !show pmme test
-- There is pmme, me, or all
-- Added !lock
-- Added !version
-- Added self prefix
-- Fixed 1 line read only
-- Few little changed and tweaks
Bot = "J???"
Version = "0.6"
mcmd="#"
Blacklist={}
function Main()
frmHub:RegBot(Bot)
end
function WhileRead(user,data)
while 1 do
line = read("*a")
if line == nil then
user:SendData(Bot,"I know of no such file")
break
end
if to == "me" then
user:SendData(Bot,line)
elseif to == "all" then
SendToAll(Bot,line)
elseif to == "pmme" then
user:SendPM(Bot,line)
end
readfrom()
return 1
end
end
function LockOut(user)
if arg == "on" then
user:SendData(Bot,"You have blacklisted: "..to)
Blacklist[to]=1
buser = GetItemByName(to)
buser:SendPM(Bot,"You have been blacklisted")
return 1
elseif arg == "off" then
user:SendData(Bot,"You have removed "..to.." from the blacklist")
Blacklist[to]=nil
buser = GetItemByName(to)
buser:SendPM(Bot,"You have been removed from the blacklist")
return 1
end
end
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd,to,arg = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)")
if cmd == mcmd.."show" then
if Blacklist[user.sName]==nil then
readfrom("docs/"..arg..".txt")
WhileRead(user,data)
return 1
else
user:SendData(Bot,"I am denying you access to this command")
return 1
end
elseif cmd == mcmd.."lock" and user.bOperator then
LockOut(user)
return 1
elseif cmd == mcmd.."version" then
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
user:SendData(Bot,"I am Jason "..Version..", by Phatty")
return 1
end
end
end
I have place a folder called docs in my script folder, and added my rules.doc , i added the script, i tried the commands !show all rules, but with no results. I am using robocop 5a if that is any cause for it not to work..
or it maybe im dong something wrong.
:( :( :( :( :(
QuoteOriginally posted by [[SU]]Special-Ops
I have place a folder called docs in my script folder, and added my rules.doc , i added the script, i tried the commands !show all rules, but with no results. I am using robocop 5a if that is any cause for it not to work..
or it maybe im dong something wrong.
:( :( :( :( :(
you need plain txt files not word documents.
plop
QuoteOriginally posted by plop
you need plain txt files not word documents.