texter (plop series)
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

texter (plop series)

Started by plop, 13 March, 2004, 03:04:35

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

plop

working on version 4.1 @ the moment so thought it might be nice 2 post the whole serie in 1 topic.
-- texter bot by plop
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.
-- doesn't mather what prefix it used.
-- if the file excist it shows.

Bot = "something"
FDFolder = "text"

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1) 
   if( strsub(data, 1, 1) == "<" ) then
      s,e,cmd = strfind(data,"%b<>%s+%S(%w+)")
      if readfrom(FDFolder.."/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S(%w+)")
      if readfrom(FDFolder.."/"..cmd..".txt") then
         showtext(user, cmd)
         return 1
      end
   end
end

function showtext(user, file)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	user:SendPM(Bot, "\r\n"..contents.."\r\n|")
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

plop

version 2.
-- texter bot by plop
-- modified 2 show only 6 files,
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.


Bot = "something"

FDFolder = "text"

cmd1 = "+ophelp"
file1 = "ophelp.txt"

cmd2 = "+ad"
file2 = "ad.txt"

cmd3 = "+help"
file3 = "help.txt"

cmd4 = "+masterhelp"
file4 = "masterhelp.txt"

cmd5 = "+viphelp"
file5 = "viphelp.txt"

cmd6 = "+hubinfo"
file6 = "hubinfo.txt"


function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1) 
   if( strsub(data, 1, 1) == "<" ) then
      s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
      if cmd == cmd2 then
         showtext(user, file2)
         return 1
      elseif cmd == cmd1 and user.iProfile ==1 then
         showtext(user, file1)
         return 1
      elseif cmd == cmd3 and (user.iProfile ==3 or user.iProfile ==-1) then
         showtext(user, file3)
         return 1
      elseif cmd == cmd4 and user.iProfile ==0 then
         showtext(user, file4)
         return 1
      elseif cmd == cmd5 and user.iProfile ==2 then
         showtext(user, file5)
         return 1
      elseif cmd == cmd6 and user.iProfile ==0 then
         showtextmain(user, file6)
         return 1
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
      if cmd == cmd2 then
         showtext(user, file2)
         return 1
      elseif cmd == cmd1 and user.iProfile ==1 then
         showtext(user, file1)
         return 1
      elseif cmd == cmd3 and (user.iProfile ==3 or user.iProfile ==-1) then
         showtext(user, file3)
         return 1
      elseif cmd == cmd4 and user.iProfile ==0 then
         showtext(user, file4)
         return 1
      elseif cmd == cmd5 and user.iProfile ==2 then
         showtext(user, file5)
         return 1
      elseif cmd == cmd6 and user.iProfile ==0 then
         showtextmain(user, file6)
         return 1
      end
   end
end

function showtext(user, file)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	user:SendPM(Bot, "\r\n"..contents.."\r\n|")
end

function showtextmain(user, file)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	SendToAll(Bot, "\r\n"..contents.."\r\n|")
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

plop

#2
version 3.
-- texter v3.0 by plop
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.
-- doesn't mather what prefix it used.
-- if the file excist it shows.
-- files can be locked 2 certian levels.

Bot = "something"
FDFolder = "text"

function Main()
   frmHub:RegBot(Bot)
   if readfrom(FDFolder.."/textlevels.lua") then
      dofile(FDFolder.."/textlevels.lua")
   else
      textlevels = {}
      save()
   end
end

   msg = "\r\n\r\n"
   msg = msg.."+lock  \t- locks the file to the given level numbers\r\n"
   msg = msg.."+free\t\t\t\t- free's the file again so every level can see them\r\n"
   msg = msg.."+show \t\t\t- shows which levels can see the file\r\n"
   msg = msg.."+list\t\t\t\t- shows all avail files\r\n"

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(%w+)")
      if readfrom(FDFolder.."/"..cmd..".txt") then
         if textlevels[(cmd)] then
            if textlevels[(cmd)][user.iProfile] then
               showtext(user, cmd)
            end
            return 1
         else
            showtext(user, cmd)
            return 1
         end
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      data=strsub(data,1,strlen(data)-1) 
      s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S(%w+)")
      if user.iProfile == 0 then
         if cmd == "help" then
            user:SendPM(Bot, msg.."|")
         elseif cmd == "lock" then
            s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S+)%s*(.*)")
            if readfrom(FDFolder.."/"..file..".txt") then
               if textlevels[(file)] then
                  textlevels[(file)]=nil
               end
               textlevels[(file)]={}
               gsub(strlower(args), "(%S+)", function(number) textlevels[(file)][number]=number end)
               user:SendPM(Bot, "the file: "..file..".txt can now only be viewed by the levels "..args.."|")
               save()
               return 1
            else
               user:SendPM(Bot, "can't lock the file: "..file..".txt as it doesn't excists!|")
               return 1
            end
         elseif cmd == "free" then
            s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S+)")
            if readfrom(FDFolder.."/"..file..".txt") then
               if textlevels[(file)] then
                  textlevels[(file)]=nil
                  user:SendPM(Bot, "the file: "..file..".txt is now unlocked!")
                  save()
                  return 1
               else
                  user:SendPM(Bot, "the file "..file..".txt wasn't locked!|")
                  return 1
               end
            else
               user:SendPM(Bot, "can't free the file: "..file..".txt as it doesn't excists!|")
               return 1
            end
         elseif cmd == "show" then
            s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S+)")
            if readfrom(FDFolder.."/"..file..".txt") then
               if textlevels[(file)] then
                  local tmp = "the file: "..file..".txt can be viewed by the levels:"
                  for a,b in textlevels[(file)] do
                     tmp = tmp.." "..a
                  end
                  user:SendPM(Bot, tmp.."|")
                  return 1
               else
                  user:SendPM(Bot, "the file "..file..".txt isn't locked!|")
                  return 1
               end
            else
               user:SendPM(Bot, "the file: "..file..".txt doesn't excists!|")
               return 1
            end
         elseif cmd =="list" then
            execute("dir "..FDFolder.." > "..FDFolder.."/dirlist.lst")
            readfrom(FDFolder.."/dirlist.lst")
            local tmp = "\r\n\r\n"
            while 1 do
               local kicks = read()
               if kicks ==  nil then
                  break
               end
               local s,e,name = strfind(kicks, "%s(%S+)%.txt$")
               if name then
                  tmp = tmp..name.."\r\n"
               end
            end
            readfrom()
            remove(FDFolder.."/dirlist.lst")
            user:SendPM(Bot, tmp.."|")
            return 1
         elseif readfrom(FDFolder.."/"..cmd..".txt") then
         if textlevels[(cmd)] then
            if textlevels[(cmd)][user.iProfile] then
               showtext(user, cmd)
            end
            return 1
         else
            showtext(user, cmd)
            return 1
         end
      end
      end
      if readfrom(FDFolder.."/"..cmd..".txt") then
         if textlevels[(cmd)] then
            if textlevels[(cmd)][user.iProfile] then
               showtext(user, cmd)
            end
            return 1
         else
            showtext(user, cmd)
            return 1
         end
      end
   end
