PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: Cêñoßy†ê on 16 February, 2004, 22:04:04

Title: MultiAdvertBot
Post by: Cêñoßy†ê on 16 February, 2004, 22:04:04
Hope someone likes this... My first "job"  :P
------------------------------------------------------------------------------------------------------------
---// MultiAdvertBot v.0.3 Made by Cyberbob (made from bots that i found from http://board.univ-angers.fr)
---// This Bot send each XX minutes (that you can set) a Advert.
---// You can write yours advert's in txt file or use scripts own txt files like (rules/addmessage)
---// and the Bot send the Advert message .. Random..
-----------------------------------------------------------------------------------------------------------
BotName = "?Robocop?"                        ---// Set here Botname
HubOwner = ""                                ---// Set here Hub Owner name
HubAdr = ""                                  ---// Set here Hub Address
WebAd = "?Under Construction?"               ---// Set here Hub's Web Address
HubEm = "?Under Construction?"               ---// Set here Hub E-mail Address
HubR = "!rules"                              ---// Set here hub rules command
NetW = ""                                    ---// Set here hub network command or name of the network
Minute = 1                                   ---// Here you can set time in minutes
Command = "!uptime"                          ---// Set here command that shows hub current uptime
Adds = "2"                                   ---// Set here how many txt add's will be in use 1=only hubinfo
Add2 = "txt/rules.txt"                       ---// Set here first txt add directory like (txt/rules.txt)
Add3 = ""                                    ---// Set here second txt add directory like (txt/rules.txt)
Add4 = ""                                    ---// Set here third txt add directory like (txt/rules.txt)
Add5 = ""                                    ---// Set here fourth txt add directory like (txt/rules.txt)
-----------------------------------------------------------------------------------------------------------
ScriptVersion = "0.3"             ---// Script version (don't touch)
Timer = Minute*60000              ---// Time in minutes * milliseconds (don't touch)

function Main()
frmHub:RegBot(BotName)
SetTimer(Timer)
StartTimer()
end

function ReadLine()
while 1 do
local line = read()
if (line == nil) then
break
else
SendToAll(BotName, line)  
end
end
readfrom()
end

function Spot1()
SendToAll(BotName,"")
        SendToAll("")
   SendToAll("?==================?H?U?B??I?N?F?O?=================?")
   SendToAll("   ?Hub Name:   "..frmHub:GetHubName().."")
   SendToAll("   ?Hub Owner:   "..HubOwner.."")
        SendToAll("   ?Hub Address:   "..HubAdr.."")
        SendToAll("   ?Hub Rules:   "..HubR.."")
   SendToAll("   ?Hub E-Mail:   "..HubEm.."")
   SendToAll("   ?Web Address:   "..WebAd.."")
   SendToAll("   ?Network:   "..NetW.."")
   SendToAll("   ?Hub Uptime :   "..Command.."")
   SendToAll("   ?Usercount:   "..frmHub:GetUsersCount().." of  "..frmHub:GetMaxUsers().." Users Connected")   
   SendToAll("?====================================================?")
        SendToAll("")
        SendToAll("")
end
function Spot2()
readfrom(Add2)
ReadLine()
end

function Spot3()
readfrom(Add3)
ReadLine()
end

function Spot4()
readfrom(Add4)
ReadLine()
end
 
function Spot5()
readfrom(Add5)
ReadLine()
end

function MsgSpot()
local msgspot = random(Adds)
if (msgspot == 1) then
Spot1()
elseif (msgspot == 2) then
Spot2()
elseif (msgspot == 3) then
Spot3()
elseif (msgspot == 4) then
Spot4()
elseif (msgspot == 5) then
Spot5()
end
end

function OnTimer()
MsgSpot()
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1)
   _,_,cmd=strfind(data, "%b<>%s+(%S+)")
   if(cmd == Command) then
      local sec = clock()
      local days = floor(sec/86400)
      local hrs = floor((sec-(days*86400))/3600)
      local min = floor((sec-(days*86400)-(hrs*3600))/60)
      sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
      user:SendData(BotName, "***Hubs current uptime "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec.***")
      return 1
   end
end
Title:
Post by: TiMeTrAVelleR on 16 February, 2004, 22:34:42
Wel done  for youre first  script  m8

TiMe 8)
Title:
Post by: Andersk33 on 17 February, 2004, 20:06:11
Hi

I have tried your script and it works fine....
Well done and keep it up..... :)

A happy user......
Title:
Post by: DarkieTampie on 14 March, 2004, 15:19:46
hi, i tried the script, but when the advert is more then 1 line, the botname appears on every line. example:
<=4dd-T4Mp0n=>                      \/\/\/\/
<=4dd-T4Mp0n=>                      (  ?   ? )
<=4dd-T4Mp0n=>  ,--------------oOOo-(_)-oOOo------------,
<=4dd-T4Mp0n=>  I   ***D4rkTeMpl4r'S HuB***  I
<=4dd-T4Mp0n=>  '----------------------- Oohoo--------------'
<=4dd-T4Mp0n=>               ooooO   ((    ))
<=4dd-T4Mp0n=>               ((    ))     )   /
<=4dd-T4Mp0n=>                \   (      (_/
<=4dd-T4Mp0n=>                  \_)    

do you know what i mean? can you tell me how to fix that or fix it by urself?  :)

thnx advance,
DT
Title:
Post by: Alexei on 14 March, 2004, 15:51:02
i think all you need is to put \n\r att the end of each line...

i havent looked at all these scripts for a looong time... but i think its "\r\n" or "\n\r"

or was it just \n or \n
test and you will see :D

Good luck ;)
Title:
Post by: DarkieTampie on 14 March, 2004, 16:30:09
doesnt work... then i get \n\r in the txt.

anyways thnx for fast reply

DT
Title:
Post by: plop on 15 March, 2004, 00:00:18
it's "\r\n".
but this won't help you solving this problem, what you need 2 do is change the function ReadLine.
that sends every single line, change it so it sends the full file.
how ??, that can be found on the forum.

plop
Title:
Post by: DorianG on 15 March, 2004, 14:08:04
it resemble to a script that I had posted  :-)

My Old script (http://board.univ-angers.fr/thread.php?threadid=1272&boardid=12&styleid=1&sid=c0ca964f8b18ab721ef7790cad0d19b5)
Title:
Post by: DarkieTampie on 15 March, 2004, 16:58:07
okey thnx Plop ill try to find it  :] , btw nice time you posted 0.00  ;)

DT
Title: LiTTlE CoPy
Post by: Cp6uja on 22 July, 2004, 14:42:18
Cy?e??o? nice copy
This script is copy of RoBoCoP  :D
Buahahahahha !