PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: LiqUiD~TrolL on 15 March, 2005, 16:33:39

Title: problem in changeing in LUA 5
Post by: LiqUiD~TrolL on 15 March, 2005, 16:33:39
hello everyone

well my frineds i recently deside to change in robocop 10 and in new ptoka x

so i ve started changeing all my hub scripts in LUA 5

but the point is that i don t know how to cahnge them,anyone can tell me a tip???

--==@plop i need your lights of science =o)@==--

right now i m useing 2 of plops scripts :

--------- FreshStuff v.3.2 --------------

-- Name the commands to what U like

-- This command adds stuff, syntax : +addalbum TYPE/CATAGORY THESTUFF2ADD

cmd1 = "+addrls"



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

cmd2 = "+rlsall"



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

cmd3 = "+delrls"



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

cmd4 = "+rls"



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



-- The file storing the stuff

file = "releases.txt"



-- Name of the bot

Bot = "-NemO-"



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

Types = {["psychedelic"] = "Psychedelic", ["ambient"]="Ambient", ["electronic"]="Electronic", ["psytrance"]="Psytrance", ["goa"]="Goa", ["chill"]="Chill", ["psytrance"]="Psytrance", ["house"]="House", ["proggresive"]="Proggresive", ["trance"]="Trance", ["psymovie"]="Psymovie"}





--------------------- 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 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 or user.iProfile == 2) 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

  ReloadRel()

  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

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".." --------- 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, "(.+)$(.+)$(.+)$(.+)")

if title then

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

else

Msg = Msg..NewestStuff.."\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=strfind(AllStuff, "(.+)$(.+)$(.+)$(.+)")

if title then

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

else

Msg = Msg..AllStuff.."\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, "(.+)$(.+)$(.+)$(.+)")

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)

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





















ANd here is the second one script i wanna change


---------AnTiFlooD By PloP_(4.5.4)---------------------------

but i wanna ask something  , OPtimus with the protection you added ,do i need now an antiflood script?? is it nessecary or it s just lose of memory of the server??? =)


greetings all my mates keep good work in LUa WoRlD_!!
Title:
Post by: jiten on 15 March, 2005, 16:48:56
Check these threads for different LUA 5 FreshStuff versions:

Here (http://board.univ-angers.fr/thread.php?threadid=3885&boardid=26&sid=fb03319b696c761cf529d00393b972fa) , Here (http://board.univ-angers.fr/thread.php?threadid=3893&boardid=26&sid=fb03319b696c761cf529d00393b972fa) , Here (http://board.univ-angers.fr/thread.php?threadid=1638&boardid=12&sid=fb03319b696c761cf529d00393b972fa)  and Here (http://board.univ-angers.fr/thread.php?threadid=3706&boardid=28&sid=fb03319b696c761cf529d00393b972fa).
 

and for the deflood script, u can get it here (http://www.plop.nl/ptokaxbots/Plop/deflood_5.0_rc1.rar) .

Best regards,

jiten

PS: by the way, try using the Search function before requesting. there are cases when the scripts u want have been already posted  :]
Title:
Post by: LiqUiD~TrolL on 15 March, 2005, 19:37:54
tnx for helping me m8 the releases are grat now everything is ok =)

have a nice day
Title:
Post by: jiten on 15 March, 2005, 19:50:37
yw m8 ;)

cheers
Title: the script doesnt work
Post by: LiqUiD~TrolL on 22 March, 2005, 18:36:32
my friend the script it is working great,all commands working good

exept 1 thing,ahah the important one

when i m trying to delete a release

with : +delrls

this message appears in the main chat in my hub :

[19:29:20] <•NemO•> I need the ID number to delete a releas


what ID number?? lool what the hell is this ???


plopppp can you give a hand here???
Title:
Post by: jiten on 22 March, 2005, 18:42:06
Well, u can find the Id of each release, after listing the entries with +rls or +rlsall.
Then, u'll get something like this:

--------- All The Releases --------
  ID: 1 -- 03/22/05 -- jiten -- movie -- Blade 3
 --------- All The Releases --------
  use +albums to see only the selected types


As u can see, there's the ID. In this case, it's 1.

Cheers.
Title:
Post by: LiqUiD~TrolL on 22 March, 2005, 18:53:28
there is no ID number when i m pressing +rls or +rlsall


