PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Herodes on 08 May, 2004, 02:44:00

Title: Popup fix in FAQBOT
Post by: Herodes on 08 May, 2004, 02:44:00
What follows is something I am cooking for a FAQ bot ..
I need it to display txts in PM in certain cases ...
When a User connects to send an informative txt in PM , and do the same when invoked by a cmd...

Now,... what I can't get to work is the Popup part ...
and also I wish there was a way to make one unique function to get along with the files ...

This one should need a Switch Off/Switch On function ....
 ... the thing is whatever I 've tried to do, these two had no luck :(

-- --- GRFaq ---- Script -----
--  Various Scripts Rewrite for GreekWorldHub
--..  By Herodes...
-- thanks to NerBoS for the work in
-- -- Requested by Woodster
-- -- Made by nErBoS
-- -- Bot = "Welcome-Bot"
-- and Nightlitch for DarkMinds Script..
-- you teach us, us teach us .. :)

-- A bot done for having a FAQ display functoion that is also
-- suitable for use as a Book Reading bot
-- with comands calling for for text files...

Bot = "-grfaq-bot-"
-------------------------------------------------------  t x t s - h e r e
ellinika = "/ChannelBot/Txt/ellinika.txt"

intro = "GRFAQ/gr.faq.intro.txt"

periex = "GRFAQ/gr.faq.index.txt"

keim1 = "GRFAQ/gr.faq.part1a.txt"

keim2 = "GRFAQ/gr.faq.part1b.txt"

keim3 = "GRFAQ/gr.faq.part2.txt"

keim4 = "GRFAQ/gr.faq.part3a.txt"

keim5 = "GRFAQ/gr.faq.part3b.txt"

keim6 = "GRFAQ/gr.faq.part3c.txt"

-------------------------------------------------------  r e g - b o t - i n - h u b
function Main()

frmHub:RegBot(Bot)

end

-------------------------------------------------------  n e w - u s e r - p o p u p
function NewUserConnected(user,data)

Directions(user)

end

------------------------------------------------------- c m d s - f o r - c a l l i n g - t x t s
function DataArrival(user,data)

if strfind(data, "!faq-intro",1,1) then

FaqIntro(user)

elseif strfind(data, "!faq-index",1,1) then

FaqPeriex(user)

elseif strfind(data, "!faq-part1a",1,1) then

FaqPart1a(user)

elseif strfind(data, "!faq-part1b",1,1) then

FaqPart1b(user)

elseif strfind(data, "!faq-part2",1,1) then

FaqPart2(user)

elseif strfind(data, "!faq-part3a",1,1) then

FaqPart3a(user)

elseif strfind(data, "!faq-part3b",1,1) then

FaqPart3b(user)

elseif strfind(data, "!faq-part3c",1,1) then

FaqPart3c(user)

end
end

------------------------------------------------------- f u n c t i o n s - f o r - c a l l i n g - t x t s
function Directions(user)

readfrom(ellinika)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

end

text = text.."\r\n"..line

end

user:SendPM(Bot,text.."|")

readfrom()


end

function FaqIntro(user)

readfrom(intro)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

elseif line ~= "" then
end
text = text.."\r\n"..line
end

user:SendPM(Bot,text.."|")

readfrom()

end


function FaqPeriex(user)

readfrom(periex)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

end
text = text.."\r\n"..line
end

user:SendPM(Bot,text.."|")

readfrom()

end


function FaqPart1a(user)

readfrom(keim1)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

end

text = text.."\r\n"..line

end

user:SendPM(Bot,text.."|")

readfrom()

end

function FaqPart1b(user)

readfrom(keim2)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

end

text = text.."\r\n"..line

end

user:SendPM(Bot,text.."|")

readfrom()

end

function FaqPart2(user)

readfrom(keim3)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

end

text = text.."\r\n"..line

end

user:SendPM(Bot,text.."|")

readfrom()

end

function FaqPart3a(user)

readfrom(keim4)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

end

text = text.."\r\n"..line

end

user:SendPM(Bot,text.."|")

readfrom()

end

function FaqPart3b(user)

readfrom(keim5)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

end

text = text.."\r\n"..line

end

user:SendPM(Bot,text.."|")

readfrom()

end

function FaqPart3c(user)

readfrom(keim6)

local text = "\r\n"

while 1 do

line = read()

if line == nil then

break

end

text = text.."\r\n"..line

end

user:SendPM(Bot,text.."|")

readfrom()

end

Hope it makes sense ...