Main Msg Rotator and FreshStuff 3.3
 

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

Main Msg Rotator and FreshStuff 3.3

Started by jiten, 14 October, 2004, 11:46:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jiten

i wanted to combine a main message rotator with plop's freshstuff 3.3.

in fact, freshstuff creates a .txt where are saved all the entries.
For example, I have added these categories: "games", "movies" and "software". When I add some entries, the .txt is like this:

movies$Poster$10/09/04$ Resident Evil: Apocalypse
movies$Poster$10/09/04$ Harry Potter 3
games$Poster$10/09/04$ Doom 3
games$Poster$10/09/04$ UT 2004
software$Poster$10/09/04$ Ad Aware SE

So, i wanted a script that reads that .txt and shows all the entries of each category in main chat in a certain interval.
Ex: Firstly, all the movies, then, 30 minutes later, all the games, then, all the software, and so on...

can someone help me on this?
thanks in advance,

jiten

jiten


jiten

Mutor, I already tried the Rotating Message script, but, the one I'm looking for is quite different.

The differences are:
- Freshstuff creates only 1 file where are stored all the entries, in my case: txt/destaques.txt
- I've got 3 categories: "Games", "Software" and "Movies"
- Whenever I add a new stuff to those categories, the entry is stored only in that single txt

This is the content of the destaques.txt currently:

movies$MZ Network$10/09/04$1 Shark Tale
movies$MZ Network$10/09/04$2 Friday Night Lights
movies$MZ Network$10/09/04$3 Ladder 49
movies$MZ Network$10/09/04$4 Taxi
movies$MZ Network$10/09/04$5 The Forgotten
games$MZ Network$10/09/04$1 Doom 3 by Activision
games$MZ Network$10/09/04$2 The Sims Deluxe by Electronic Arts
games$MZ Network$10/09/04$3 Age of Mythology by Microsoft Game Studios
games$MZ Network$10/09/04$4 World Poker Championship by ValuSoft
games$MZ Network$10/09/04$5 The Sims: Makin' Magic Expansion by Electronic Arts
software$MZ Network$10/09/04$1 Ad-Aware SE Personal Edition popular
software$MZ Network$10/09/04$2 Spybot - Search & Destroy popular
software$MZ Network$10/09/04$3 ICQ 4 popular
software$MZ Network$10/09/04$4 WinZip popular
software$MZ Network$10/09/04$5 LimeWire popular

If I used the Rotating Message I'd get all of the releases at the same time on main, with all those symbols, etc.

So, I wanted a script that would find the lines with "software", group them and post them in Main. The same goes for "games" and "movies".

I guess I explained it better.

Thanks in advance,

jiten

bastya_elvtars

...work in progress here with it
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

I hope this is what you long for :P