this is the PM tha dissplaied

  03/13/05 -- LiqUiD~TrolL -- psychedelic -- Psytekk_-_Space_Syndrome-2005-MYCEL
  03/13/05 -- LiqUiD~TrolL -- psychedelic -- Nexus_-_Psycho_Therapy-(Remastered)-2005-ASS
  03/14/05 -- chip -- ambient -- VA_-_Chillout_Mix_on_Radio_HRXXL_07-09-2003-zEn
  03/14/05 -- LiqUiD~TrolL -- psychedelic -- Sub6_-_Bozow-(CDS)-2005-iR-CA
  03/14/05 -- LiqUiD~TrolL -- psychedelic -- Space_Safari_-_Early_Reflections-1999-zEn
  03/14/05 -- .Hulligan. -- psychedelic -- D.j_ToM_Harush_-_Time_To_Say_Hello-ECT PsyChedelic
  03/14/05 -- ']['rIp•iN•?uN -- psychedelic -- Bizzare_Contact_-_Ecstasy-2005-cep
  03/14/05 -- LiqUiD~TrolL -- psychedelic -- Wrecked_Machines_and_Domestic_-_This_One-(CDS)-2005-iR-CA
  03/14/05 -- LiqUiD~TrolL -- psychedelic -- Silicon_Isness_-_In_My_Head-(CDS)-2005-iR-CA
  03/14/05 -- AstraL -- psychedelic -- X-Wave_-_Direct-X-2005-MYCEL Psychedelic
  03/15/05 -- LiqUiD~TrolL -- psychedelic -- VA_-_Goa-Visions-Psychedelic_Trance_Vol_2-2CD-2000-zEn
Title:
Post by: jiten on 22 March, 2005, 19:16:31
Replace this in ur script:
Msg = Msg.." "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n"

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

Then, save the file, restart ur scripts and list the releases with +rls or +rlsall.
I guess that should do it. At least with me it's working well.

Best regards,

jiten
Title:
Post by: LiqUiD~TrolL on 22 March, 2005, 21:08:23
ok here i am again,well it works but now there is other problem


look in my releases list i have about 1000 and maby
more releases,so when i m typing +rls the script show me the latest 40 releases,but with the ID number from : 1 to 40 so when i m trying to delete the relerase with ID number 1-40 it deletes the releases they are in the top of the 1000 releases list =( so it deletes diffrend relese from the one i want really to delete.

=( shit i m despirate ..
maybe the one you told me to replace i add it in worng place?? cause this -->Msg = Msg.."  ID: "..i.." -- "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n

it is 2-3 times wirten in the script can yopu send the full script plz??



sorry i m disturbing all the time
i wish i knew how to fix LUA alone =)
Title:
Post by: bastya_elvtars on 22 March, 2005, 21:56:26
You might want to try this (http://ptokaxscripts.sytes.net/request.php?23).

-- // edit

Link updated.
Title:
Post by: LiqUiD~TrolL on 22 March, 2005, 22:45:25
hello man

well bastya_elvtars the script you told me have the same problem =/

look m8 i want to delete the releases in the end of my 1000 and more releases i have added.not the first 40 ones in the list =(

this is my problem,whne you press +rls it displays the lates 40

how can i delete the latest 40 releases ?? how should i know the ID number of them the are thousands of releases there
Title:
Post by: bastya_elvtars on 22 March, 2005, 22:48:42
QuoteChangelog for freshstuff 3.7.5

- added choice between showing in main or PM on entry
- new stuff is shown by real ID (idea by LiqUiD~TrolL)
- security fixes have been made, corrupt entries are ignored

These are the tw end of the sme rod. :P
Title:
Post by: LiqUiD~TrolL on 22 March, 2005, 22:51:58
ok here is something more for plop i ve noticed right now

the search command it works great BUT

if the release is added like :
[23:48] <•NemO•>
---------- You searched for keyword "Psysex". The results: ----------

  02/11/04 -- PrInCe -- Skazi_Vs_Psysex_-_Loylty-CDR-2004-LiM
  08/11/04 -- PrInCe -- Psysex_Feat._Michelle_Adamson_-_Your_Place_or_Mine-2004-AoeL
  01/01/05 -- SaGit -- Psysex_and_Rocky_-_Japanise_Owa-(Unreleased)-2004-AoeL
  02/06/05 -- LiqUiD~TrolL -- Psysex_-_Come_in_Peace_(Illumination_Rmx)-(Unr)-2005-AoeL
  02/12/05 -- LiqUiD~TrolL -- Psysex_-_Alien_Cop_(Eskimo_Rmx)-(CDS)-2005-iR-CA
  02/13/05 -- LiqUiD~TrolL -- Psysex_-_Altered_States_(X-Noize_Rmx)-(Unr)-2005-AoeL



and i search for Psysex it works great

BUT if i search for  " psysex "  with small letter the search  didn t find anything  

there s a good question for you guys =)

who can fix this ? the search string ??
Title:
Post by: LiqUiD~TrolL on 22 March, 2005, 22:56:42
------>>>>  These are the tw end of the sme rod.


what you mean???
haha you mixed me up m8 =)

you fixed the script ?? and by the way when i press +rls there is no ID by the release
Title:
Post by: bastya_elvtars on 23 March, 2005, 00:57:37
You have to re-download, you are using 3.7, and latest is 3.7.5 which is more secure and your idea is contained.

BTW search is case sensitive atm. Thx for pointing this out, will be fixed in next version. :)
Title:
Post by: jiten on 23 March, 2005, 07:31:02
QuoteOriginally posted by jiten
Great job, bastya! :)
Btw, I was testing the FreshStuff 3.7 script and found a small "bug".
When I add a release with more than one line like this:

