PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: Skynet on 04 March, 2005, 13:05:06

Title: small ascii script
Post by: Skynet on 04 March, 2005, 13:05:06
small ascii script tested and working

-- ascii main sender
--
-- LUA 5
--03/02/05

Bot = "LOK"   -- your main bot here
CDFolder = "images" -- make folder in your scripts put your ascii there

function Main()
   frmHub:RegBot(Bot)
end

function ChatArrival(user, data)
   data=string.sub(data,1,string.len(data)-1)
   if( string.sub(data, 1, 1) == "<" ) then
      s,e,cmd = string.find(data,"%b<>%s+(%S+)")
      cmd = string.sub(cmd, 1,string.len(cmd))
      if io.open(CDFolder.."/"..cmd..".txt",r) ~= nil then
         showtext(user, cmd)
         return 1
      end
   end
end

function showtext(user, file)
local contents ="\r\n\r\n"
for line in io.lines(CDFolder.."/"..file..".txt") do
    contents = contents..line.."\r\n"
    end
SendToAll(Bot,"\r\n"..contents.."\r\n|")
end

function showtextold(user, cmd)
local lines="\r\n\r\n"
    for line in io.lines(file) do
        lines = lines..line.."\r\n"
    end
    user:SendPM(Bot, lines.." |")
end


have fun Skynet
landofkaraoke
Title:
Post by: Helper on 04 March, 2005, 21:28:02
Hi,

can you put a timer in it.

Thnx.
Title:
Post by: witch on 27 March, 2005, 13:40:01
yeah timer will be cool 4 sure  

thx in advince  :D
Title:
Post by: dkt on 29 May, 2005, 14:37:13
hi, wonderful script Mate..
But it doesnt show which user has used the command..only the ascii appears in main chat.. i want to see which user has used  the command..can the script be modified like this ?
Title:
Post by: Dessamator on 29 May, 2005, 15:13:31
function ChatArrival(user, data)
   data=string.sub(data,1,string.len(data)-1)
  [COLOR=red] if( string.sub(data, 1, 1) == "<" ) then[/COLOR]
      s,e,cmd = string.find(data,"%b<>%s+(%S+)")
      cmd = string.sub(cmd, 1,string.len(cmd))
      if io.open(CDFolder.."/"..cmd..".txt",r) ~= nil then
         showtext(user, cmd)
    [COLOR=red] return 1[/COLOR]
     [COLOR=red]end[/COLOR]
   end
end



remove the lines in red !
Title:
Post by: dkt on 29 May, 2005, 15:19:21
lol desssmtor i removed the two lines...now its showing the message from text file two times in main
see like this

[18:50]


   ----- Rules -----

          <1.> Do Not Share 0 B ( Share Something ).                                      
          <2.> Do Not Disconnect Other Users Download.
          <3.> Do Not Advertise For Other Hubs.
          <4.> Be Friendly With Other Users.
          <5.> Do Not flood In Main Chat.
          <6.> Do Not Talk About This Hub To Your Cable Operator.

          *** Breaking The Above Rules Will Get Your Ip Banned Or Kicked. ***



[18:50]


   ----- Rules -----

          <1.> Do Not Share 0 B ( Share Something ).                                      
          <2.> Do Not Disconnect Other Users Download.
          <3.> Do Not Advertise For Other Hubs.
          <4.> Be Friendly With Other Users.
          <5.> Do Not flood In Main Chat.
          <6.> Do Not Talk About This Hub To Your Cable Operator.
Title:
Post by: Dessamator on 29 May, 2005, 15:36:17
you were supposed to remove 3 lines, not only 2,
show me the script u have now!
Title:
Post by: dkt on 29 May, 2005, 15:48:47
oops ....working fine now..maybe last time i did some mistake while deleting..
 lines
anyways tx m8
Title:
Post by: dkt on 29 May, 2005, 15:52:25
can these message in .txt  in images folder be sent to main in time intervals.
all files shld be displayed in main chat one by one but there shld be some time interval between files to be sent in main

is it possible ?
Title:
Post by: jiten on 29 May, 2005, 15:56:59
QuoteOriginally posted by dkt
can these message in .txt  in images folder be sent to main in time intervals.
all files shld be displayed in main chat one by one but there shld be some time interval between files to be sent in main

is it possible ?
Search the forum for "Rotating Message". It does all this and more ;)

Best regards