PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: BrokenBrick on 22 October, 2003, 00:42:12

Title: Timed Message
Post by: BrokenBrick on 22 October, 2003, 00:42:12
Heres another one, its a timed message script, and its uses are pretty self explanitory, it should work in IceCube and TD.  I did not write it but if you have trouble I will try to help :-p
_____________________________________

botname = "Reminder"
minutes = 360
file = "MsgAll.txt"

function Main()
SetTimer(minutes*60000)
StartTimer()
end

function OnTimer()
MessageToAll()
end

function MessageToAll()
local handle = openfile(file, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
SendToAll(botname,line)
line = read(handle)
end
closefile(handle)
end
end
Title:
Post by: liq?i?sw?rdz on 28 November, 2003, 15:24:51
DO I have to make a folder called "txt" and and put a file in it called MsgAll.txt to make this work?
Title:
Post by: kepp on 28 November, 2003, 15:29:26
in the script folder i suppose
Title:
Post by: pHaTTy on 29 November, 2003, 07:39:09
Hmm because its only using the timer once instead of jumping from timer to another function might as well be all in timer


bot = "Reminder"
mins = 360
file = "MsgAll.txt"

function Main()
SetTimer(mins*60000)
StartTimer()
end

function OnTimer()
local handle = openfile(file, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
SendToAll(bot,line)
line = read(handle)
end
closefile(handle)
end
end

Title:
Post by: angelsanges on 24 June, 2004, 14:59:09
how to modify this bot for sending message in PM instead of main?
Title:
Post by: blackwings on 24 June, 2004, 15:31:29
QuoteOriginally posted by angelsanges
how to modify this bot for sending message in PM instead of main?

Replace this line=
SendToAll(bot,line)

with this =
SendPmToAll(bot,line)
Title:
Post by: angelsanges on 24 June, 2004, 18:37:31
i have this error if i modify that line

Syntax error: cannot access a variable in outer scope;
  last token read: `handle' at line 16 in string "bot = "Offertissime"
..."