Freshstuff 2.59 by chilla
 

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

Freshstuff 2.59 by chilla

Started by Jorgo, 28 February, 2005, 13:02:49

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

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!

QuikThinker

I need Fresh 3.3 converted if any1'a willing?  ?(

Jorgo

Hey, no thread hijacking, there's enough space for everyone to make their own thread   8o

plop

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
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 <----<<

Jorgo

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

Here you are, Sir! Thanks again  :))

QuikThinker

LOL Jorgo ur ma fave LUA user!  :D

Jorgo

This is the last script I'd need to switch to ptokax.lua5... anything I can do to help you, plop?

bastya_elvtars

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.."  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
Everything could have been anything else and it would have just as much meaning.

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!

bastya_elvtars

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.  ;( )
Everything could have been anything else and it would have just as much meaning.

Jorgo

"Oh Lord, won'tcha buy me a freshstuff converts,
my friends all drive ptokax, I must make amends..."

:-)

uffetjur

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
Somewhere in Cyberspace

QuikThinker

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?

bastya_elvtars

Dunno what can be wrong. Gonna take a deeper look but first gotta finish with lawmaker.
Everything could have been anything else and it would have just as much meaning.

JustABitch

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

Jorgo

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   ;(

JustABitch

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

JustABitch

a converted version of 2.59 is available under "Finished scripts".....LightNicht has done the work!! =)

//JAB

SMF spam blocked by CleanTalk