PtokaX forum

Development Section => Your Developing Problems => Topic started by: Glidaren on 24 October, 2003, 19:16:42

Title: Please help! =)
Post by: Glidaren on 24 October, 2003, 19:16:42
Hellu! =)

I need some help.
My bot sends the rule message like thise
Thise is the hub rules:
Rule 1
Rule 2
Rule 3
Rule 4
Rule 5
Rule 6
Rule 7
Rule 8

And i whant it to send like thise:

Thise is the hub rules:
Rule 1
Rule 2
Rule 3
Rule 4
Rule 5
Rule 6
Rule 7
Rule 8

Any ide?
Title:
Post by: servaks on 24 October, 2003, 19:24:55
Try this one..


trigger = "!rules"
file = "rules.txt"
botname = "Rules bot"

function Main()
frmHub:RegBot(botname)
end

function ReadRulesFile(user, theFile)
local handle = openfile(theFile, "r")
if (handle ~= nil) then
local line = read(handle)
while line do
user:SendPM(botname,line)
line = read(handle)
end
closefile(handle)
end
end

function DataArrival(user, data)
if (strsub(data,1,1)=="<") then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == trigger then
ReadRulesFile(user, file)
return 1
end
end
end


/shipis
Title:
Post by: Glidaren on 24 October, 2003, 19:32:19
Thanks but i have all the text in an lua file  :)
How do i do then?
Title:
Post by: servaks on 24 October, 2003, 19:33:27
rewrite rules text in TXT file
Title:
Post by: Glidaren on 24 October, 2003, 19:34:39
But is there no way to make it possible in an lua file?
Title:
Post by: servaks on 24 October, 2003, 19:37:37
wow

pardon...

the script is not working lol...
maby use "\r\n" after each line...
Priew:
SendData:(bot, "ruule1"\r\n"rule2"\r\n)

/shipis
Title:
Post by: Glidaren on 24 October, 2003, 19:43:41
I made an TXT file insted but it didnt work =/ its still

rule1
rule2
rule3
rule4
rule5
rule6
rule7

 :(
Title:
Post by: servaks on 24 October, 2003, 19:49:45
Maby try this...


trigger = "!rules"
file = "rules.txt"
botname = "Rules bot"

function Main()
frmHub:RegBot(botname)
end

function DataArrival(user, data)
if (strsub(data,1,1)=="<") then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == trigger then
ReadRulesFile(user, file)
return 1
end
end
end

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



Title:
Post by: MrZ on 25 October, 2003, 08:28:41
Hia:))

Wich script are ya using???
If its one of em in here, pls tell us. If ya wrote it yaself or its not one of em in here pls paste it in here (as code).

Z ya