[08:19:42] jiten added to the movie releases: oooooooooooooooooooooooooooooo
ooooooooooooooooooooooooooo
ooooooooooooooooooooo


and then try to see the releases with "+albums category", i get this:

[08:20:44]

 --------- All The Movies --------

  03/23/05 -- jiten -- oooooooooooooooooooooooooooooo

 --------- All The Movies --------


It only reads the first line of the multi-line entry.
Can u check that, please?
Thanks in advance...

jiten

Just a question, have u corrected this in the new version?
Title:
Post by: bastya_elvtars on 23 March, 2005, 10:27:23
Newlines are not supported, I would have to rewrite the whole data handling routine again to support. And, why the hell does a file have a multiline name? :P (Releases are files AFAIK. :D)

-- // edit

I use +albums, and get this:

QuoteID: 121 -- 03/03/05 -- [TGA-OP]bastya_elvtars -- music -- MYMUSIC
  ID: 122 -- 03/22/05 -- [TGA-OP]bastya_elvtars -- music -- ehh

 --------- All The Releases --------

I dunno what version you are using.
Title:
Post by: LiqUiD~TrolL on 23 March, 2005, 15:58:36
oki then bastya_elvtars give me the link for the 3.7.5 version

where can i find it?
Title:
Post by: jiten on 23 March, 2005, 16:21:47
QuoteOriginally posted by bastya_elvtars
You might want to try this (http://ptokaxscripts.sytes.net/request.php?23).

-- // edit

Link updated.

There it is...
Title:
Post by: jiten on 23 March, 2005, 16:34:39
QuoteOriginally posted by bastya_elvtars
Newlines are not supported, I would have to rewrite the whole data handling routine again to support. And, why the hell does a file have a multiline name? :P (Releases are files AFAIK. :D)

-- // edit

I use +albums, and get this:

QuoteID: 121 -- 03/03/05 -- [TGA-OP]bastya_elvtars -- music -- MYMUSIC
  ID: 122 -- 03/22/05 -- [TGA-OP]bastya_elvtars -- music -- ehh

 --------- All The Releases --------

I dunno what version you are using.

Well, I'm using freshstuff 3.5 but, with some mods on the way it's supposed to be used.
Mine displays Social Events, The movies that are are on the Cinemas, and Things that are on sale.
As u can see, some of them require multiline entries and it's quite hard to put everything in just a line.
That's why a made this request.
Anyway, thanks for ur support and thanks in advance.

Best regards,

jiten
Title: WEEEEEEEEEEEEEEEEEEEEEEEEEE__!!
Post by: LiqUiD~TrolL on 28 March, 2005, 11:29:52
finaly tnx to bastya_elvtars the script is great ,tnx a lot for your work guys ,you did it really good =)


all my requests is in there !!

bastya_elvtars want something more to work next time ??? 1 more add in the script .when you find time
you sohuld better fix the seach command cause if you search like liquid it doesn t find a release with name Liquid. so you must search it with BIG letter
and it s tough to explain all users what to do

greetings ppl =) liquid was here _!!
Title:
Post by: bastya_elvtars on 29 March, 2005, 15:34:02
Fixed. Gonna release as soon as i rewrite command parsing.
Title:
Post by: LiqUiD~TrolL on 29 March, 2005, 22:52:43
hehe bastya_elvtars this script gonna be the perfect script for releases

go go the good work  m8

can t wait for it
Title:
Post by: bastya_elvtars on 29 March, 2005, 23:00:36
Released a preview. Check the appropriate topic. :)
Title:
Post by: LiqUiD~TrolL on 29 March, 2005, 23:58:28
apprpriate ?? what you mean?

where is this topic then ???
Title:
Post by: bastya_elvtars on 30 March, 2005, 00:12:17
http://board.univ-angers.fr/thread.php?threadid=3893&boardid=26&styleid=1&sid=9925b5496eec54a9f96992e59cff5f02
Title:
Post by: LiqUiD~TrolL on 31 March, 2005, 09:44:35
hello all

bastya_elvtars i when in the link you gave me ,i tested the script but it s not working why ??

what i m doing worng ??


shit, now not even the +relesesearch working
=( despirate man
Title:
Post by: LiqUiD~TrolL on 31 March, 2005, 10:05:53
heehhe well m8 i ve noticed something else now

the script is working great but with one exeption,the
+release find is not working for users =(

why you did it that why???
users also wanna search for albums

i was trying to test it as user not as operator
Title: GREAT GREAT GREAT
Post by: LiqUiD~TrolL on 31 March, 2005, 10:49:45
the best releases SCRIPT ever made =)

i m gad damn so happy thankx to bastya_elvtars


my m8 plz see the PM i sended you
Title:
Post by: bastya_elvtars on 31 March, 2005, 13:05:01
+albums new should do da same as +newalbums

i did not want 2 cmds doing the same  ;)
Title:
Post by: LiqUiD~TrolL on 02 April, 2005, 05:38:25
m8 the +rls command doesnt work for users =/
they can t see releases
Title:
Post by: LiqUiD~TrolL on 02 April, 2005, 05:51:39
i fix it =)