-- FreshStuff v.3.3 
-- original idea/script by chilla
-- completely rewriten by plop
-- if you were running 3.0 then you gotta delete the old file
-- it's incompatible with this version
-- deleting now goes by id number
-- msg rotator added by bastya_elvtars (the rock n' roll doctor) - 16. 10. 04.

Times={ -- ["time in 24h format"]="type",

["18:00"]="movie",

["20:00"]="music",

["15:15"]="game"

}
-- Name the commands to what U like 
-- This command adds stuff, syntax : +addalbum TYPE/CATAGORY THESTUFF2ADD 
cmd1 = "+addalbum" 

-- This command shows the stuff, syntax : +albums with options new/game/warez/music/movie
cmd2 = "+albums" 

-- This command deletes an entry, syntax : +delalbum THESTUFF2DELETE 
cmd3 = "+delalbum" 

-- This command shows the latest stuff, syntax : +newalbums
cmd4 = "+newalbums"

-- This command reloads the txt file. syntax : +reloadalbums 
-- (this command is needed if you manualy edit the text file)
cmd5 = "+reloadalbums"

-- Show latest stuff on entry 1=yes, 0=no
ShowOnEntry = 0

-- Max stuff shown on newalbums/entry
MaxNew = 20

-- The file storing the stuff
file = "txt/AlbumsAll.txt"

-- Name of the bot
Bot = "post-it_memo"

-- you can add catagory's yourself ["trigger_name"]="catagory_name"
Types = {["movie"] = "Movies", ["music"]="Music", ["warez"]="Warez", ["game"]="Games"}

--------------------- don't change anything below here
AllStuff = {}
NewestStuff = {}

function Main() 
   frmHub:RegBot(Bot)
   ReloadRel()
   SetTimer(60000)
   StartTimer()
end

function NewUserConnected(user) 
   if ShowOnEntry == 1 then
      user:SendPM(Bot, MsgNew.."|")
   end
end 

function OpConnected(user) 
   if ShowOnEntry == 1 then
      user:SendPM(Bot, MsgNew.."|")
   end
end 

function DataArrival(user,data) 
   if (strsub(data, 1, 1) == "<") then 
      data = strsub(data,1,strlen(data)-1) 
      s,e,cmd,type,tune = strfind(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)")
      if cmd == cmd2 then
         if type == "" then
            user:SendPM(Bot, MsgAll.."|")
         elseif type == "new" then
            user:SendPM(Bot, MsgNew.."|")
         elseif Types[type] then
            ShowRelType(type)
            user:SendPM(Bot, MsgType.."|")
         end
         return 1
      elseif cmd == cmd4 then
         user:SendPM(Bot, MsgNew.."|")
         return 1
      elseif user.bOperator then
         if cmd == cmd3 then
            if type ~= "" then
               DelRel(user, type)
            else
               user:SendData(Bot, "yea right, like i know what i got 2 delete when you don't tell me!|")
            end
            return 1
         elseif cmd == cmd1 then
            if tune ~= "" and Types[type] then
               AddRel(user, tune, type)
            elseif Types[type] == nil then
               user:SendData(Bot, "I need to know the catagory to add it to!|")
            else
               user:SendData(Bot, "yea right, like i know what you got 2 add when you don't tell me!|")
            end
            return 1
         elseif cmd == cmd5 then
            Reload()
            user:SendData(Bot, "Albums reloaded!|")
            return 1
         end
      end
   end
end

function OpenRel()
   AllStuff = nil
   NewestStuff = nil
   AllStuff = {}
   NewestStuff = {}
   Count = 0
   Count2 = 0
   readfrom(file)
   while 1 do
      local line = read() 
      if ( line == nil ) then 
         break 
      else 
         Count = Count +1
         AllStuff[Count]=line
      end
   end
   readfrom()
   if Count > MaxNew then
      local temp = Count - MaxNew + 1
      for i=temp, Count do
         Count2 = Count2 + 1
         NewestStuff[Count2]=AllStuff[i]
      end
   else
      for i=1, Count do
         Count2 = Count2 + 1
         NewestStuff[Count2]=AllStuff[i]
      end
   end
end

function ShowRel(table)
   Msg = "\r\n"
   if table == NewestStuff then
      if Count2 == 0 then 
         MsgNew = "\r\n\r\n".." --------- The Latest Releases -------- \r\n\r\n  No releases on the list yet\r\n\r\n --------- The Latest Releases -------- \r\n\r\n"
      else
         for i=1, Count2 do
            s,e,type,who,when,title=strfind(NewestStuff[i], "(.+)$(.+)$(.+)$(.+)")
            if title then
               Msg = Msg.."  "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"
            else
               Msg = Msg..NewestStuff[i].."\r\n"
            end
         end
         MsgNew = "\r\n\r\n".." --------- The Latest "..MaxNew.." Releases -------- "..Msg.."\r\n --------- The Latest "..MaxNew.."  Releases -------- \r\n\r\n"
      end
   else
      if Count == 0 then
         MsgAll = "\r\n\r\r\n".." --------- All The Releases -------- \r\n\r\n  No releases on the list yet\r\n\r\n --------- All The Releases -------- \r\n\r\n"
      else
         MsgHelp = "  use "..cmd2.."  to see only the selected types"
         for i=1, Count do
            s,e,type,who,when,title=strfind(AllStuff[i], "(.+)$(.+)$(.+)$(.+)")
            if title then
               Msg = Msg.."  ID: "..i.." -- "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"
            else
               Msg = Msg..AllStuff[i].."\r\n"
            end
         end
         MsgAll = "\r\n\r\r\n".." --------- All The Releases -------- "..Msg.."\r\n --------- All The Releases -------- \r\n"..MsgHelp.."\r\n"
      end
   end
end

function ShowRelType(what)
   Msg = "\r\n"
   tmp = 0
   if Count == 0 then
      MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
   else
      for i=1, Count do
         s,e,type,who,when,title=strfind(AllStuff[i], "(.+)$(.+)$(.+)$(.+)")
         if type == what then
            tmp = tmp + 1
            Msg = Msg.."  "..when.." -- "..who.." -- "..title.."\r\n"
         end
      end
      if tmp == 0 then
         MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
      else
         MsgType= "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n"..Msg.."\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
      end
   end
end

function AddRel(user, what, type)
   Count = Count + 1
   AllStuff[Count]=(type.."$"..user.sName.."$"..date("%x").."$"..what)
   user:SendData(Bot, what.." is added to the releases as "..type.."|")
   SaveRel()
   ReloadRel()
end

function DelRel(user, what)
   if tonumber(what) then 
      what = tonumber(what)
      if AllStuff[what] then
         local s,e,which=strfind(AllStuff[what], "([^%$]+)$")
         user:SendData(Bot, which.." is deleted from the releases|")
         AllStuff[what]=nil
         SaveRel()
         ReloadRel()
      else
         user:SendData(Bot, what.." wasn't found in the releases|")
      end
   else
      user:SendData(Bot, "I need the ID number to delete a releas|")
   end
end

function SaveRel()
   writeto(file)
   for i=1,Count do
      if AllStuff[i] then
         write(AllStuff[i].."\n")
      end
   end
   writeto()
end

function ReloadRel()
   OpenRel()
   ShowRel(NewestStuff)
   ShowRel(AllStuff)
end

function DelRelOld(user, what)
   Okie = nil
   for a,b in AllStuff do
      s,e,title=strfind(b, ".+$(.+)$")
      if title == what then
         AllStuff[a]=nil
         user:SendData(Bot, what.." is removed from the releases|")
         Okie = 1
         break
      end
   end
   if Okie then
      SaveRel()
      ReloadRel()
   else
      user:SendData(Bot, what.." wasn't found in the releases|")
   end
end


function RotateMsg(what)
   local Msg = "\r\n"
   local MsgType
   tmp = 0
   if Count == 0 then
      MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
   else
      for i=1, Count do
         s,e,type,who,when,title=strfind(AllStuff[i], "(.+)$(.+)$(.+)$(.+)")
         if type == what then
            tmp = tmp + 1
            Msg = Msg.."  "..when.." -- "..who.." -- "..title.."\r\n"
         end
      end
      if tmp == 0 then
         MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
      else
         MsgType= "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n"..Msg.."\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
      end
   end
   return MsgType
end

function OnTimer()
   if Times[date("%H:%M")] then
	SendToAll(RotateMsg(Times[date("%H:%M")]))
   end
end
Everything could have been anything else and it would have just as much meaning.

jiten

thanks bastya_elvtars!  :D
that's what i was longing for and it worked like a charm, after editing some parts of it.

jiten

bastya_elvtars

QuoteOriginally posted by jiten
thanks bastya_elvtars!  :D
that's what i was longing for and it worked like a charm, after editing some parts of it.

jiten

you are always welcome

btw the table was just a test one
Everything could have been anything else and it would have just as much meaning.

Boostland

Thanks for a great mod to a great script.
I wanted users in a small ip filtered hub to be able to add and delete items in it so I changed a few things.

-- FreshStuff v.3.3 
-- original idea/script by chilla
-- completely rewriten by plop
-- if you were running 3.0 then you gotta delete the old file
-- it's incompatible with this version
-- deleting now goes by id number
-- msg rotator added by bastya_elvtars (the rock n' roll doctor) - 16. 10. 04.
-- allow users to add & remove, send to main chat and show to all users the users name that adds and deletes items. added by Boostland 9.11.04 (with some help from Snooze)

Times={ -- ["time in 24h format"]="type",

["6:00"]="movie",

["9:00"]="music",

["12:00"]="game",

["15:00"]="warez",

["18:00"]="docco",

["21:00"]="tv",
}
-- Name the commands to what U like 
-- This command adds stuff, syntax : !add TYPE/CATAGORY THESTUFF2ADD 
cmd1 = "!add" 

-- This command shows the stuff, syntax : !read with options new/game/warez/music/movie/docco/tv
cmd2 = "!read" 

-- This command deletes an entry, syntax : !del THESTUFF2DELETE 
cmd3 = "!del" 

-- This command shows the latest stuff, syntax : !new
cmd4 = "!new"

-- This command reloads the txt file. syntax : !reload 
-- (this command is needed if you manualy edit the text file)
cmd5 = "!reload"

-- Show latest stuff on entry 1=yes, 0=no
ShowOnEntry = 1

-- Max stuff shown on newalbums/entry
MaxNew = 10

-- The file storing the stuff
file = "txt/AlbumsAll.txt"

-- Name of the bot
Bot = "?post-it_memo?"

-- you can add catagory's yourself ["trigger_name"]="catagory_name"
Types = {["movie"] = "Movies", ["docco"] = "Docco's", ["tv"] = "Tv", ["music"]="Music", ["warez"]="Warez", ["game"]="Games"}

--------------------- don't change anything below here
AllStuff = {}
NewestStuff = {}

function Main() 
   frmHub:RegBot(Bot)
   ReloadRel()
   SetTimer(60000)
   StartTimer()
end

function NewUserConnected(user) 
   if ShowOnEntry == 1 then
      user:SendData(Bot, MsgNew.."|")
   end
end 

function OpConnected(user) 
   if ShowOnEntry == 1 then
      user:SendData(Bot, MsgNew.."|")
   end
end 

function DataArrival(user,data) 
   if (strsub(data, 1, 1) == "<") then 
      data = strsub(data,1,strlen(data)-1) 
      s,e,cmd,type,tune = strfind(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)")
      if cmd == cmd2 then
         if type == "" then
            user:SendData(Bot, MsgAll.."|")
         elseif type == "new" then
            user:SendData(Bot, MsgNew.."|")
         elseif Types[type] then
            ShowRelType(type)
            user:SendData(Bot, MsgType.."|")
         end
         return 1
      elseif cmd == cmd4 then
         user:SendData(Bot, MsgNew.."|")
         return 1
         elseif cmd == cmd3 then
            if type ~= "" then
               DelRel(user, type)
            else
               user:SendData(Bot, "yea right, like i know what i got 2 delete when you don't tell me! syntax : !del number of the entry you want deleted|")
            end
            return 1
         elseif cmd == cmd1 then
            if tune ~= "" and Types[type] then
               AddRel(user, tune, type)
            elseif Types[type] == nil then
               user:SendData(Bot, "I need to know the catagory to add it to! syntax : !add TYPE/CATAGORY THESTUFF2ADD|")
            else
               user:SendData(Bot, "yea right, like i know what you got 2 add when you don't tell me! syntax : !add TYPE/CATAGORY THESTUFF2ADD|")
            end
            return 1
         elseif cmd == cmd5 then
            Reload()
            user:SendData(Bot, "Albums reloaded!|")
            return 1
         end
   end
end

function OpenRel()
   AllStuff = nil
   NewestStuff = nil
   AllStuff = {}
   NewestStuff = {}
   Count = 0
   Count2 = 0
   readfrom(file)
   while 1 do
      local line = read() 
      if ( line == nil ) then 
         break 
      else 
         Count = Count +1
         AllStuff[Count]=line
      end
   end
   readfrom()
   if Count > MaxNew then
      local temp = Count - MaxNew + 1
      for i=temp, Count do
         Count2 = Count2 + 1
         NewestStuff[Count2]=AllStuff[i]
      end
   else
      for i=1, Count do
         Count2 = Count2 + 1
         NewestStuff[Count2]=AllStuff[i]
      end
   end
end

function ShowRel(table)
   Msg = "\r\n"
   if table == NewestStuff then
      if Count2 == 0 then 
         MsgNew = "\r\n\r\n".." --------- The Latest Releases -------- \r\n\r\n  No releases on the list yet\r\n\r\n --------- The Latest Releases -------- \r\n\r\n"
      else
         for i=1, Count2 do
            s,e,type,who,when,title=strfind(NewestStuff[i], "(.+)$(.+)$(.+)$(.+)")
            if title then
               Msg = Msg.."  "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"
            else
               Msg = Msg..NewestStuff[i].."\r\n"
            end
         end
         MsgNew = "\r\n\r\n".." --------- The Latest "..MaxNew.." Releases -------- "..Msg.."\r\n --------- The Latest "..MaxNew.."  Releases -------- \r\n\r\n"
      end
   else
      if Count == 0 then
         MsgAll = "\r\n\r\r\n".." --------- All The Releases -------- \r\n\r\n  No releases on the list yet\r\n\r\n --------- All The Releases -------- \r\n\r\n"
      else
         MsgHelp = "  use "..cmd2.."  to see only the selected types"
         for i=1, Count do
            s,e,type,who,when,title=strfind(AllStuff[i], "(.+)$(.+)$(.+)$(.+)")
            if title then
               Msg = Msg.."  ID: "..i.." -- "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"
            else
               Msg = Msg..AllStuff[i].."\r\n"
            end
         end
         MsgAll = "\r\n\r\r\n".." --------- All The Releases -------- "..Msg.."\r\n --------- All The Releases -------- \r\n"..MsgHelp.."\r\n"
      end
   end
end

function ShowRelType(what)
   Msg = "\r\n"
   tmp = 0
   if Count == 0 then
      MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
   else
      for i=1, Count do
         s,e,type,who,when,title=strfind(AllStuff[i], "(.+)$(.+)$(.+)$(.+)")
         if type == what then
            tmp = tmp + 1
            Msg = Msg.."  "..when.." -- "..who.." -- "..title.."\r\n"
         end
      end
      if tmp == 0 then
         MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
      else
         MsgType= "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n"..Msg.."\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
      end
   end
end

function AddRel(user, what, type)
   Count = Count + 1
   AllStuff[Count]=(type.."$"..user.sName.."$"..date("%x").."$"..what)
   SendToAll(Bot, what.." is added to the releases by "..user.sName.." as "..type.."|")
   SaveRel()
   ReloadRel()
end

function DelRel(user, what)
   if tonumber(what) then 
      what = tonumber(what)
      if AllStuff[what] then
         local s,e,which=strfind(AllStuff[what], "([^%$]+)$")
         SendToAll(Bot, which.." was deleted from the releases by "..user.sName.."|")
         AllStuff[what]=nil
         SaveRel()
         ReloadRel()
      else
         user:SendData(Bot, what.." wasn't found in the releases|")
      end
   else
      user:SendData(Bot, "I need the ID number to delete a release|")
   end
end

function SaveRel()
   writeto(file)
   for i=1,Count do
      if AllStuff[i] then
         write(AllStuff[i].."\n")
      end
   end
   writeto()
end

function ReloadRel()
   OpenRel()
   ShowRel(NewestStuff)
   ShowRel(AllStuff)
end

function DelRelOld(user, what)
   Okie = nil
   for a,b in AllStuff do
      s,e,title=strfind(b, ".+$(.+)$")
      if title == what then
         AllStuff[a]=nil
         user:SendData(Bot, what.." is removed from the releases|")
         Okie = 1
         break
      end
   end
   if Okie then
      SaveRel()
      ReloadRel()
   else
      user:SendData(Bot, what.." wasn't found in the releases|")
   end
end


function RotateMsg(what)
   local Msg = "\r\n"
   local MsgType
   tmp = 0
   if Count == 0 then
      MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
   else
      for i=1, Count do
         s,e,type,who,when,title=strfind(AllStuff[i], "(.+)$(.+)$(.+)$(.+)")
         if type == what then
            tmp = tmp + 1
            Msg = Msg.."  "..when.." -- "..who.." -- "..title.."\r\n"
         end
      end
      if tmp == 0 then
         MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
      else
         MsgType= "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n"..Msg.."\r\n --------- All The "..Types[what].." -------- \r\n\r\n"
      end
   end
   return MsgType
end

function OnTimer()
   if Times[date("%H:%M")] then
	SendToAll(RotateMsg(Times[date("%H:%M")]))
   end
end

Stt

Well ive tried to edit this script as i want it 2 display but sadly it dsnt run dunno why im runin ptocax 16.09 and it givs an error lik

finished scripts\scripts\rel.lua:250: attempt to call global `readfrom' (a nil value)

Here is the script

-- FreshStuff v.3.3

-- original idea/script by chilla

-- completely rewriten by plop

-- if you were running 3.0 then you gotta delete the old file

-- it's incompatible with this version

-- deleting now goes by id number

-- msg rotator added by bastya_elvtars (the rock n' roll doctor) - 16. 10. 04.

-- allow users to add & remove, send to main chat and show to all users the users name that adds and deletes items. added by Boostland 9.11.04 (with some help from Snooze)



Times={ -- ["time in 24h format"]="type",



["6:00"]="cinemas",



["9:00"]="destaques",



["12:00"]="eventos",



["15:00"]="fotologs",



["18:00"]="publicidades",




}

-- Name the commands to what U like

-- This command adds stuff, syntax : !add TYPE/CATAGORY THESTUFF2ADD

cmd1 = "!add"


-- This command shows the stuff, syntax : !read with options new/game/warez/music/movie/docco/tv

cmd2 = "!read"


-- This command deletes an entry, syntax : !del THESTUFF2DELETE

cmd3 = "!del"


-- This command shows the latest stuff, syntax : !new

cmd4 = "!new"



-- This command reloads the txt file. syntax : !reload

-- (this command is needed if you manualy edit the text file)

cmd5 = "!reload"



-- Show latest stuff on entry 1=yes, 0=no

ShowOnEntry = 1



-- Max stuff shown on newalbums/entry

MaxNew = 10



-- The file storing the stuff

file = "txt/AlbumsAll.txt"



-- Name of the bot

Bot = "!'GeNi??'!?"



-- you can add catagory's yourself ["trigger_name"]="catagory_name"

Types = {["cinemas"] = "Cinemas", ["destaques"] = "Destaques", ["eventos"] = "Eventos", ["fotologs"]="Fotologs", ["publicidades"]="Publicidades"}



--------------------- don't change anything below here

AllStuff = {}

NewestStuff = {}



function Main()

   frmHub:RegBot(Bot)

   ReloadRel()

   SetTimer(60000)

   StartTimer()

end



function NewUserConnected(user)

   if ShowOnEntry == 1 then

      user:SendData(Bot, MsgNew.."|")

   end

end



function OpConnected(user)

   if ShowOnEntry == 1 then

      user:SendData(Bot, MsgNew.."|")

   end

end



function DataArrival(user,data)

   if (strsub(data, 1, 1) == "<") then

      data = strsub(data,1,strlen(data)-1)

      s,e,cmd,type,tune = strfind(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)")

      if cmd == cmd2 then

         if type == "" then

            user:SendData(Bot, MsgAll.."|")

         elseif type == "new" then

            user:SendData(Bot, MsgNew.."|")

         elseif Types[type] then

            ShowRelType(type)

            user:SendData(Bot, MsgType.."|")

         end

         return 1

      elseif cmd == cmd4 then

         user:SendData(Bot, MsgNew.."|")

         return 1

         elseif cmd == cmd3 then

            if type ~= "" then

               DelRel(user, type)

            else

               user:SendData(Bot, "Como Se Eu Soubesse O Que ? Para Apagar!!! Syntaxe : !del n?mero de entrada cujo deseja apagar|")

            end

            return 1

         elseif cmd == cmd1 then

            if tune ~= "" and Types[type] then

               AddRel(user, tune, type)

            elseif Types[type] == nil then

               user:SendData(Bot, "Tenho Que Saber A Categoria A Adiciona-lo! Syntaxe : !add TYPE/CATAGORY THESTUFF2ADD|")

            else

               user:SendData(Bot, "yea right, like i know what you got 2 add when you don't tell me! syntax : !add TYPE/CATAGORY THESTUFF2ADD|")

            end

            return 1

         elseif cmd == cmd5 then

            Reload()

            user:SendData(Bot, "Albums reloaded!|")

            return 1

         end

   end

end



function OpenRel()

   AllStuff = nil

   NewestStuff = nil

   AllStuff = {}

   NewestStuff = {}

   Count = 0

   Count2 = 0

   readfrom(file)

   while 1 do

      local line = read()

      if ( line == nil ) then

         break

      else

         Count = Count +1

         AllStuff[Count]=line

      end

   end

   readfrom()

   if Count > MaxNew then

      local temp = Count - MaxNew + 1

      for i=temp, Count do

         Count2 = Count2 + 1

         NewestStuff[Count2]=AllStuff

      end

   else

      for i=1, Count do

         Count2 = Count2 + 1

         NewestStuff[Count2]=AllStuff

      end

   end

end



function ShowRel(table)

   Msg = "\r\n"

   if table == NewestStuff then

      if Count2 == 0 then

         MsgNew = "\r\n\r\n".." _____________________________________________________________________________________________________  \r\n\r\n  Quem Quiser Publicitar Neste Espa?o Fale Com Os Operadores Ou Vip's\r\n\r\n _____________________________________________________________________________________________________  \r\n\r\n"

      else

         for i=1, Count2 do

            s,e,type,who,when,title=strfind(NewestStuff, "(.+)$(.+)$(.+)$(.+)")

            if title then

               Msg = Msg.."  "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"

            else

               Msg = Msg..NewestStuff.."\r\n"

            end

         end

         MsgNew = "\r\n\r\n".." _____________________________________________________________________________________________________  "..Msg.."\r\n _____________________________________________________________________________________________________  \r\n\r\n"

      end

   else

      if Count == 0 then

         MsgAll = "\r\n\r\r\n".." _____________________________________________________________________________________________________ \r\n\r\n  No releases on the list yet\r\n\r\n _____________________________________________________________________________________________________ \r\n\r\n"

      else

         MsgHelp = "  use "..cmd2.."
         for a,b in Types do

            MsgHelp = MsgHelp.."/"..a

         end

         MsgHelp = MsgHelp.."> to see only the selected types"

         for i=1, Count do

            s,e,type,who,when,title=strfind(AllStuff, "(.+)$(.+)$(.+)$(.+)")

            if title then

               Msg = Msg.." ? ID: "..i.." -- "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"

            else

               Msg = Msg..AllStuff.."\r\n"

            end

         end

         MsgAll = "\r\n\r\r\n".." _____________________________________________________________________________________________________ "..Msg.."\r\n _____________________________________________________________________________________________________ \r\n"..MsgHelp.."\r\n"

      end

   end

end



function ShowRelType(what)

   Msg = "\r\n"

   tmp = 0

   if Count == 0 then

      MsgType = "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________  \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________    \r\n\r\n"

   else

      for i=1, Count do

         s,e,type,who,when,title=strfind(AllStuff, "(.+)$(.+)$(.+)$(.+)")

         if type == what then

            tmp = tmp + 1

            Msg = Msg.."  "..when.." -- "..who.." -- "..title.."\r\n"

         end

      end

      if tmp == 0 then

         MsgType = "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________ \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________  \r\n\r\n"

      else

         MsgType= "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________ \r\n"..Msg.."\r\n _____________________________________________________________________________________________________  \r\n\r\n"

      end

   end

end



function AddRel(user, what, type)

   Count = Count + 1

   AllStuff[Count]=(type.."$"..user.sName.."$"..date("%x").."$"..what)

   SendToAll(Bot, what.." Foi Adicionado Por "..user.sName.." A Lista De "..type.."|")

   SaveRel()

   ReloadRel()

end



function DelRel(user, what)

   if tonumber(what) then

      what = tonumber(what)

      if AllStuff[what] then

         local s,e,which=strfind(AllStuff[what], "([^%$]+)$")

         SendToAll(Bot, which.." Foi Apagado Da Lista Por "..user.sName.."|")

         AllStuff[what]=nil

         SaveRel()

         ReloadRel()

      else

         user:SendData(Bot, what.." n?o foi Encontrado Na Lista|")

      end

   else

      user:SendData(Bot, "Preciso Do Numero De ID Para Poder Apaga-lo|")

   end

end



function SaveRel()

   writeto(file)

   for i=1,Count do

      if AllStuff then

         write(AllStuff.."\n")

      end

   end

   writeto()

end



function ReloadRel()

   OpenRel()

   ShowRel(NewestStuff)

   ShowRel(AllStuff)

end



function DelRelOld(user, what)

   Okie = nil

   for a,b in AllStuff do

      s,e,title=strfind(b, ".+$(.+)$")

      if title == what then

         AllStuff[a]=nil

         user:SendData(Bot, what.." foi apado da lista|")

         Okie = 1

         break

      end

   end

   if Okie then

      SaveRel()

      ReloadRel()

   else

      user:SendData(Bot, what.." n?o foi encontrado na lista de releases|")

   end

end





function RotateMsg(what)

   local Msg = "\r\n"

   local MsgType

   tmp = 0

   if Count == 0 then

      MsgType = "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________  \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________    \r\n\r\n"

   else

      for i=1, Count do

         s,e,type,who,when,title=strfind(AllStuff, "(.+)$(.+)$(.+)$(.+)")

         if type == what then

            tmp = tmp + 1

            Msg = Msg.."  "..when.." -- "..who.." -- "..title.."\r\n"

         end

      end

      if tmp == 0 then

         MsgType = "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________  \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________    \r\n\r\n"
      else

         MsgType= "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________  \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________    \r\n\r\n"

      end

   end

   return MsgType

end



function OnTimer()

   if Times[date("%H:%M")] then

   SendToAll(RotateMsg(Times[date("%H:%M")]))

   end

end

hollas..

Stt

Well ive tried to edit this script as i want it 2 display but sadly it dsnt run dunno why im runin ptocax 16.09 and it givs an error lik

finished scripts\scripts\rel.lua:250: attempt to call global `readfrom' (a nil value)

Here is the script

-- FreshStuff v.3.3

-- original idea/script by chilla

-- completely rewriten by plop

-- if you were running 3.0 then you gotta delete the old file

-- it's incompatible with this version

-- deleting now goes by id number

-- msg rotator added by bastya_elvtars (the rock n' roll doctor) - 16. 10. 04.

-- allow users to add & remove, send to main chat and show to all users the users name that adds and deletes items. added by Boostland 9.11.04 (with some help from Snooze)



Times={ -- ["time in 24h format"]="type",



["6:00"]="cinemas",



["9:00"]="destaques",



["12:00"]="eventos",



["15:00"]="fotologs",



["18:00"]="publicidades",




}

-- Name the commands to what U like

-- This command adds stuff, syntax : !add TYPE/CATAGORY THESTUFF2ADD

cmd1 = "!add"


-- This command shows the stuff, syntax : !read with options new/game/warez/music/movie/docco/tv

cmd2 = "!read"


-- This command deletes an entry, syntax : !del THESTUFF2DELETE

cmd3 = "!del"


-- This command shows the latest stuff, syntax : !new

cmd4 = "!new"



-- This command reloads the txt file. syntax : !reload

-- (this command is needed if you manualy edit the text file)

cmd5 = "!reload"



-- Show latest stuff on entry 1=yes, 0=no

ShowOnEntry = 1



-- Max stuff shown on newalbums/entry

MaxNew = 10



-- The file storing the stuff

file = "txt/AlbumsAll.txt"



-- Name of the bot

Bot = "!'GeNi??'!?"



-- you can add catagory's yourself ["trigger_name"]="catagory_name"

Types = {["cinemas"] = "Cinemas", ["destaques"] = "Destaques", ["eventos"] = "Eventos", ["fotologs"]="Fotologs", ["publicidades"]="Publicidades"}



--------------------- don't change anything below here

AllStuff = {}

NewestStuff = {}



function Main()

   frmHub:RegBot(Bot)

   ReloadRel()

   SetTimer(60000)

   StartTimer()

end



function NewUserConnected(user)

   if ShowOnEntry == 1 then

      user:SendData(Bot, MsgNew.."|")

   end

end



function OpConnected(user)

   if ShowOnEntry == 1 then

      user:SendData(Bot, MsgNew.."|")

   end

end



function DataArrival(user,data)

   if (strsub(data, 1, 1) == "<") then

      data = strsub(data,1,strlen(data)-1)

      s,e,cmd,type,tune = strfind(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)")

      if cmd == cmd2 then

         if type == "" then

            user:SendData(Bot, MsgAll.."|")

         elseif type == "new" then

            user:SendData(Bot, MsgNew.."|")

         elseif Types[type] then

            ShowRelType(type)

            user:SendData(Bot, MsgType.."|")

         end

         return 1

      elseif cmd == cmd4 then

         user:SendData(Bot, MsgNew.."|")

         return 1

         elseif cmd == cmd3 then

            if type ~= "" then

               DelRel(user, type)

            else

               user:SendData(Bot, "Como Se Eu Soubesse O Que ? Para Apagar!!! Syntaxe : !del n?mero de entrada cujo deseja apagar|")

            end

            return 1

         elseif cmd == cmd1 then

            if tune ~= "" and Types[type] then

               AddRel(user, tune, type)

            elseif Types[type] == nil then

               user:SendData(Bot, "Tenho Que Saber A Categoria A Adiciona-lo! Syntaxe : !add TYPE/CATAGORY THESTUFF2ADD|")

            else

               user:SendData(Bot, "yea right, like i know what you got 2 add when you don't tell me! syntax : !add TYPE/CATAGORY THESTUFF2ADD|")

            end

            return 1

         elseif cmd == cmd5 then

            Reload()

            user:SendData(Bot, "Albums reloaded!|")

            return 1

         end

   end

end



function OpenRel()

   AllStuff = nil

   NewestStuff = nil

   AllStuff = {}

   NewestStuff = {}

   Count = 0

   Count2 = 0

   readfrom(file)

   while 1 do

      local line = read()

      if ( line == nil ) then

         break

      else

         Count = Count +1

         AllStuff[Count]=line

      end

   end

   readfrom()

   if Count > MaxNew then

      local temp = Count - MaxNew + 1

      for i=temp, Count do

         Count2 = Count2 + 1

         NewestStuff[Count2]=AllStuff

      end

   else

      for i=1, Count do

         Count2 = Count2 + 1

         NewestStuff[Count2]=AllStuff

      end

   end

end



function ShowRel(table)

   Msg = "\r\n"

   if table == NewestStuff then

      if Count2 == 0 then

         MsgNew = "\r\n\r\n".." _____________________________________________________________________________________________________  \r\n\r\n  Quem Quiser Publicitar Neste Espa?o Fale Com Os Operadores Ou Vip's\r\n\r\n _____________________________________________________________________________________________________  \r\n\r\n"

      else

         for i=1, Count2 do

            s,e,type,who,when,title=strfind(NewestStuff, "(.+)$(.+)$(.+)$(.+)")

            if title then

               Msg = Msg.."  "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"

            else

               Msg = Msg..NewestStuff.."\r\n"

            end

         end

         MsgNew = "\r\n\r\n".." _____________________________________________________________________________________________________  "..Msg.."\r\n _____________________________________________________________________________________________________  \r\n\r\n"

      end

   else

      if Count == 0 then

         MsgAll = "\r\n\r\r\n".." _____________________________________________________________________________________________________ \r\n\r\n  No releases on the list yet\r\n\r\n _____________________________________________________________________________________________________ \r\n\r\n"

      else

         MsgHelp = "  use "..cmd2.."
         for a,b in Types do

            MsgHelp = MsgHelp.."/"..a

         end

         MsgHelp = MsgHelp.."> to see only the selected types"

         for i=1, Count do

            s,e,type,who,when,title=strfind(AllStuff, "(.+)$(.+)$(.+)$(.+)")

            if title then

               Msg = Msg.." ? ID: "..i.." -- "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"

            else

               Msg = Msg..AllStuff.."\r\n"

            end

         end

         MsgAll = "\r\n\r\r\n".." _____________________________________________________________________________________________________ "..Msg.."\r\n _____________________________________________________________________________________________________ \r\n"..MsgHelp.."\r\n"

      end

   end

end



function ShowRelType(what)

   Msg = "\r\n"

   tmp = 0

   if Count == 0 then

      MsgType = "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________  \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________    \r\n\r\n"

   else

      for i=1, Count do

         s,e,type,who,when,title=strfind(AllStuff, "(.+)$(.+)$(.+)$(.+)")

         if type == what then

            tmp = tmp + 1

            Msg = Msg.."  "..when.." -- "..who.." -- "..title.."\r\n"

         end

      end

      if tmp == 0 then

         MsgType = "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________ \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________  \r\n\r\n"

      else

         MsgType= "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________ \r\n"..Msg.."\r\n _____________________________________________________________________________________________________  \r\n\r\n"

      end

   end

end



function AddRel(user, what, type)

   Count = Count + 1

   AllStuff[Count]=(type.."$"..user.sName.."$"..date("%x").."$"..what)

   SendToAll(Bot, what.." Foi Adicionado Por "..user.sName.." A Lista De "..type.."|")

   SaveRel()

   ReloadRel()

end



function DelRel(user, what)

   if tonumber(what) then

      what = tonumber(what)

      if AllStuff[what] then

         local s,e,which=strfind(AllStuff[what], "([^%$]+)$")

         SendToAll(Bot, which.." Foi Apagado Da Lista Por "..user.sName.."|")

         AllStuff[what]=nil

         SaveRel()

         ReloadRel()

      else

         user:SendData(Bot, what.." n?o foi Encontrado Na Lista|")

      end

   else

      user:SendData(Bot, "Preciso Do Numero De ID Para Poder Apaga-lo|")

   end

end



function SaveRel()

   writeto(file)

   for i=1,Count do

      if AllStuff then

         write(AllStuff.."\n")

      end

   end

   writeto()

end



function ReloadRel()

   OpenRel()

   ShowRel(NewestStuff)

   ShowRel(AllStuff)

end



function DelRelOld(user, what)

   Okie = nil

   for a,b in AllStuff do

      s,e,title=strfind(b, ".+$(.+)$")

      if title == what then

         AllStuff[a]=nil

         user:SendData(Bot, what.." foi apado da lista|")

         Okie = 1

         break

      end

   end

   if Okie then

      SaveRel()

      ReloadRel()

   else

      user:SendData(Bot, what.." n?o foi encontrado na lista de releases|")

   end

end





function RotateMsg(what)

   local Msg = "\r\n"

   local MsgType

   tmp = 0

   if Count == 0 then

      MsgType = "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________  \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________    \r\n\r\n"

   else

      for i=1, Count do

         s,e,type,who,when,title=strfind(AllStuff, "(.+)$(.+)$(.+)$(.+)")

         if type == what then

            tmp = tmp + 1

            Msg = Msg.."  "..when.." -- "..who.." -- "..title.."\r\n"

         end

      end

      if tmp == 0 then

         MsgType = "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________  \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________    \r\n\r\n"
      else

         MsgType= "\r\n\r\n".." _____________________________________????? "..Types[what].." ?????? _________________________________________  \r\n\r\n  No "..strlower(Types[what]).." yet\r\n\r\n _____________________________________________________________________________________________________    \r\n\r\n"

      end

   end

   return MsgType

end



function OnTimer()

   if Times[date("%H:%M")] then

   SendToAll(RotateMsg(Times[date("%H:%M")]))

   end

end

hollas..

bastya_elvtars

This will be added to freshstuff 3 soon, so you don't have to convert. :)
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk