PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Jorgo on 28 February, 2005, 13:02:49

Title: Freshstuff 2.59 by chilla
Post by: Jorgo on 28 February, 2005, 13:02:49
Yeah, I know this version is a bit dusty, but actually I like it better for my purposes because it's straightforward in the commands, without subcategories and config is in external files.

It can be found in plop's archive, I can't post the code here because it exceeds the message length.
Please PM me if you want me to send it to you (size is 20kb).

I thank you in advance for your time!
Title:
Post by: QuikThinker on 28 February, 2005, 16:53:33
I need Fresh 3.3 converted if any1'a willing?  ?(
Title:
Post by: Jorgo on 28 February, 2005, 17:03:38
Hey, no thread hijacking, there's enough space for everyone to make their own thread   8o
Title:
Post by: plop on 28 February, 2005, 17:07:37
QuoteOriginally posted by Jorgo
Yeah, I know this version is a bit dusty, but actually I like it better for my purposes because it's straightforward in the commands, without subcategories and config is in external files.

It can be found in plop's archive, I can't post the code here because it exceeds the message length.
Please PM me if you want me to send it to you (size is 20kb).

I thank you in advance for your time!

post a link 2 the script, this safes a bit of work and time.

plop
Title:
Post by: Jorgo on 28 February, 2005, 17:23:44
QuoteOriginally posted by plop
post a link 2 the script, this safes a bit of work and time.
plop

Doh! I could have thought of that *slaps forehead

Freshstuff 2.59 (http://www.plop.nl/ptokaxbots/Chilla/FreshStuff-v2.59.rar)

Here you are, Sir! Thanks again  :))
Title:
Post by: QuikThinker on 01 March, 2005, 00:12:50
LOL Jorgo ur ma fave LUA user!  :D
Title:
Post by: Jorgo on 02 March, 2005, 19:28:13
This is the last script I'd need to switch to ptokax.lua5... anything I can do to help you, plop?
Title:
Post by: bastya_elvtars on 02 March, 2005, 19:47:47
FreshStuff 3.4 in LUA5, tested and works so far. If not, please report.

-- FreshStuff v.3.4
-- 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
-- anounces the new releas in mainchat
---------
-- converted to lua5 by bastya_elvtars
---------

-- 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()
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 ChatArrival(user,data)
      data = string.sub(data,1,string.len(data)-1)
      s,e,cmd,type,tune = string.find(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


function OpenRel()
   AllStuff = nil
   NewestStuff = nil
   AllStuff = {}
   NewestStuff = {}
   Count = 0
   Count2 = 0
local f = io.open(file,"r")
if f then
while 1 do
local line = f:read("*l")
if line ==  nil then
break
else
Count = Count +1
AllStuff[Count]=line
end
end
f:close(f)
end
   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=string.find(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.."          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=string.find(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=string.find(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.."$"..os.date("%x").."$"..what)
   user:SendData(Bot, what.." is added to the releases as "..type.."|")
   SendToAll(Bot, user.sName.." added to the "..type.." releases: "..what.."|")
   SaveRel()
   ReloadRel()
end

function DelRel(user, what)
   if tonumber(what) then
      what = tonumber(what)
      if AllStuff[what] then
         local s,e,which=string.find(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()
   local f= io.open(file,"w+")
   for i=1,Count do
      if AllStuff[i] then
         f:write(AllStuff[i].."\n")
      end
   end
   f:flush()
   f:close(f)
end

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

function DelRelOld(user, what)
   Okie = nil
   for a,b in AllStuff do
      s,e,title=string.find(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
Title:
Post by: Jorgo on 02 March, 2005, 19:58:16
Thank you!

Unfortunately, the tables of 2.59 and this version are not compatible, so I'd have to copy and paste hundreds of items one by one. That wouldn't be a problem, however, 2.59, despite its lower version number, is more powerful. It has searching, rating and some statistics.

I'd be really grateful if someone could look through it. Thanks again!
Title:
Post by: bastya_elvtars on 02 March, 2005, 20:04:42
QuoteOriginally posted by Jorgo
Thank you!

Unfortunately, the tables of 2.59 and this version are not compatible, so I'd have to copy and paste hundreds of items one by one. That wouldn't be a problem, however, 2.59, despite its lower version number, is more powerful. It has searching, rating and some statistics.

I'd be really grateful if someone could look through it. Thanks again!

OK, sorry, i knew 3.4 better as i integrated it to lawmaker and rewrote 2x on request. However, I will look into 2.59 as i never tried that 1. If it is better, I will even integrate it. (Sorry plop.  ;( )
Title:
Post by: Jorgo on 06 March, 2005, 20:44:24
"Oh Lord, won'tcha buy me a freshstuff converts,
my friends all drive ptokax, I must make amends..."

:-)
Title:
Post by: uffetjur on 07 March, 2005, 00:30:36
looks as only ops can add stuffs in bastya_elvtars version of 3.4
I do want regged users to be able to add stuffs to
Title:
Post by: QuikThinker on 07 March, 2005, 17:43:20
bastya I've tried ur converted version as it's the one I needed converting anyway but this one don't open in it's own window, any ideas why?
Title:
Post by: bastya_elvtars on 07 March, 2005, 18:21:33
Dunno what can be wrong. Gonna take a deeper look but first gotta finish with lawmaker.
Title: Doesn't work for me
Post by: JustABitch on 09 March, 2005, 17:45:26
I get this error message when i try to start freshstuff 2.59: Syntax ...\0.3.3.0.b16.05.nt.dgb\scripts\FreshStuff-V.2.59.lua:15: Fresh-Files/FreshStuff.ini  for  FreshStuff-V.2.59.lua  not found

The freshstuff.ini file is in the Fresh-files folder, so i cant understand this. Anyone knows what the problem is?

Thx in advance //JAB
Title:
Post by: Jorgo on 09 March, 2005, 23:59:16
Do you already have freshstuff 2.59 for lua5?? I haven't seen anyone here post it. If it's the old one, it won't work.

May I use this occasion to reiterate my plea for conversion of this great script? Sorry to be a pain   ;(
Title: My fault
Post by: JustABitch on 10 March, 2005, 06:59:37
i looked, and of course its the old one......thought the link above pointed at a new version...silly me  ;)

So i'll just have to hang around and wait to see if somebody wants to give it a go and convert it....i sure like it.......

//JAB
Title: Freshstuff 2.60 ...
Post by: JustABitch on 11 March, 2005, 07:16:55
a converted version of 2.59 is available under "Finished scripts".....LightNicht has done the work!! =)

//JAB