PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Sammy P on 04 January, 2005, 21:26:31

Title: Automatic Banner Bot
Post by: Sammy P on 04 January, 2005, 21:26:31
right, as ull probably notice i CANT write lua very well.

What im after is summin that will paste the following message into main chat every 20minutes, without someone typin !banner or whatever the command was
   
          -------------------------(?`?._.?[URBAN FM]?._.???)-------------------------
           
        ????`????LoCk On To ThE OfFiCiAL URBAN FM RaDiO????`????
           
         .???`?-> http://www.urbantingz.com/listen.rm    <-???`?.ReAl AmP
         .???`?-> http://www.urbantingz.com/listen.m3u <-???`?.WiN AmP
         .???`?-> http://www.urbantingz.com/listen.asx  <-???`?.WiN MeDiA
   
   www.uRBANTINGz.com/forum <-- Make sure ur regged. PASS THIS ON
           
       ????`????LoCk On To ThE OfFiCiAL URBAN FM RaDiO????`????


Cheers

Sammy P
Title:
Post by: Anna on 05 January, 2005, 00:00:15
there's a script called timedmess that can do that for you (at least close to)

So far I havent managed to alter it enough to get it so not show timestamps... originaly it sent bot name on everi line as well, but that was a fairly easy edit.... if you search on the board I'm sure you can find it, if not send me a pm or some and I'll send it over to you (havent got a place to host it so cant get you a dl link)
Title:
Post by: bastya_elvtars on 05 January, 2005, 00:04:43
already solved, he only opened the topic twice ;)

btw timestamps are clientside - users have to disable it manuallly.
Title:
Post by: Anna on 05 January, 2005, 13:42:31
if you for instance look at robocops hub add, there arent timestamps for each row.... neither is it if I send a banner through !banner command..

and also if I type a message in main  thats more then 1 row i dont get a timestamp on each row... this message I have in timedmess shows timestamp for everyrow in the actual message.. it would be nice if the timestamp only was shown at the first row as it is when typing in the message...
Title:
Post by: bastya_elvtars on 05 January, 2005, 13:49:22
my script does that...
Title:
Post by: Anna on 06 January, 2005, 20:03:37
:) ok
where can I get a hold of your script then?
Title:
Post by: [UK]Madman on 06 January, 2005, 20:31:21
When adding the message to the timer script, rather than....

SendToAll (bot, "message line 1")
SendToAll (bot, "message line 2")
SendToAll (bot, "message line 3")

try

mess = ""
mess = mess.."\r\n\t\n"
mess = mess.."message line 1"
mess = mess.."message line 2"
mess = mess.."message line 3"
SendToAll (bot,..mess)

can use \r\n to add a new line too :o)
Title:
Post by: Anna on 06 January, 2005, 22:41:24
the script I have uses a separate file for the actual message... So I guess it would require a bit more of a change to get it working without showing timestamp for each line
Title:
Post by: bastya_elvtars on 06 January, 2005, 23:25:43
QuoteOriginally posted by Anna
the script I have uses a separate file for the actual message... So I guess it would require a bit more of a change to get it working without showing timestamp for each line

post it here. i will see what i can do.
Title:
Post by: Anna on 07 January, 2005, 00:22:26
OK here it comes, the txt file is just plain text as it is now and the script kind of ignore blank lines as well

CODE
-------------------------------------------------------------------

botname = "?????_ThaSwing_?????"
minutes = 60
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)
SendToAll(botname,line)
line = read(handle)
while line do
SendToAll(line)
line = read(handle)
end
closefile(handle)
end
end

-----------------------------------------------------
END

hope ya can do some :D
Title:
Post by: bastya_elvtars on 07 January, 2005, 02:45:59
sure...

-- by dunno who
-- remade by bastya_elvtars

botname = "??^(o)??_ThaSwing_??^(o)??"
minutes = 60
file = "MsgAll.txt"

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

function OnTimer()
MessageToAll()
end

function MessageToAll()
local msg=""
readfrom(file)
while 1 do
local line=read()
if not line then
readfrom()
break
end
msg=msg.."\r\n"..line
end
readfrom()
SendToAll(botname,msg)
end
Title:
Post by: Anna on 07 January, 2005, 03:04:35
thanx for the help, but somewhere something dont work right, I got this when the message should be sent

Syntax error: bad argument #1 to `readfrom' (string expected, got nil)
stack traceback:
   1:  function `readfrom' [C]
   2:  function `MessageToAll' at line 19 [file `...:\Program\hubbar\PlayWerx\scripts\timedmess.lua']
   3:  function `OnTimer' at line 14 [file `...:\Program\hubbar\PlayWerx\scripts\timedmess.lua']
Title:
Post by: bastya_elvtars on 07 January, 2005, 03:06:06
sry. edited above.
Title:
Post by: Anna on 07 January, 2005, 03:11:48
:D works fine now, except it dont tell who sends it... but thats not importent really
Title:
Post by: bastya_elvtars on 07 January, 2005, 03:14:09
check now.

btw gnite :)
Title:
Post by: Anna on 07 January, 2005, 03:17:54
:) just perfect

night and thanx for the help
Title:
Post by: Anna on 24 August, 2005, 00:26:08
ok, i am putting an old thread up to live again.. did a search, but didnt find this script working in lua5... maybe I just missed it..
in any case if it already exists please point me in the right direction, if not please help me update it, found a use for it once again
Title:
Post by: bastya_elvtars on 24 August, 2005, 00:48:12
-- by dunno who
-- remade by bastya_elvtars
-- lua5 version by bastya_elvtars


botname = "??^(o)??_ThaSwing_??^(o)??"
minutes = 60
file = "MsgAll.txt"

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

function OnTimer()
  MessageToAll()
end

function MessageToAll()
  local msg=""
  local f=io.open(file)
  if f then
    for line in f:lines() do
      msg=msg.."\r\n"..line
    end
    f:close()
  end
  SendToAll(botname,msg)
end
Title:
Post by: Anna on 24 August, 2005, 14:31:18
thanx :D preciate it