Author Topic: Please help! =)  (Read 2791 times)

0 Members and 1 Guest are viewing this topic.

Offline Glidaren

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Please help! =)
« 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?
One HubSoft to rule them all! :D
Dude wheres my script?  ;)

PtokaX forum

Please help! =)
« on: 24 October, 2003, 19:16:42 »

Offline servaks

  • Double Ace
  • *
  • Posts: 145
  • Karma: +1/-0
(No subject)
« Reply #1 on: 24 October, 2003, 19:24:55 »
Try this one..

Code: [Select]

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
My hub is back! (yeeeeeey)

hub.servaks.com


Offline Glidaren

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
(No subject)
« Reply #2 on: 24 October, 2003, 19:32:19 »
Thanks but i have all the text in an lua file  :)
How do i do then?
One HubSoft to rule them all! :D
Dude wheres my script?  ;)

Offline servaks

  • Double Ace
  • *
  • Posts: 145
  • Karma: +1/-0
(No subject)
« Reply #3 on: 24 October, 2003, 19:33:27 »
rewrite rules text in TXT file
My hub is back! (yeeeeeey)

hub.servaks.com


Offline Glidaren

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
(No subject)
« Reply #4 on: 24 October, 2003, 19:34:39 »
But is there no way to make it possible in an lua file?
One HubSoft to rule them all! :D
Dude wheres my script?  ;)

Offline servaks

  • Double Ace
  • *
  • Posts: 145
  • Karma: +1/-0
(No subject)
« Reply #5 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
My hub is back! (yeeeeeey)

hub.servaks.com


Offline Glidaren

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
(No subject)
« Reply #6 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

 :(
One HubSoft to rule them all! :D
Dude wheres my script?  ;)

Offline servaks

  • Double Ace
  • *
  • Posts: 145
  • Karma: +1/-0
(No subject)
« Reply #7 on: 24 October, 2003, 19:49:45 »
Maby try this...

Code: [Select]

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



My hub is back! (yeeeeeey)

hub.servaks.com


Offline MrZ

  • Lord
  • ***
  • Posts: 391
  • Karma: +4/-0
(No subject)
« Reply #8 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
Always remember that you are unique... just like everyone else :-D

PtokaX forum

(No subject)
« Reply #8 on: 25 October, 2003, 08:28:41 »