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?
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
Thanks but i have all the text in an lua file :)
How do i do then?
rewrite rules text in TXT file
But is there no way to make it possible in an lua file?
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
I made an TXT file insted but it didnt work =/ its still
rule1
rule2
rule3
rule4
rule5
rule6
rule7
:(
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
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