end

function save()
   writeto(FDFolder.."/textlevels.lua")
   write("textlevels={\n")
   for a,b in textlevels do
      tmp = ""
      for c,d in textlevels[a] do
         if tmp == "" then
            tmp = tmp.."["..c.."]="..d
         else
            tmp = tmp..",".."["..c.."]="..d
         end
      end
      write("  [\""..a.."\"]={"..tmp.."},\n")
   end
   write("}")
   writeto()
end

function showtext(user, file)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
	user:SendPM(Bot, "\r\n"..contents.."\r\n|")
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

plop

#3
version 4.2.
i'm expecting bugs, but you guy's are much better in finding them then me.
-- texter v4.2 by plop
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.
-- doesn't mather what prefix it used.
-- if the file excist it shows (unless it's locked for the users level).

----------------------------- config part (i know it's huge ;) )
Bot = "something"
FDFolder = "text"

-------------- the help menu
   msg = "\r\n\r\n"
   msg = msg.."  file viewing commands.\r\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n"
   msg = msg.."  +lock  \t\t- locks the file to the given level numbers\r\n"
   msg = msg.."  +free \t\t\t\t- free's the file again so every level can see them\r\n"
   msg = msg.."  +where  \t\t\t- changes the location the text file shows. where can be main/pm/allmain/allpm.\r\n"
   msg = msg.."  +show \t\t\t\t- shows which levels can see the file\r\n\r\n"
   
   msg = msg.."  file entry commands.\r\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n"
   msg = msg.."  +addentry  \t\t- shows the file to the given level numbers on entry\r\n"
   msg = msg.."  +delentry \t\t\t- stops the given file from being shown on entry\r\n"
   msg = msg.."  +whereentry  \t\t- changes the location the text file is shown on entry. where can be main/pm.\r\n"
   msg = msg.."  +showentry \t\t\t- shows which levels get to see the file on entry\r\n\r\n"
   
   msg = msg.."  file timer commands.\r\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n"
   msg = msg.."  +addtimer   \t- adds the given filename to the timer. where can be allmain/allpm.\r\n"
   msg = msg.."  +deltimer \t\t\t- removes the given file from the timer\r\n"
   msg = msg.."  +showtimer \t\t\t- shows which on which interval the file is shown by the timer\r\n\r\n"
   
   msg = msg.."  basic help commands.\r\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n"
   msg = msg.."  +showall\t\t\t\t\t- shows all the files which have settings\r\n"
   msg = msg.."  +list\t\t\t\t\t- shows all avail files\r\n"
   msg = msg.."  +help\t\t\t\t\t- this help menu\r\n|"

------------ things 2 do on startup (if 1st launch it build the config file)
function Main()
   frmHub:RegBot(Bot)
   if readfrom(FDFolder.."/textlevels.lua") then
      dofile(FDFolder.."/textlevels.lua")
   else
      text = {}
      text._error={
         ["file"]="file doesn't excist|",
         ["nonum"]="pls tell me which level numbers!.|",
         ["nofile"]="which file?.|",
         ["noargs"]="pls tell me where!. main/pm/allmain/allpm.|",
         ["noargs2"]="pls tell me where!. allmain/allpm.|",
         ["notimer"]="pls tell me which interval (in minutes).|"
      }
      text._default="pm"
      text._levels = {}
      text._where = {}
      text._entry = {}
      text._entrywhere = {}
      text._timer = {}
      text._interval = {} 
      text._intervalb = {} 
      text._entrywheres = {
         ["main"] = "main",
         ["pm"] = "pm"
      }
      text._wheres = {
         ["main"] = "main",
         ["allmain"] = "allmain",
         ["pm"] = "pm",
         ["allpm"] = "allpm"
      }
      text._timerwheres = {
         ["main"]="main",
         ["pm"]="pm"
      }
      save()
   end
   SetTimer(60*1000) 
   StartTimer()
   text._timercounter = 0
   text._interval = text._intervalb
end

--------------- all the commands (tables are cool)
Commands = {
   ["lock"] = function(user, data)
      s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*(.*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["nonum"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._levels[file] then
            text._levels[file]=nil
         end
         text._levels[file]={}
         gsub(strlower(args), "(%S+)", function(number) text._levels[(file)][number]=number end)
         user:SendPM(Bot, "the file: "..file..".txt can now only be viewed by the levels "..args.."|")
         save()
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["free"] = function(user, data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._levels[file] then
            text._levels[file]=nil
            user:SendPM(Bot, "the file: "..file..".txt is now unlocked!")
            save()
         else
            user:SendPM(Bot, "the file "..file..".txt wasn't locked!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["show"] = function(user, data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._levels[file] then
            local tmp = "the file: "..file..".txt can be viewed by the levels:"
            for a,b in text._levels[file] do
               tmp = tmp.." "..a
            end
            tmp = tmp.." in "..(text._where[file] or text._default)
            user:SendPM(Bot, tmp.."|")
         else
            user:SendPM(Bot, "the file "..file..".txt isn't locked!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
     end
   end,
   ["where"] = function(user, data)
      s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["noargs"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._wheres[args] then
            text._where[file]=args
            user:SendPM(Bot, "the file "..file.." will now show in "..args.."|")
            save()
         else
            user:SendPM(Bot, "wrong syntax!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   
   ["addentry"] = function(user, data)
      s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*([%d%s]*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["nonum"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._entry[file] then
            text._entry[file] = nil
         end
         text._entry[file]={}
         gsub(strlower(args), "(%S+)", function(number) text._entry[(file)][number]=number end)
         user:SendPM(Bot, "the file: "..file..".txt whill now be shown to the levels "..args.." when they enter the hub|")
         save()
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["delentry"] = function(user, data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._entry[file] then
            text._entry[file]=nil
            if text._entrywhere[file] then
               text._entrywhere[file]=nil
            end
            user:SendPM(Bot, "the file: "..file..".txt won't be shown on entry anymore!")
            save()
         else
            user:SendPM(Bot, "the file "..file..".txt wasn't shown on entry!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["whereentry"] = function(user, data)
      s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["noargs"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._entrywheres[args] then
            text._entrywhere[file]=args
            user:SendPM(Bot, "the file "..file.." will now show in "..args.." on entry|")
            save()
         else
            user:SendPM(Bot, text._error["noargs2"])
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["showentry"] = function(user,data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._levels[file] then
            local tmp = "the file: "..file..".txt is shown to the levels:"
            for a,b in text._entry[file] do
               tmp = tmp.." "..a
            end
            tmp = tmp.." in "..(text._entrywhere[file] or text._default)
            user:SendPM(Bot, tmp.."|")
         else
            user:SendPM(Bot, "the file "..file..".txt isn't shown!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   
   ["addtimer"] = function(user, data)
      s,e,file,args,args2 = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*(%d*)%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["notimer"] )
      elseif args2 == "" then 
         user:SendPM(Bot, text._error["noargs2"] )
      elseif text._timerwheres[args2] == nil then
         user:SendPM(Bot, "use "..text._error["noargs2"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
            text._intervalb[file] = nil
            text._interval[file] = nil
            text._timer[file] = nil
         args = tonumber(args)
         text._interval[file] = args + text._timercounter

         text._intervalb[file] = args
         text._timer[file] = args2
         user:SendPM(Bot, "the file: "..file..".txt whill now be shown every: "..args.." minutes in "..args2.."|")
         save()
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["deltimer"] = function(user, data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._interval[file] then
            text._intervalb[file] = nil
            text._interval[file] = nil
            text._timer[file] = nil
            user:SendPM(Bot, "the file: "..file..".txt is removed from the timer!")
            save()
         else
            user:SendPM(Bot, "the file "..file..".txt wasn't in the timer!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["showtimer"] = function(user,data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._timer[file] then
            local tmp = "the file: "..file..".txt is shown every:"..text._interval[file].." minutes in "..text._timer[file].."|"
            user:SendPM(Bot, tmp.."|")
         else
            user:SendPM(Bot, "the file "..file..".txt isn't in the timer!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   
continues in the next post
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

plop

#4
part 2
  ["showall"] = function(user,data)
      tmp = ""
      local e=0
      for a,b in text._levels do
         if e==0 then
            tmp = "  on command\r\n  file\t\tlevels\t\twhere\r\n------------------------------------------------------------------------------------\r\n"
            e=1
         end
         tmp = tmp.."  "..a.."\t\t"
         for c,d in text._levels[a] do
            tmp = tmp.." "..c
         end
         tmp = tmp.."\t\t"..(text._where[a] or text._default).."\r\n"
      end
      e=0
      if tmp ~= "" then tmp = tmp.."------------------------------------------------------------------------------------\r\n\r\n" end
      for a,b in text._entry do
         if e==0 then
            tmp = tmp.."  on entry\r\n  file\t\tlevels\t\twhere\r\n------------------------------------------------------------------------------------\r\n"
            e=1
         end
         tmp = tmp.."  "..a.."\t\t"
         for c,d in text._entry[a] do
            tmp = tmp.." "..c
         end
         tmp = tmp.."\t\t"..(text._entrywhere[a] or text._default).."\r\n"
      end
      e=0
      if tmp ~= "" then tmp = tmp.."------------------------------------------------------------------------------------\r\n\r\n" end
      for a,b in text._timer do
         if e==0 then
            tmp = tmp.."  on timer\r\n  file\t\ttime (minutes)\twhere\r\n------------------------------------------------------------------------------------\r\n"
            e=1
         end
         tmp = tmp.."  "..a.."\t\t"
         tmp = tmp.." "..text._interval[a]
         tmp = tmp.."\t\t"..(text._timer[a] or text._default).."\r\n"
      end
      if tmp ~= "" then
         user:SendPM(Bot, "\r\n\r\n"..tmp.."------------------------------------------------------------------------------------|")
      end
   end,
   ["help"] = function(user, data)
      user:SendPM(Bot, msg.."|")
   end,
   ["list"] = function(user, data)
      execute("dir "..FDFolder.." > "..FDFolder.."/dirlist.lst")
      readfrom(FDFolder.."/dirlist.lst")
      local tmp = "\r\n\r\n  all available files:\r\n------------------------------------------------------\r\n"
      while 1 do
         local kicks = read()
         if kicks ==  nil then
            break
         end
         local s,e,name = strfind(kicks, "%s(%S+)%.txt$")
         if name then
            tmp = tmp.."  "..name.."\r\n"
         end
      end
      readfrom()
      remove(FDFolder.."/dirlist.lst")
      user:SendPM(Bot, tmp.."|")
   end
}

----------- stuff 2 do on incomming data (shall we call this a chair ???)
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(%w+)") 
      if readfrom(FDFolder.."/"..cmd..".txt") then
         if text._levels[cmd] then
            if text._levels[cmd][user.iProfile] then
               showtext(user, cmd, text._levels[cmd][user.iProfile])
            end
            return 1
         else
            showtext(user, cmd, text._default)
            return 1
         end
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      if whoTo == Bot then
         data=strsub(data,1,strlen(data)-1) 
         s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S(%w+)")
         if Commands[cmd] and user.iProfile == 0 then
            return call(Commands[cmd], {user,data})
         elseif readfrom(FDFolder.."/"..cmd..".txt") then
            if text._levels[cmd] then
               if text._levels[cmd][user.iProfile] then
                  showtext(user, cmd, text._where[cmd])
               end
               return 1
            else
               showtext(user, cmd, text._default)
               return 1
            end
         end
      end
   end
end

--------------- saving the config (tables are still cool)
function save()
   writeto(FDFolder.."/textlevels.lua")
   write("\n--config file for texter 4.2, better not edit this by hand if you don't know what your doing\n\ntext={\n")
   local t = 0
   for a,b in text do
      if type(text[a]) ~= "number" then
         if t==0 then
            write("   "..a.."=")
            t=1
         else
            write(",\n   "..a.."=")
         end
         if type(b) == "string" then
            write("\""..b.."\"")
         else
            t2 = 0
            t3 = 0
            write("{")
            for c,d in text[a] do
               if type(d) ~= "table" then
                  if tonumber(d) then
                     tmp = d
                  else
                     tmp = "\""..d.."\""
                  end
                  if t2 == 0 then
                     write("\n      [\""..c.."\"]="..tmp)
                     t2 = 1
                  else
                     write(",\n      [\""..c.."\"]="..tmp)
                  end
               else
                  if t3==0 then
                     t3 = 1
                  else
                     write(",")
                  end
                  t4 = 0
                  for e,f in text[a][c] do
                     if t4 == 0 then
                        write("\n      [\""..c.."\"]={")
                        write("\n         ["..e.."]="..f)
                        t4 = 1
                     else
                        write(",\n         ["..e.."]="..f)
                     end
                  end
                  write("\n      }")
               end
            end
            write("\n   }")
         end
      end
   end
   write("\n}\n\n--plopyrights reserved")
   writeto()
end

---------------------- show the actual files (the spamming part)
function showtext(user, file, where)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
   if where == "main" then
      user:SendData(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allmain" then
      SendToAll(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allpm" then
      SendPmToAll(Bot, "\r\n"..contents.."\r\n|")
   else
      user:SendPM(Bot, "\r\n"..contents.."\r\n|")
   end
end

--------------------- if this isn't triggered you got a empty/lonely hub
function NewUserConnected(user)
   for a,b in text._entry do
      if text._entry[a][user.iProfile] then
         showtext(user, a, (text._entrywhere[a] or text._default))
      end
   end
end

----------------------- you gotta have these weirdo's
function OpConnected(user)
   for a,b in text._entry do
      if text._entry[a][user.iProfile] then
         showtext(user, a, (text._entrywhere[a] or text._default))
      end
   end
end

---------------- mister swiss clock (don't forget 2 exchange the battery on time)
function OnTimer()
   text._timercounter = text._timercounter +1
   for a,b in text._timer do
      if text._interval[a] == text._timercounter then
         text._interval[a] = text._interval[a] +text._timercounter
         showtext(Bot, a, text._timer[a])
      end
   end
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Millsy

None Of The Bots Commands Work But The .txt Files Do Work And I Got No Errors

Later,
Millsy
MoviePirates.no-ip.com    -   Part Of The BBI Network

plop

found a bug in the loading part, caused an error on saving which caused the timer 2 go spookie on adding/removing.
-- texter v4.3 by plop
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.
-- doesn't mather what prefix it used.
-- if the file excist it shows (unless it's locked for the users level).

Bot = "something"
FDFolder = "text"


   msg = "\r\n\r\n"
   msg = msg.."  file viewing commands.\r\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n"
   msg = msg.."  +lock  \t\t- locks the file to the given level numbers\r\n"
   msg = msg.."  +free \t\t\t\t- free's the file again so every level can see them\r\n"
   msg = msg.."  +where  \t\t\t- changes the location the text file shows. where can be main/pm/allmain/allpm.\r\n"
   msg = msg.."  +show \t\t\t\t- shows which levels can see the file\r\n\r\n"
   
   msg = msg.."  file entry commands.\r\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n"
   msg = msg.."  +addentry  \t\t- shows the file to the given level numbers on entry\r\n"
   msg = msg.."  +delentry \t\t\t- stops the given file from being shown on entry\r\n"
   msg = msg.."  +whereentry  \t\t- changes the location the text file is shown on entry. where can be main/pm.\r\n"
   msg = msg.."  +showentry \t\t\t- shows which levels get to see the file on entry\r\n\r\n"
   
   msg = msg.."  file timer commands.\r\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n"
   msg = msg.."  +addtimer   \t- adds the given filename to the timer. where can be allmain/allpm.\r\n"
   msg = msg.."  +deltimer \t\t\t- removes the given file from the timer\r\n"
   msg = msg.."  +showtimer \t\t\t- shows which on which interval the file is shown by the timer\r\n\r\n"
   
   msg = msg.."  basic help commands.\r\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n"
   msg = msg.."  +showall\t\t\t\t\t- shows all the files which have settings\r\n"
   msg = msg.."  +list\t\t\t\t\t- shows all avail files\r\n"
   msg = msg.."  +help\t\t\t\t\t- this help menu\r\n|"

function Main()
   frmHub:RegBot(Bot)
   if readfrom(FDFolder.."/textlevels.lua") then
      dofile(FDFolder.."/textlevels.lua")
   else
      text = {}
      text._error={
         ["file"]="file doesn't excist|",
         ["nonum"]="pls tell me which level numbers!.|",
         ["nofile"]="which file?.|",
         ["noargs"]="pls tell me where!. main/pm/allmain/allpm.|",
         ["noargs2"]="pls tell me where!. allmain/allpm.|",
         ["notimer"]="pls tell me which interval (in minutes).|"
      }
      text._default="pm"
      text._levels = {}
      text._where = {}
      text._entry = {}
      text._entrywhere = {}
      text._timer = {}
      text._interval = {} 
      text._intervalb = {} 
      text._entrywheres = {
         ["main"] = "main",
         ["pm"] = "pm"
      }
      text._wheres = {
         ["main"] = "main",
         ["allmain"] = "allmain",
         ["pm"] = "pm",
         ["allpm"] = "allpm"
      }
      text._timerwheres = {
         ["main"]="main",
         ["pm"]="pm"
      }
      save()
   end
   text._interval = nil
   text._interval = {}
   for a,b in text._intervalb do
      text._interval[a]=b
   end
   SetTimer(60*1000) 
   StartTimer()
   text._timercounter = 0
end

Commands = {
   ["lock"] = function(user, data)
      s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*(.*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["nonum"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._levels[file] then
            text._levels[file]=nil
         end
         text._levels[file]={}
         gsub(strlower(args), "(%S+)", function(number) text._levels[(file)][number]=number end)
         user:SendPM(Bot, "the file: "..file..".txt can now only be viewed by the levels "..args.."|")
         save()
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["free"] = function(user, data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._levels[file] then
            text._levels[file]=nil
            user:SendPM(Bot, "the file: "..file..".txt is now unlocked!")
            save()
         else
            user:SendPM(Bot, "the file "..file..".txt wasn't locked!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["show"] = function(user, data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._levels[file] then
            local tmp = "the file: "..file..".txt can be viewed by the levels:"
            for a,b in text._levels[file] do
               tmp = tmp.." "..a
            end
            tmp = tmp.." in "..(text._where[file] or text._default)
            user:SendPM(Bot, tmp.."|")
         else
            user:SendPM(Bot, "the file "..file..".txt isn't locked!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
     end
   end,
   ["where"] = function(user, data)
      s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["noargs"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._wheres[args] then
            text._where[file]=args
            user:SendPM(Bot, "the file "..file.." will now show in "..args.."|")
            save()
         else
            user:SendPM(Bot, "wrong syntax!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   
   ["addentry"] = function(user, data)
      s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*([%d%s]*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["nonum"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._entry[file] then
            text._entry[file] = nil
         end
         text._entry[file]={}
         gsub(strlower(args), "(%S+)", function(number) text._entry[(file)][number]=number end)
         user:SendPM(Bot, "the file: "..file..".txt whill now be shown to the levels "..args.." when they enter the hub|")
         save()
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["delentry"] = function(user, data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._entry[file] then
            text._entry[file]=nil
            if text._entrywhere[file] then
               text._entrywhere[file]=nil
            end
            user:SendPM(Bot, "the file: "..file..".txt won't be shown on entry anymore!")
            save()
         else
            user:SendPM(Bot, "the file "..file..".txt wasn't shown on entry!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["whereentry"] = function(user, data)
      s,e,file,args = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["noargs"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._entrywheres[args] then
            text._entrywhere[file]=args
            user:SendPM(Bot, "the file "..file.." will now show in "..args.." on entry|")
            save()
         else
            user:SendPM(Bot, text._error["noargs2"])
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["showentry"] = function(user,data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._levels[file] then
            local tmp = "the file: "..file..".txt is shown to the levels:"
            for a,b in text._entry[file] do
               tmp = tmp.." "..a
            end
            tmp = tmp.." in "..(text._entrywhere[file] or text._default)
            user:SendPM(Bot, tmp.."|")
         else
            user:SendPM(Bot, "the file "..file..".txt isn't shown!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   
   ["addtimer"] = function(user, data)
      s,e,file,args,args2 = strfind(data, "%$%b<>%s*%S+%s*(%S*)%s*(%d*)%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif args == "" then
         user:SendPM(Bot, text._error["notimer"] )
      elseif args2 == "" then 
         user:SendPM(Bot, text._error["noargs2"] )
      elseif text._timerwheres[args2] == nil then
         user:SendPM(Bot, "use "..text._error["noargs2"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
            text._intervalb[file] = nil
            text._interval[file] = nil
            text._timer[file] = nil
         args = tonumber(args)
         text._interval[file] = args + text._timercounter
         text._intervalb[file] = args
         text._timer[file] = args2
         user:SendPM(Bot, "the file: "..file..".txt whill now be shown every: "..args.." minutes in "..args2.."|")
         save()
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["deltimer"] = function(user, data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._interval[file] then
            text._intervalb[file] = nil
            text._interval[file] = nil
            text._timer[file] = nil
            user:SendPM(Bot, "the file: "..file..".txt is removed from the timer!")
            save()
         else
            user:SendPM(Bot, "the file "..file..".txt wasn't in the timer!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   ["showtimer"] = function(user,data)
      s,e,file = strfind(data, "%$%b<>%s*%S+%s*(%S*)")
      if file == "" then
         user:SendPM(Bot, text._error["nofile"] )
      elseif readfrom(FDFolder.."/"..file..".txt") then
         if text._timer[file] then
            local tmp = "the file: "..file..".txt is shown every:"..text._interval[file].." minutes in "..text._timer[file].."|"
            user:SendPM(Bot, tmp.."|")
         else
            user:SendPM(Bot, "the file "..file..".txt isn't in the timer!|")
         end
      else
         user:SendPM(Bot, text._error["file"])
      end
   end,
   
continues below.
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

plop

#7
last part.
  ["showall"] = function(user,data)
      tmp = ""
      local e=0
      for a,b in text._levels do
         if e==0 then
            tmp = "  on command\r\n  file\t\tlevels\t\twhere\r\n------------------------------------------------------------------------------------\r\n"
            e=1
         end
         tmp = tmp.."  "..a.."\t\t"
         for c,d in text._levels[a] do
            tmp = tmp.." "..c
         end
         tmp = tmp.."\t\t"..(text._where[a] or text._default).."\r\n"
      end
      if e == 1 then tmp = tmp.."------------------------------------------------------------------------------------\r\n\r\n" end
      e=0
      for a,b in text._entry do
         if e==0 then
            tmp = tmp.."  on entry\r\n  file\t\tlevels\t\twhere\r\n------------------------------------------------------------------------------------\r\n"
            e=1
         end
         tmp = tmp.."  "..a.."\t\t"
         for c,d in text._entry[a] do
            tmp = tmp.." "..c
         end
         tmp = tmp.."\t\t"..(text._entrywhere[a] or text._default).."\r\n"
      end
      if e == 1 then tmp = tmp.."------------------------------------------------------------------------------------\r\n\r\n" end
      e=0
      for a,b in text._timer do
         if e==0 then
            tmp = tmp.."  on timer\r\n  file\t\ttime (minutes)\twhere\r\n------------------------------------------------------------------------------------\r\n"
            e=1
         end
         tmp = tmp.."  "..a.."\t\t".." "..text._interval[a].."\t\t"..(text._timer[a] or text._default).."\r\n"
      end
      if e == 0 then
         user:SendPM(Bot, "\r\n\r\n"..tmp.."|")
      else
         user:SendPM(Bot, "\r\n\r\n"..tmp.."------------------------------------------------------------------------------------\r\n\r\n|")
      end
   end,
   ["help"] = function(user, data)
      user:SendPM(Bot, msg.."|")
   end,
   ["list"] = function(user, data)
      execute("dir "..FDFolder.." > "..FDFolder.."/dirlist.lst")
      readfrom(FDFolder.."/dirlist.lst")
      local tmp = "\r\n\r\n  all available files:\r\n------------------------------------------------------\r\n"
      while 1 do
         local kicks = read()
         if kicks ==  nil then
            break
         end
         local s,e,name = strfind(kicks, "%s(%S+)%.txt$")
         if name then
            tmp = tmp.."  "..name.."\r\n"
         end
      end
      readfrom()
      remove(FDFolder.."/dirlist.lst")
      user:SendPM(Bot, tmp.."|")
   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(%w+)") 
      if readfrom(FDFolder.."/"..cmd..".txt") then
         if text._levels[cmd] then
            if text._levels[cmd][user.iProfile] then
               showtext(user, cmd, text._levels[cmd][user.iProfile])
            end
            return 1
         else
            showtext(user, cmd, text._default)
            return 1
         end
      end
   elseif(strsub(data, 1, 4) == "$To:") then
      s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      if whoTo == Bot then
         data=strsub(data,1,strlen(data)-1) 
         s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S(%w+)")
         if Commands[cmd] and user.iProfile == 0 then
            return call(Commands[cmd], {user,data})
         elseif readfrom(FDFolder.."/"..cmd..".txt") then
            if text._levels[cmd] then
               if text._levels[cmd][user.iProfile] then
                  showtext(user, cmd, text._where[cmd])
               end
               return 1
            else
               showtext(user, cmd, text._default)
               return 1
            end
         end
      end
   end
end



function save()
   writeto(FDFolder.."/textlevels.lua")
   write("\n--config file for texter 4.3, better not edit this by hand if you don't know what your doing\n\ntext={\n")
   local t = 0
   for a,b in text do
      if type(text[a]) ~= "number" then
         if t==0 then
            write("   "..a.."=")
            t=1
         else
            write(",\n   "..a.."=")
         end
         if type(b) == "string" then
            write("\""..b.."\"")
         else
            t2 = 0
            t3 = 0
            write("{")
            for c,d in text[a] do
               if type(d) ~= "table" then
                  if tonumber(d) then
                     tmp = d
                  else
                     tmp = "\""..d.."\""
                  end
                  if t2 == 0 then
                     write("\n      [\""..c.."\"]="..tmp)
                     t2 = 1
                  else
                     write(",\n      [\""..c.."\"]="..tmp)
                  end
               else
                  if t3==0 then
                     t3 = 1
                  else
                     write(",")

                  end
                  t4 = 0
                  for e,f in text[a][c] do
                     if t4 == 0 then
                        write("\n      [\""..c.."\"]={")
                        write("\n         ["..e.."]="..f)
                        t4 = 1
                     else
                        write(",\n         ["..e.."]="..f)
                     end
                  end
                  write("\n      }")
               end
            end
            write("\n   }")
         end
      end
   end
   write("\n}\n\n--plopyrights reserved")
   writeto()
end



function showtext(user, file, where)
	local handle = openfile(FDFolder.."/"..file..".txt", "r")
	local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
	closefile (handle)
   if where == "main" then
      user:SendData(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allmain" then
      SendToAll(Bot, "\r\n"..contents.."\r\n|")
   elseif where == "allpm" then
      SendPmToAll(Bot, "\r\n"..contents.."\r\n|")
   else
      user:SendPM(Bot, "\r\n"..contents.."\r\n|")
   end
end

function NewUserConnected(user)
   for a,b in text._entry do
      if text._entry[a][user.iProfile] then
         showtext(user, a, (text._entrywhere[a] or text._default))
      end
   end
end

function OpConnected(user)
   for a,b in text._entry do
      if text._entry[a][user.iProfile] then
         showtext(user, a, (text._entrywhere[a] or text._default))
      end
   end
end

function OnTimer()
   text._timercounter = text._timercounter +1
   for a,b in text._timer do
      if text._interval[a] == text._timercounter then
         text._interval[a] = text._interval[a] +text._timercounter
         showtext(Bot, a, text._timer[a])
      end
   end
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

plop

QuoteOriginally posted by Millsy
None Of The Bots Commands Work But The .txt Files Do Work And I Got No Errors

Later,
Millsy
all text files work in both main and pm 2 the bot, all other commands only work in pm 2 the bot.
can't see anything else, script works great here and i did test this 1 (a bit. lol).

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

yepyepyep4711

#9
same problem here. Works like a charm, but doesn't accept commands.

And seems to lock files. I couldn't rename a file while the script was running. One of my editors couldn't write to it at all.

cheers

plop

QuoteOriginally posted by yepyepyep4711
same problem here. Works like a charm, but doesn't accept commands.

And seems to lock files. I couldn't rename a file while the script was running. One of my editors couldn't write to it at all.

cheers
sounds like a bug on closing the file.
but there isn't much you can edit in the file.
gone check it a bit deeper.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

plop

all the versions posted above and from my site have been edited.
wombat pointed me a posible exploit in it which is fixed now.
the reason for none of the commands 2 mod the settings is also fixed.
due 2 the fact that i mostly use a op account on my own hub instead of master caused a error 2 be slipped in.
op's could edit the settings not masters. lol
so if you use it then pls pls pls download the fixed scripts, even if you never encountered a problem with them.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

imby

tried 4.4 and 4.5, got the following error:

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 364 [file `...rams - Games\ptokax 15.25\scripts\texter4.4.lua']

plop

QuoteOriginally posted by imby
tried 4.4 and 4.5, got the following error:

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 364 [file `...rams - Games\ptokax 15.25\scripts\texter4.4.lua']
this is weird cause the 1st thing which is done after searching for cmd is checking if it's there (if cmd ~= nil then).
can you try 2 find out whats needed 2 type 2 get this error?

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

imby

i think i solved the problem. i always like to update my scripts, so added the newest version of txter. which left the old textlevels.lua in it's folder. so was testing today, and deleted textlevels.lua so it could make its own fresh one. that was the only thing i did. now online, with no errors for 5 hrs.

plop

QuoteOriginally posted by imby
i think i solved the problem. i always like to update my scripts, so added the newest version of txter. which left the old textlevels.lua in it's folder. so was testing today, and deleted textlevels.lua so it could make its own fresh one. that was the only thing i did. now online, with no errors for 5 hrs.
yep thats indeed posible.
some more commands are added which are not in the saved table.
and those can spray out errors.
hope it keeps running error free.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

imby

working fine, no more errors. thankyou for the great script.

imby

Syntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 367 [file `...rams - Games\Ptokax 15.25\scripts\texter4.5.lua']

hmm, never mind spoke too soon. seems to happen every once in a while , like on a timer or something.

NeoUltimicia

QuoteSyntax error: attempt to concat global `cmd' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 367 [file `...3.3.0.build.15.25.[debug]\scripts\texter4.5.lua']
As you can see.. I'm using 0.3.3.0 build 15 25
Is there some compatibility issues with that version?
because I got another error when using ptokax 3.2.6 TD4
QuoteSyntax Error: attempt to index local `user' (a string value)
------------
BTW, also the Timer doesn't work either for both TD4 and 0.3.3.0!
QuoteSyntax error: attempt to index local `user' (a string value)
stack traceback:
   1:  function `showtext' at line 469 [file `...3.3.0.build.15.25.[debug]\scripts\texter4.5.lua']
   2:  function `OnTimer' at line 500 [file `...3.3.0.build.15.25.[debug]\scripts\texter4.5.lua']
I just had a feeling from above that I needed to specify the level first (by using +lock ) and then set the timer for that class.
but.. even after doing that.. it didn't help.. same error.

Quote[17:14] +addtimer magz 1 main
[17:14] the file: magz.txt whill now be shown every: 1 minutes in main
[17:15] +showtimer magz
[17:15] the file: magz.txt is shown every:2 minutes in main
[17:15] +showtimer magz
[17:15] the file: magz.txt is shown every:2 minutes in main
[17:15] +showtimer magz
[17:15] the file: magz.txt is shown every:2 minutes in main
[17:17] +showtimer magz
[17:17] the file: magz.txt is shown every:4 minutes in main
as you can see.. whenever I check the time, it adds more minutes...
as for "textlevels.lua" here is what written
Quotetext={
   _interval={
      ["magz"]=1
   },
after all... I don't get any messages in the main chat, even after waiting for 4 minutes.. nothin at all...

plop

restart the script after changing the settings.
it has some issues on picking up changed things.
if it then still gives errors, then pls post the config file.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NeoUltimicia

I still kept getting the same error:
one thing.. the timer changed now to "6" even though I didn't modify anything since the last post...
here is the configure:

--config file for texter 4.3, better not edit this by hand if you don't know what your doing

text={
   _interval={
      ["magz"]=6
   },
   _entrywhere={
   },
   _error={
      ["file"]="file doesn't excist|",
      ["nofile"]="which file?.|",
      ["noargs2"]="pls tell me where!. allmain/allpm.|",
      ["noargs"]="pls tell me where!. main/pm/allmain/allpm.|",
      ["notimer"]="pls tell me which interval (in minutes).|",
      ["nonum"]="pls tell me which level numbers!.|"
   },
   _entrywheres={
      ["main"]="main",
      ["pm"]="pm"
   },
   _wheres={
      ["pm"]="pm",
      ["allpm"]="allpm",
      ["main"]="main",
      ["allmain"]="allmain"
   },
   _timer={
      ["magz"]="main"
   },
   _where={
   },
   _intervalb={
      ["magz"]=1
   },
   _timerwheres={
      ["main"]="main",
      ["pm"]="pm"
   },
   _entry={
      ["magz"]={
         [0]=0
      }
   },
   _default="pm",
   _levels={
      ["magz"]={
         [0]=0
      }
   }
}

--plopyrights reserved
The script was downloaded from your site. I didn't change anything in there "except renaming the bot"
so... I hope you got the nessesary infos.

NeoUltimicia

#21
*Edited* OPS Wrong Post, sorry

plop

QuoteOriginally posted by NeoUltimicia
I still kept getting the same error:
one thing.. the timer changed now to "6" even though I didn't modify anything since the last post...
here is the configure:

The script was downloaded from your site. I didn't change anything in there "except renaming the bot"
so... I hope you got the nessesary infos.
yep found 2 errors.
both of us are 2 blame. lol
I made 1 on the timer.
if you look closely you see interval and intervalb, that last is the the actual interval the script should show the text on.
the script is counting every minute.
on startup the counter is 0 and it sets the interval vallue to 1.
when the counter and interval match the text is shown, after that it adds the counter + the intervalb to get the next moment the counter and interval should match.
here i made the mistake 2 add the counter and interval.

you made the mistake on having the timer show on "main" instead of "allmain".

but i'm now fixing/upgrading the texter, "main" is gone be possible 2 use + level numbers.

if any1 has other feature requests tell them now. lol

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NeoUltimicia

well, I guess I understood what you mean..

as for "allmain" and when you said:
Quotebut i'm now fixing/upgrading the texter, "main" is gone be possible 2 use + level numbers.
are you refering the the erre down here?

Quote[23:13] +showall
[23:13]


[23:13] +addtimer magz 2 allmain
[23:13] use pls tell me where!. allmain/allpm.
[23:13] +addtimer magz 2 allpm
[23:13] use pls tell me where!. allmain/allpm.
[23:13] +addtimer magz 2 main
[23:13] the file: magz.txt whill now be shown every: 2 minutes in main

plop

QuoteOriginally posted by NeoUltimicia
well, I guess I understood what you mean..

as for "allmain" and when you said:
Quotebut i'm now fixing/upgrading the texter, "main" is gone be possible 2 use + level numbers.
are you refering the the erre down here?

Quote[23:13] +showall
[23:13]


[23:13] +addtimer magz 2 allmain
[23:13] use pls tell me where!. allmain/allpm.
[23:13] +addtimer magz 2 allpm
[23:13] use pls tell me where!. allmain/allpm.
[23:13] +addtimer magz 2 main
[23:13] the file: magz.txt whill now be shown every: 2 minutes in main
indeed, the bold things are correct the last 1 is wrong.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk