PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: GaMeFaNaTiC on 18 December, 2003, 16:24:34

Title: help with freshstuff...track order..
Post by: GaMeFaNaTiC on 18 December, 2003, 16:24:34
--FreshStuff v.2.0
--You need a folder called "txt" in your Ptokax scripts folder, like this /scripts/txt/

--Name this bot to anything you like
bot = "[gG?]Network"

--Name the commands to what U like
--This command adds stuff, syntax : +addalbum THESTUFF
cmd1 = "+addalbum"

--This command shows the stuff, syntax : +albums THESTUFF
cmd2 = "+albums"

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


File1 = "AlbumsAll.txt"
File2 = "AlbumsConnect.txt"

function Main()
frmHub:RegBot(bot)
end

newtunes={}

curtime = date("[%d-%m-%Y]")

function NewUserConnected(curUser)
DoNotOpenFile(curUser, File2)

end

function OpConnected(curUser)
DoNotOpenFile(curUser, File2)
end



function DataArrival(curUser,data)

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

if (strfind(strlower(data), strlower(cmd1))) and curUser.bOperator then
s,e,cmd,tune = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
if ( tune == nil or tune == "" ) then
curUser:SendPM(bot, " If you want to add a tune type +addalbum YOURSTUFF in main chat ")
return 1
else
ReadTunes1(File1)
curtune=" [gG?] "..tune.." "
newtunes[1]=curtune
SendToAll(newtunes[1])
WriteAddtunes1(File1)
WriteNewTunes1(File2)
return 1
end
end

if (strfind(strlower(data), strlower(cmd2))) then
OpenFile(curUser, File1)
end

if (strfind(strlower(data), strlower(cmd3))) and curUser.bOperator then
if curUser.bOperator then
s,e,cmd,num = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
num2=tonumber (num)
if ( num2 == nil ) then
curUser:SendPM(bot, " To delete a Tune type +delalbum THESTUFFNUMBER!!! in main chat ")
return 1

else

ReadTunes2(File1)
newtunes[num2]=nil
curUser:SendPM(bot, " Tune Nr. "..num2.." was deleted.")
WriteAddtunes1(File1)
WriteNewTunes1(File2)
return 1
end
end
end
end
end
----------------------------------------------------------------------
function ReadTunes1(File1)
local handle = openfile("txt/"..File1, "r")
if (handle) then
local line = read(handle)
while line do
s,e,ind,val = strfind( line, "(%S+)%s+(.*)")
ind = ind+1
newtunes[ind]=val
line = read(handle)
end
closefile(handle)
end
end
----------------------------------------------------------------------
function ReadTunes2(File1)
local handle = openfile("txt/"..File1, "r")
var1 = 0
if (handle) then
local line = read(handle)
while line do
var1 = var1 +1
s,e,ind,val = strfind( line, "(%S+)%s+(.*)")
newtunes[var1]=val
line = read(handle)
end
closefile(handle)
end
end
----------------------------------------------------------------------
function WriteAddtunes1(File1)
local handle = openfile("txt/"..File1, "w")
var2 = 0
for index, value in newtunes do
var2 = var2+1
write(handle,var2.." "..value.."\r\n")
if var2 == 20 then
break
end
end
closefile(handle)
end
----------------------------------------------------------------------
function WriteNewTunes1(File2)
local handle = openfile("txt/"..File2, "w")
var3 = 0
for index, value in newtunes do
var3 = var3+1
write(handle,var3.." "..value.."\r\n")
if var3 == 5 then
break
end
end
closefile(handle)
end
----------------------------------------------------------------------
function OpenFile(curUser, File)
local msgfromtxt ="\r\n"
readfrom("txt/"..File)
while 1 do
local line = read()
if ( line == nil ) then
break
else
msgfromtxt = msgfromtxt.." "..line.."\r\n"
end
end
--end
curUser:SendPM(bot, "\r\n"..
"\r\n"..
" --------- The Latest Albums -------- \r\n"..
msgfromtxt.."\r\n"..
" --------- The Latest Albums -------- \r\n"..
"\r\n")
readfrom()
end

--------------------------------------------------------------------------------



hi.. this script works yea but i want it to do one more thing to make it perfect.. u c wen i add something like Name - Text and then hit the command +albums, the txt comes at the top (number 1). this can be a problem if there are lots of them cse the new ones wont show and the old ones wil be at the bottom. so i was wondering..  is there a way to make it come at the bottom wen u addalbum instead of the top... plzzz help.. cheers  :))
Title:
Post by: GaMeFaNaTiC on 19 December, 2003, 10:39:12
can any1 help plz  :(  ;(
Title:
Post by: c h i l l a on 19 December, 2003, 11:50:16
if think I did this script once but its way old..

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

if (strfind(strlower(data), strlower(cmd1))) and curUser.bOperator then
s,e,cmd,tune = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
if ( tune == nil or tune == "" ) then
curUser:SendPM(bot, " If you want to add a tune type +addalbum YOURSTUFF in main chat ")
return 1
else
ReadTunes1(File1)
curtune=" [gG?] "..tune.." "
newtunes[1]=curtune
SendToAll(newtunes[1])
WriteAddtunes1(File1)
WriteNewTunes1(File2)
return 1
end
end


but this code is weird...
anyway get a newer version from here (http://chiller3000.tripod.com/p-scripts/)
I don't do anything with it anymore, maybe someone else wants to keep it up dunno..  but just replace this line

tinsert ( newstuff, 1, { str1,str2,str3.sName,str4 } )

whith this

tinsert ( newstuff, { str1,str2,str3.sName,str4 } )

should do the trick..
Title:
Post by: GaMeFaNaTiC on 20 December, 2003, 12:24:20
hmm yo chilla this new 1 is confusing me too much lol.. evrything if different. ah wel guess i gotta leave it like this unless sme1 knows.. thanks tho  :)
Title:
Post by: BlazeXxX on 20 December, 2003, 17:33:54
Hi GaMeFaNaTiC,
I done the changes for you as per chilla's advice :)

Get the fixed version ---= HERE =--- (http://htalk.net/freshstuff-v.2.zip)

I will be deleting the file in 7 days time :)
Title:
Post by: GaMeFaNaTiC on 20 December, 2003, 19:47:33
thanks blazexxx..  :]  :]  :]
Title:
Post by: GaMeFaNaTiC on 20 December, 2003, 19:49:00
btw... uno the 'fresh-files' folder... do i need to rename it to txt or shal i jus put it in the ptokax folder?
Title:
Post by: GaMeFaNaTiC on 21 December, 2003, 12:28:41
hello again, so to bother u lot once again but the new version had too much of what i didnt want. i also found out from the old version...

newtunes[1]=curtune
SendToAll(newtunes[1])


this bit where it says [1] meanin it will add at 1 all the time.. if i make it 21 then it wil go at 21 all the time.. thre prob isnt a way but how can i mke it go at the bottom .. lol any help??? chillaa? :))
Title:
Post by: c h i l l a on 21 December, 2003, 13:08:41
GaMeFaNaTiC

simple

tinsert(newtunes,curtune)
SendToAll(newtunes[getn(newtunes)])

or

tinsert(newtunes,curtune)
SendToAll(curtune)

Title:
Post by: GaMeFaNaTiC on 21 December, 2003, 13:30:06
yo thankss chilla.. one thing tho.. i was close to 20 listings. i added some but it only goes up to 20 then wen i add more it dont show anymore than 20 :/ damn so close aswel.. wtz the problem here chilla.. any idea..

--FreshStuff v.2.0
--You need a folder called "txt" in your Ptokax scripts folder, like this /scripts/txt/

--Name this bot to anything you like
bot = "[gG?]Network"

--Name the commands to what U like
--This command adds stuff, syntax : +addalbum THESTUFF
cmd1 = "+addalbum"

--This command shows the stuff, syntax : +albums THESTUFF
cmd2 = "+albums"

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


File1 = "AlbumsAll.txt"
File2 = "AlbumsConnect.txt"

function Main()
frmHub:RegBot(bot)
end

newtunes={}

curtime = date("[%d-%m-%Y]")

function NewUserConnected(curUser)
DoNotOpenFile(curUser, File2)

end

function OpConnected(curUser)
DoNotOpenFile(curUser, File2)
end



function DataArrival(curUser,data)

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

if (strfind(strlower(data), strlower(cmd1))) and curUser.bOperator then
s,e,cmd,tune = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
if ( tune == nil or tune == "" ) then
curUser:SendPM(bot, " If you want to add a tune type +addalbum YOURSTUFF in main chat ")
return 1
else
ReadTunes1(File1)
curtune=" [gG?] "..tune.." "
tinsert(newtunes,curtune)
SendToAll(curtune)
WriteAddtunes1(File1)
WriteNewTunes1(File2)
return 1
end
end

if (strfind(strlower(data), strlower(cmd2))) then
OpenFile(curUser, File1)
end

if (strfind(strlower(data), strlower(cmd3))) and curUser.bOperator then
if curUser.bOperator then
s,e,cmd,num = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
num2=tonumber (num)
if ( num2 == nil ) then
curUser:SendPM(bot, " To delete a Tune type +delalbum THESTUFFNUMBER!!! in main chat ")
return 1

else

ReadTunes2(File1)
newtunes[num2]=nil
curUser:SendPM(bot, " Tune Nr. "..num2.." was deleted.")
WriteAddtunes1(File1)
WriteNewTunes1(File2)
return 1
end
end
end
end
end
----------------------------------------------------------------------
function ReadTunes1(File1)
local handle = openfile("txt/"..File1, "r")
if (handle) then
local line = read(handle)
while line do
s,e,ind,val = strfind( line, "(%S+)%s+(.*)")
ind = ind+1
newtunes[ind]=val
line = read(handle)
end
closefile(handle)
end
end
----------------------------------------------------------------------
function ReadTunes2(File1)
local handle = openfile("txt/"..File1, "r")
var1 = 0
if (handle) then
local line = read(handle)
while line do
var1 = var1 +1
s,e,ind,val = strfind( line, "(%S+)%s+(.*)")
newtunes[var1]=val
line = read(handle)
end
closefile(handle)
end
end
----------------------------------------------------------------------
function WriteAddtunes1(File1)
local handle = openfile("txt/"..File1, "w")
var2 = 0
for index, value in newtunes do
var2 = var2+1
write(handle,var2.." "..value.."\r\n")
if var2 == 20 then
break
end
end
closefile(handle)
end
----------------------------------------------------------------------
function WriteNewTunes1(File2)
local handle = openfile("txt/"..File2, "w")
var3 = 0
for index, value in newtunes do
var3 = var3+1
write(handle,var3.." "..value.."\r\n")
if var3 == 5 then
break
end
end
closefile(handle)
end
----------------------------------------------------------------------
function OpenFile(curUser, File)
local msgfromtxt ="\r\n"
readfrom("txt/"..File)
while 1 do
local line = read()
if ( line == nil ) then
break
else
msgfromtxt = msgfromtxt.." "..line.."\r\n"
end
end
--end
curUser:SendPM(bot, "\r\n"..
"\r\n"..
" --------- The Latest Albums -------- \r\n"..
msgfromtxt.."\r\n"..
" --------- The Latest Albums -------- \r\n"..
"\r\n")
readfrom()
end

--------------------------------------------------------------------------------

Title:
Post by: GaMeFaNaTiC on 21 December, 2003, 13:49:15
yo chilla things are messin up now.. i fink we shud forget this eh.. thanks for the help tho. dont wory bout the order thing. cheers :))
Title:
Post by: BlazeXxX on 21 December, 2003, 16:33:29
I think it got something do here in this line, maybe wrong..

if var2 == 20 then

Try changing that value to something higher!
Title:
Post by: c h i l l a on 21 December, 2003, 17:16:26
true  BazeXxX,...  its that,  some things would need to be rewritten, haven't thaught about that, but hey, feel free to do what you want, anybody actually :)
Title:
Post by: BlazeXxX on 21 December, 2003, 19:21:47
Yipee Got it rite then.. lol..

GaMeFaNaTiC, Download the file from the same location i gave b4 and just delete ur old freshstuff scripts and the texts in the txt folder.

Just copy the Fresh-Files into the script directory. So don't bother moving the files inside it to txt/ .

e.g. C:\Hub\Scripts\Fresh-Files
e.g. C:\Hub\Scripts\FreshStuff-V.2.60.lua

Thats how it wud look like if u install it properly!
You are using 2.0 V, which is way too old!

The file i am hosting for u is v2.6!! It has setting file, which will let u modify the maximum no of releases to display,etc..

Please take a look at it again! I feel its 200 x better than the one u using now!

Byezz,
BlazeX
Title:
Post by: GaMeFaNaTiC on 21 December, 2003, 19:51:33
thanks guys.. blazexxx , the new one has a lot of extra stuff which i dont realy need, all i want is this basic thing. anyway. i followed ur instructions and it worked. a number cmes underneath it tho, dno why. lol for example
25  [gG?] testing this out today
 26 26


it shows 26 26 lol.. any idea on this very lst thing ..
Title:
Post by: BlazeXxX on 22 December, 2003, 08:20:31
Hmm.. so its showing after 25th record?

Is it coming after every lines? or just the last line after 25th record?

Could u pls tell me where to get the 2.0v? so i can modify it for u and give it to u ?

Send me the one u got in my pvt or upload it to some site and give me the link..
Title:
Post by: GaMeFaNaTiC on 22 December, 2003, 12:40:13
yo blaze, it happens after all the lines, also when i delete a few lines, the numbers remain ther like

15 18
16 18
17 18
18

i cant seem to find the original of freshstuff 2.0 and itz hard to find on the net. i gt it from chilla's site on old scripts page but that dont work now. all i did was change the script so ops can only use the add and del fnction and that it wud show in pm. blaze, can u modify the script above that i posted becasue thaz all of it. sory to bother again. cheers...
Title:
Post by: BlazeXxX on 22 December, 2003, 22:44:10
Hmm.. I will try my best! Give me some time to find the old script, or is it possible for you  to zip the files u have and send it to me? If yes, i will leave u my mail id in ur pvt..
Title:
Post by: GaMeFaNaTiC on 23 December, 2003, 12:50:25
Freshstuff [GaMeFaNaTiC] (http://www.djguvd.nfogen.net/music/Junk/Freshstuff...zip)

this has my 3 lua files along wit its txt files. hope you can fix the problem here blaze.. thnks for the help. msg ere asap once you've fnishd. cheers.
Title:
Post by: BlazeXxX on 24 December, 2003, 15:32:06
OK i tried and it seems the problem is here:

tinsert(newtunes,curtune)
SendToAll(newtunes[getn(newtunes)])

or

tinsert(newtunes,curtune)
SendToAll(curtune)


I tried increasing the no of listing to 500 and the bug is not there. Since i am not a advanced programmer, does anyone know what to replace those lines with to make the newest item go at bottom ?
Title:
Post by: plop on 24 December, 2003, 17:28:51
tinsert(newtunes, -1, curtune)
that should do it.

plop
Title:
Post by: GaMeFaNaTiC on 24 December, 2003, 18:34:03
it worked the first time.. then wen i added smething else.. the previous ones went at the top :S.. can u chek it plop n see what happns.  :(
Title:
Post by: plop on 24 December, 2003, 23:05:15
QuoteOriginally posted by GaMeFaNaTiC
it worked the first time.. then wen i added smething else.. the previous ones went at the top :S.. can u chek it plop n see what happns.  :(
instead of fixing it i made a fresh new version, i hope it works like you would like it.
has some more commands.
+albums -- shows the full list
+newalbums -- shows the latest xx
+reloadalbums -- reloads the txt file (incase you manualy edit the file)
it uses only 1 file (AlbumsAll.txt)
from that i'm pulling the latest xx entry's 2 show on +newalbums.
-- FreshStuff v.3.0
-- original idea/script by chilla
-- completely rewriten by plop


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

-- This command shows the stuff, syntax : +albums
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 = 1

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

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

function Main()
   frmHub:RegBot(Bot)
   Reload()
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,tune = strfind(data, "%b<>%s+(%S+)%s*(.*)")
      if cmd == cmd2 then
         user:SendPM(Bot, MsgAll.."|")
         return 1
      elseif cmd == cmd4 then
         user:SendPM(Bot, MsgNew.."|")
         return 1
      elseif user.bOperator then
         if cmd == cmd3 then
            if tune ~= "" then
               DelStuff(user, tune)
            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 ~= "" then
               AddStuff(user, tune)
            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 OpenStuff()
   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
      NewestStuff = AllStuff
   end
end

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

function ShowAlbums(table)
   Msg = "\r\n"
   if table == NewestStuff then
      for i=1, Count2 do
         Msg = Msg..NewestStuff[i].."\r\n"
      end
      MsgNew = "\r\n\r\n".." --------- The Latest Albums -------- \r\n"..Msg.."\r\n --------- The Latest Albums -------- \r\n\r\n"
   else
      for i=1, Count do
         Msg = Msg..AllStuff[i].."\r\n"
      end
      MsgAll = "\r\n\r\r\n".." --------- All The Albums -------- \r\n"..Msg.."\r\n --------- All The Albums -------- \r\n\r\n"
   end
end

function AddStuff(user, what)
   Count = Count + 1
   AllStuff[Count]=what
   user:SendData(Bot, what.." is added to the albums|")
   SaveStuff()
   Reload()
end

function DelStuff(user, what)
   Okie = nil
   for a,b in AllStuff do
      if b == what then
         AllStuff[a]=nil
         user:SendData(Bot, what.." is removed from the albums|")
         Okie = 1
         break
      end
   end
   if Okie then
      SaveStuff()
      Reload()
   else
      user:SendData(Bot, what.." wasn't found in the albums|")
   end
end

function Reload()
   OpenStuff()
   ShowAlbums(NewestStuff)
   ShowAlbums(AllStuff)
end
plop
Title:
Post by: GaMeFaNaTiC on 24 December, 2003, 23:18:47
yo plop
thankss for this.. when i type +albums or +newalbums it dont work? :S
Title:
Post by: GaMeFaNaTiC on 24 December, 2003, 23:20:17
i get this

Syntax Error: attempt to concat global `MsgAll' (a nil value)


when i type +albums or the other 1
Title:
Post by: plop on 24 December, 2003, 23:24:08
QuoteOriginally posted by GaMeFaNaTiC
yo plop
thankss for this.. when i type +albums or +newalbums it dont work? :S
check if the txt file is in the correct place.
file = "txt/AlbumsAll.txt"
every line has 2 hold a album, nothing fancy about it.

plop
Title:
Post by: GaMeFaNaTiC on 24 December, 2003, 23:27:53
plop it stil doesnt work :S :S :S.. i can add something. but wen i type +albums nothin happns and i get tht same syntax error. also wen u connect and a pm comes up.. nothing is ther. i chekd the txt file and the names are goin in ther. but i cant get the +albums to work cse of tht error :S S: wt else cud be wrong ere
Title:
Post by: plop on 25 December, 2003, 00:42:49
think i got it now, didn't test it on a empty or small file.
above 20 lines it worked fine, below that the errors came in.
-- FreshStuff v.3.0
-- original idea/script by chilla
-- completely rewriten by plop


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

-- This command shows the stuff, syntax : +albums
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 = 1

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

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

function Main()
   frmHub:RegBot(Bot)
   Reload()
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,tune = strfind(data, "%b<>%s+(%S+)%s*(.*)")
      if cmd == cmd2 then
         user:SendPM(Bot, MsgAll.."|")
         return 1
      elseif cmd == cmd4 then
         user:SendPM(Bot, MsgNew.."|")
         return 1
      elseif user.bOperator then
         if cmd == cmd3 then
            if tune ~= "" then
               DelStuff(user, tune)
            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 ~= "" then
               AddStuff(user, tune)
            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 OpenStuff()
   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 SaveStuff()
   writeto(file)
   for i=1,Count do
      if AllStuff[i] then
         write(AllStuff[i].."\n")
      end
   end
   writeto()
end

function ShowAlbums(table)
   Msg = "\r\n"
   if table == NewestStuff then
      if Count2 == 0 then
         MsgNew = "\r\n\r\n".." --------- The Latest Albums -------- \r\nNo albums on the list yet\r\n --------- The Latest Albums -------- \r\n\r\n"
      else
         for i=1, Count2 do
            Msg = Msg..NewestStuff[i].."\r\n"
         end
         MsgNew = "\r\n\r\n".." --------- The Latest Albums -------- \r\n"..Msg.."\r\n --------- The Latest Albums -------- \r\n\r\n"
      end
   else
      if Count == 0 then
         MsgAll = "\r\n\r\r\n".." --------- All The Albums -------- \r\nNo albums on the list yet\r\n --------- All The Albums -------- \r\n\r\n"
      else
         for i=1, Count do
            Msg = Msg..AllStuff[i].."\r\n"
         end
         MsgAll = "\r\n\r\r\n".." --------- All The Albums -------- \r\n"..Msg.."\r\n --------- All The Albums -------- \r\n\r\n"
      end
   end
end

function AddStuff(user, what)
   Count = Count + 1
   AllStuff[Count]=what
   user:SendData(Bot, what.." is added to the albums|")
   SaveStuff()
   Reload()
end

function DelStuff(user, what)
   Okie = nil
   for a,b in AllStuff do
      if b == what then
         AllStuff[a]=nil
         user:SendData(Bot, what.." is removed from the albums|")
         Okie = 1
         break
      end
   end
   if Okie then
      SaveStuff()
      Reload()
   else
      user:SendData(Bot, what.." wasn't found in the albums|")
   end
end

function Reload()
   OpenStuff()
   ShowAlbums(NewestStuff)
   ShowAlbums(AllStuff)
end
plop
Title:
Post by: GaMeFaNaTiC on 25 December, 2003, 12:21:19
U DA MAN PLOP !!

thanks! for the script .. :D :D :D :D :D it works perfect.

Merry Christmas !
Title:
Post by: GaMeFaNaTiC on 25 December, 2003, 12:44:12
btw if i wanted to have a lil logo infront of the text such as <[gG?]> , which line does this go in.. cnt seem to find it yet lol.

eg.

<[gG?]>ABC - ABC
Title:
Post by: plop on 25 December, 2003, 13:50:23
QuoteOriginally posted by GaMeFaNaTiC
btw if i wanted to have a lil logo infront of the text such as <[gG?]> , which line does this go in.. cnt seem to find it yet lol.

eg.

<[gG?]>ABC - ABC
moved down a little bit.
-- Name of the bot
Bot = "post-it_memo"  --<------ there

--------------------- don't change anything below here
good 2 hear that you like it.

plop
Title:
Post by: GaMeFaNaTiC on 25 December, 2003, 14:07:10
yo plop not that bit.. like this

 --------- All The Albums --------

<[gG?]>ABC - ABC
<[gG?]>ABC - ABC
<[gG?]>ABC - ABC
<[gG?]>ABC - ABC
<[gG?]>ABC - ABC


 --------- All The Albums --------

<[gG?]>
Title:
Post by: GaMeFaNaTiC on 25 December, 2003, 14:10:28
plop dont wory, il leave it how it is :D. thanks again :D :D