PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Woodster on 11 February, 2004, 00:06:20

Title: Good Welcome Bot
Post by: Woodster on 11 February, 2004, 00:06:20
Anyone know of / or got a good Welcome bot in which i can get it to pm connecing users with .txt files such as rules and legal disclaimer etc....

Woodster
Title:
Post by: nErBoS on 11 February, 2004, 01:39:38
Hi,

Hope it helps...

--Requested by Woodster
--Made by nErBoS

Bot = "Welcome-Bot"

welcome = "welcome.txt" --in script folder
rules = "rules.txt"
disclaimer = "dsc.txt"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
Readtextfile(user, welcome)
Readtextfile(user, rules)
Readtextfile(user, disclaimer)
end

function Readtextfile(user, file)
    local filecontents = ""
local handle = openfile(file, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
        filecontents = filecontents..line.."\r\n"
line = read(handle)
end
closefile(handle)
      user:SendPM(Bot, filecontents)
end
end

Best regards, nErBoS
Title:
Post by: JaQues^T on 02 March, 2004, 13:26:06
thx v, i couldnt find it : /
but could u modify it to read text files from folder in script folder ?

like

/script_folder/welcome_pm.lua
/script_folder/any_folder/welcome.txt

i need it to work with my other scripts, and i couldnt change it : /



?UPS: reply should be here
http://board.univ-angers.fr/thread.php?threadid=1466&boardid=11&styleid=1&sid=33f405c6b5af40adb97e245a4c112a54

 :P
Title:
Post by: nErBoS on 02 March, 2004, 14:28:33
Hi,

Take a good look at the script and see the modification, you have to cerate the folder in side the script folder...

--Requested by Woodster
--Made by nErBoS

Bot = "Welcome-Bot"

welcome = "text/welcome.txt" --in script folder
rules = "text/rules.txt"
disclaimer = "text/dsc.txt"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
Readtextfile(user, welcome)
Readtextfile(user, rules)
Readtextfile(user, disclaimer)
end

function Readtextfile(user, file)
    local filecontents = ""
local handle = openfile(file, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
        filecontents = filecontents..line.."\r\n"
line = read(handle)
end
closefile(handle)
      user:SendPM(Bot, filecontents)
end
end

Best regards, nErBoS
Title: hmm
Post by: Peura on 09 March, 2004, 21:44:33
not working.... bot does not send pm to user.

--Requested by Woodster
--Made by nErBoS

Bot = "+welcome"

rules = "rules.txt"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
   Readtextfile(user, rules)
end

function Readtextfile(user, file)
      local filecontents = ""
   local handle = openfile(file, "r")
   if (handle ~= nil) then
      local line = read(handle)
      while line do
           filecontents = filecontents..line.."\r\n"
      line = read(handle)
      end
      closefile(handle)
         user:SendPM(Bot, filecontents)
   end
end
Title:
Post by: nErBoS on 09 March, 2004, 23:19:08
Hi,

You had change a end in the code, but the reason that you weren?t receving the text was because you were entering in the Hub as a OP and the script only send the text to the Users, but where is it...

--Requested by Woodster
--Made by nErBoS

Bot = "Welcome-Bot"

rules = "rules.txt"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
Readtextfile(user, rules)
end

OpConnected = NewUserConnected

function Readtextfile(user, file)
    local filecontents = ""
local handle = openfile(file, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
        filecontents = filecontents..line.."\r\n"
line = read(handle)
end
closefile(handle)
      user:SendPM(Bot, filecontents)
end
end

Best regards, nErBoS
Title:
Post by: Pieltre on 10 March, 2004, 22:22:43
Hi,

thanks for the script.  I've got something like this, but imbedded in Robocop.  Also, I'd like to have the same welcome message, but only for my OPs.   Can that be done?

regards,
Pielte
Title:
Post by: nErBoS on 10 March, 2004, 23:17:41
Hi,

Hope it helps..

--Requested by Woodster
--Made by nErBoS

Bot = "Welcome-Bot"

rules = "rules.txt"
wlcop = "opwelcome.txt"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
Readtextfile(user, rules)
end

function OpConnected(user, data)
Readtextfile(user, wlcop)
end

function Readtextfile(user, file)
    local filecontents = ""
local handle = openfile(file, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
        filecontents = filecontents..line.."\r\n"
line = read(handle)
end
closefile(handle)
      user:SendPM(Bot, filecontents)
end
end

Best regards, nErBoS
Title:
Post by: Pieltre on 10 March, 2004, 23:44:53
thanks,

works like a charm ...

pieltre
Title:
Post by: pHaTTy on 11 March, 2004, 01:35:24
QuoteOriginally posted by nErBoS
Hi,

Hope it helps..

--Requested by Woodster
--Made by nErBoS

Bot = "Welcome-Bot"

rules = "rules.txt"
wlcop = "opwelcome.txt"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
Readtextfile(user, rules)
end

function OpConnected(user, data)
Readtextfile(user, wlcop)
end

function Readtextfile(user, file)
    local filecontents = ""
local handle = openfile(file, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
        filecontents = filecontents..line.."\r\n"
line = read(handle)
end
closefile(handle)
      user:SendPM(Bot, filecontents)
end
end

Best regards, nErBoS

only prob is that its being read from txt fle eahc conect, need to save hdd life, i will show u one of my older scripts, uses memory instead

--//PhIlEs v1.0 by Phatty

Bot = "Phile"
Dir = "files/file.txt"

File = ""

function Main()
FileLoad()
end

function FileLoad()
readfrom(Dir)
while 1 do
local line = read()
if line == nil then
break
else
File = File.."\r\n"..line
end
end
readfrom()
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<") then
s,e,cmd = strfind(data, "%b<>(%S+)")

if cmd == "!file" then
user:SendData(Bot, File)
end
end
end

try make it similar to that, good practice for ya nErBoS ;)
Title:
Post by: nErBoS on 11 March, 2004, 04:32:41
Hi,

Sometihng like this..

Bot = "Welcome"

rules = "rules.txt"
wlcop = "opwelcome.txt"

ow = ""
rl = ""

function Main()
Readtextfile(rules, rl)
Readtextfile(wlcop, ow)
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
user:SendPM(Bot, rl)
end

function OpConnected(user, data)
user:SendPM(Bot, ow)
end


function Readtextfile(file, type)
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
type = type..line.."\r\n"
end
end
readfrom()
end

But not working, why ???

Best regards, nErBoS
Title:
Post by: pHaTTy on 11 March, 2004, 05:52:39
QuoteOriginally posted by nErBoS
Hi,

Sometihng like this..

Bot = "Welcome"

rules = "rules.txt"
wlcop = "opwelcome.txt"

ow = ""
rl = ""

function Main()
Readtextfile(rules, rl)
Readtextfile(opwlc, ow)
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
user:SendPM(Bot, rl)
end

function OpConnected(user, data)
user:SendPM(Bot, ow)
end


function Readtextfile(file, type)
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
type = type..line.."\r\n"
end
end
readfrom()
end

But not working, why ???

Best regards, nErBoS

Readtextfile(opwlc, ow)?
Title:
Post by: nErBoS on 11 March, 2004, 15:29:13
Hi,

Sorry my bad have edited, but still not working.

Best regards, nErBoS
Title:
Post by: nErBoS on 12 March, 2004, 17:05:08
Hi,

This will do the trick i think...

Bot = "Welcome"

rules = "rules.txt"
wlcop = "opwelcome.txt"

ow = ""
rl = ""

function Main()
Readtextfile(rules, rl)
Readtextfile(wlcop, ow)
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
if (rl == "") then
Readtextfile(rules, rl)
user:SendPM(Bot, rl)
else
user:SendPM(Bot, rl)
end
end

function OpConnected(user, data)
if (ow == "") then
Readtextfile(wlcop, ow)
user:SendPM(Bot, ow)
else
user:SendPM(Bot, ow)
end
end


function Readtextfile(file, type)
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
type = type..line.."\r\n"
end
end
readfrom()
end

Best regards, nErBoS
Title:
Post by: Pieltre on 16 March, 2004, 20:25:20
Hi,

concerning the script mentioned earlier, I tried getting the message to be displayed in the main chat instead of in a PM, but for some reason, I can't get it to work.  Perhaps it's because the message goes only to my OPs... anyhow, here's the script I was refering to. How should I modify it to achieve what I want:

Bot = "Bot"

rules = "rules.txt"
wlcop = "opwelcome.txt"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
   Readtextfile(user, rules)
end

function OpConnected(user, data)
   Readtextfile(user, wlcop)
end

function Readtextfile(user, file)
      local filecontents = ""
   local handle = openfile(file, "r")
   if (handle ~= nil) then
      local line = read(handle)
      while line do
           filecontents = filecontents..line.."\r\n"
      line = read(handle)
      end
      closefile(handle)
         user:SendPM(Bot, filecontents)
   end
end


cheers,
Pieltre
Title:
Post by: ??????Hawk?????? on 16 March, 2004, 21:02:58
Hi there   try this


replace this line:-
user:SendPM(Bot, filecontents)
With this :-

user:SendData(filecontents)
Title:
Post by: Pieltre on 16 March, 2004, 21:15:08
thanks. works fine. :)
Title:
Post by: ??????Hawk?????? on 16 March, 2004, 21:24:15
Your Welcome m8  :))
Title: I cant get it to message new users
Post by: jsjen on 23 March, 2004, 11:23:04
I use this

Bot = "welcomebot"

rules = "rulesbot.txt"
wlcop = "opwelcome.txt"

ow = ""
rl = ""

function Main()
   Readtextfile(rules, rl)
   Readtextfile(wlcop, ow)
   frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
   if (rl == "") then
      Readtextfile(rules, rl)
      user:SendPM(Bot, rl)
   else
      user:SendPM(Bot, rl)
   end
end

function OpConnected(user, data)
   if (ow == "") then
      Readtextfile(wlcop, ow)
      user:SendPM(Bot, ow)
   else
      user:SendPM(Bot, ow)
   end
end


function Readtextfile(file, type)
   readfrom(file)
   while 1 do
   local line = read()
      if (line == nil) then
         break
      else
         type = type..line.."\r\n"
      end
   end
   readfrom()
end


and it wont send a private message to users, I want the private message to pop up in another window.

The op welcome does it but the new user pops up in the mainchat window
Title:
Post by: Marecki on 05 May, 2004, 01:22:14
it what do it was it been possible was to make message on PM to howl? because I see the same empty PM so far :/
Title:
Post by: Corayzon on 05 May, 2004, 05:37:03
hey guys...thought i might aswell leave a link up here

Intro-Outro-Welcome System (ftp://cslave.no-ip.org/ptokax_administrations_scripts/other/intro-outro.rar)

Editable Settings
-- Editable
sBot = "-In-Out-System"
bHideBot = yes

-- Set the following profilenames and levels according to ur hub
profiles["Master"] = 1
profiles["Operator"] = 3
profiles["VIP"] = 5
profiles["none"] = 7

-- Set the profile tags to send messages from
protag["Master"] = "Hub Ruler"
protag["Operator"] = "Hub OP"
protag["VIP"] = "ViP"
protag["none"] = sBot

-- Intro-Outro Settings
enableinoutmsgs = yes
enablewelcomemsg = yes
randomintro = yes
randomoutro = yes
introprofilelevel = 6
outroprofilelevel = 6

-- Welcome Message
welcomemsg[1] = "#new#new#tabC u r r e n t   U s e r   I n f o r m a t i o n#new#new"
welcomemsg[2] = "#tab#tabUserName:#tab#user#new"
welcomemsg[3] = "#tab#tabIP Address:#tab#ip#new"
welcomemsg[4] = "#tab#tabProfile:#tab#tab#profile#new"
welcomemsg[5] = "#tab#tabClient Type:#tab#client v#version#new"
welcomemsg[6] = "#tab#tabShare Size:#tab#share#new"
welcomemsg[7] = "#tab#tabOpen Slots:#tab#slots#new"
welcomemsg[8] = "#tab#tabMode:#tab#tab#mode#new"
welcomemsg[9] = "#tab#tabConnection:#tab#speed#new#new"
opconnectmsg = "#user has just connected"
opdisconnectmsg = "#user has just disconected"
connectmsg = "#user has just connected"
disconnectmsg = "#user has just disconnected"

intros[1] = "#user Comes in crawling On Their Hands And Knees."
intros[2] = "#user Enters With A Corayzie Look In Their Eyes"
intros[3] = "Sir #user Of My Lucid Dreams Has Arrived."
intros[4] = "#user Runs In Raving On Like A Maniac."
intros[5] = "#user Has Been Droped Off By Aliens."
intros[6] = "#user Appears Out Of Nowhere And Begins Speaking In Tongues."
intros[7] = "#user Arrives And Immediately Heads For The Light Like A Moth."
intros[8] = "#user Climbs In Through The Window And Trips Over The Desk."
intros[9] = "#user Enters the Room Via The Chimney."
intros[10] = "After Alot Of Loud Groaning #user Comes Waltzing Out Of Janines Room..."
intros[11] = "#user Has Arrived On The Scene Looking More Corayzie Than Usual."
intros[12] = "#user Walks In With What Looks To Be A Mighty Fine Spliff."
intros[13] = "#user Arrives With A Keg Under Each Arm"
intros[14] = "#user Appears Out Of Thin Air."
intros[15] = "#user Parachutes In From An Airplane."
intros[16] = "#user Runs In, Stubs Their Toe On A Couch And Falls Over A Table Landing On A Dog Which Then Bites His Attacker."

outros[1] = "#user Has Left The Hub"
outros[2] = "#user Has Gone On A Search For Aliens"
outros[3] = "#user Has Been Found And Abducted By Aliens"
outros[4] = "#user Begins Shrinking, And Eventually Disappears From The Hub."
outros[5] = "#user Leaps Out The Window With Cat Like Reflexes."
outros[6] = "The Lights Momentarily Dim, And When They Come Back On #user Is Gone."
outros[7] = "Three Giant Men In White Coats March In And Haul Away #user Kicking and Screaming."
outros[8] = "#user Leaves Through The Basement Door"
outros[9] = "Suddenly #user Leaps Up And Bolts For The Door."
outros[10] = "#user Runs Around The Room Screaming And Then Leaps Out The Window."