Hi guys!
I was looking thru the board for release bot and couldn't find what i need! All release Bots what i find showing whole release list. But i need:
+rls -to show last 30 releases
+allrls -to show all releases
+search (release) -to search for releases
+addrls -to add new release (is only availible to [VIP] and above!)
+delrel (release) -to delete release
all releases have to displayd in PM.
Thanx in advince :))
look here...
http://board.univ-angers.fr/thread.php?threadid=1638&boardid=12&sid=325cb40175b18c651107faf2677bea5e
Thanx dude i will try that! ..don't understend why u didn't give me that before :D
loooooooooool
all my Bot's are private and my release bot is not the same :D
Thank you very much Mr. Valhala for your time, now even if u offer me your "PRIVAT" bot i will NOT use it.
Keep it Psychedelic ;)
?
I did tryed script what Valhala was offering......hmm dosn't work so good.
To Mr. Optimus!!! I using your on board Robocop release bot, very simple but works GREAT!!! Here it is:
__________________________________________________________________________________________
-- Verry simple release script nothing fancy
-- Make a file called releases.txt in \Scripts Folder
-- Made By Optimus
sBot = "...::ReleaseBot::..."
timedate = date()
file = "releases.txt"
display1 = "Item"
display2 = "Description"
display3 = "Releases"
function Main()
frmHub:RegBot(sBot)
end
function DataArrival(user, data)
if (strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if (cmd=="+rls") then
ReadRelease(user, data, cmd)
return 1
elseif (cmd=="+addrls") then
if user.bOperator or user.iProfile == 2 then
s,e,cmd,release,desc = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
if desc == nil then
description = "No "..display2.." specified!"
s,e,cmd,release = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
else
description = desc
end
if release == nil then
user:SendData(sBot, "*** No "..display1.." specified!")
return 1
end
News("By: "..user.sName.."\t Date: "..timedate.."\r\n"..display1..": "..release.."\r\n"..display2..": "..description.."\r\n")
SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type +rls in Main-Chat to show "..display1..".")
return 1
else
user:SendData(sBot, "*** +addrls is only availible to [VIP] and above!")
return 1
end
end
end
end
function ReadRelease(user, data, cmd)
local release = ""
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
release = release.." "..line.."\r\n"
end
end
user:SendPM(sBot, "\r\n\r\n".." "..display3.."s posted by users: ".."\r\n\r\n"..release)
readfrom()
end
function News(what)
appendto(file)
write(what.."\n")
writeto()
end
__________________________________________________________________________________________
So i will be very gratefull if you would change it for me a bit! I need add function to show last 30 releases + function delete release + function find release.
Thanx a lot in advince!!!
Mr. Optimus is on vacation... hmm hope i spelled that right ;p
So you have to hope some one else of the many good scripters here to help you =) But i am sure they will =)
Have a look @ freshstuff by plop you can find it here (http://www.plop.nl/ptokaxbots/Plop.php)
Later,
Millsy
Thanx Millsy i have a look Plop's scripts.....yeah madman u r right Optimus is not in his hubs, looks like his gone.....hope some GRATE scripters will help me with that anyway!
-- another thing! i would like to see releases displayd on one line, like that:
By: ...::DJ::Witch::... Date: 08/06/04 10:25:28Item: DJ_Witch_-_Psycraft-live@04.2004-djset Description: Psychedelic
..now it's shows like that:
By: ...::DJ::Witch::... Date: 08/05/01 21:32:11
Item: DJ_Witch_-_Psycraft-live@04.2004-djset
Description: Psychedelic
also if it's posseble will be cool if u can add this line at the begining and end of the list:
>-=========================================================<...::Psy zOne::...>==========================================================-<
Thanx a lot :))
Quote-- another thing! i would like to see releases displayd on one line, like that:
By: ...::DJ::Witch::... Date: 08/06/04 10:25:28Item: DJ_Witch_-_Psycraft-live@04.2004-djset Description: Psychedelic
..now it's shows like that:
By: ...::DJ::Witch::... Date: 08/05/01 21:32:11
Item: DJ_Witch_-_Psycraft-live@04.2004-djset
Description: Psychedelic
News("By: "..user.sName.."\t Date: "..timedate.."\r\n"..display1..": "..release.."\r\n"..display2..": "..description.."
remove the /r/n
Thanx Millsy! I did correct it...now it's shows in one line, cool! But how i can make gap between release it self and word "Description"?
za lad :))
try \t for a tab ...
like this
.. News("By: "..user.sName.." \t Date: "..timedate.." "..display1..": "..release.." "..display2..": \t "..description.."
and try reading one simple C++ reference guide ;0)
Yes thanx UwV now better!
Well to learn C++ it's my plan for near future.....and btw \t shold be added before "..display2.."
za lad :))
just giving an example ..
Quoteand btw \t shold be added before "..display2.."
ust a
"..timedate.." "..display1..": "..release.." "..display2..":
has a space in between the "..release.." and the "..display2..": that already made the space you asked for .. ;)
Yoo UwV thanx dude!
Whith release line we sorted out ....some how hehe...lol....but script no one can fix....hmmmm
Hello scripters. help please !!! :P
QuoteOriginally posted by UwV
try \t for a tab ...
like this
.. News("By: "..user.sName.." \t Date: "..timedate.." "..display1..": "..release.." "..display2..": \t "..description.."
and try reading one simple C++ reference guide ;0)
"\t" only goes to the next tab index on the line... so if the next tab index is only 1 space away... \t will only go out 1 space.... might want to just add a few spaces...
-BH
how does one edit this script so:
-all users can !write
-when someone does !read or !write it sends both to main chat. something like SendToAll !read
-remove the description part altogether.
i know it seems like i'm being lazy, but i spent an hr editing but it didn't work out. i know what bit needs to be changed, like (elseif (cmd=="!write") then
if user.bOperator or user.iProfile == 2 then) to all allow all users to !write, i just don't know what to put in place.
and where can i find a simple lua guide? :D the one on the lua site is definitely written for programmers.
Hi,
Just remove the condition "if user.bOperator or user.iProfile == 2 then" and his "end" and will be avaible to all users.
Best regards, nErBoS
ok brain, what about the other two things? a bit beyond me, infact i'm not even sure if i understood the first thing. but i'll try and see if i can work it out later.
for the second thing u asked for ....
expiriment with the "return 1" part at the bottom of most of the "if/else/elseif" in this scriptby Optimus ;)
return 1 --- like this is processed
-- return 1 --- like this it is not processed (it is a comment in the script now ;)
ok, nerbo's thing worked, so problem 1 solved. i deleted that part initially, but didn't know to delete 'end'.
i tried commenting those parts out Herodes, didn't work. i must of done something wrong.
to try and solve problem two. i rewrote it, to
if (cmd=="!read") then
SendToAll("<"..user.sName.."> !read")
ReadRelease(user, data, cmd)
return 1
so now that works. i'm sure it's a messy way of doing it, but oh well. now people see !read written when users type it. how do i do it so it shows !write in main chat?
and problem 3 looks impossible to me. because i gather it's inherently something to do with "%b<>%s+(%S+)%s+(%S+)%s+(.+)" , which i have no chance in deciphering, never mind editing.
QuoteOriginally posted by imby
if (cmd=="!read") then
SendToAll("<"..user.sName.."> !read")
ReadRelease(user, data, cmd)
return 1
you understood a great deal keep it up.. ;)
but try putting this instead ... I am confident it will work if u are using TD4
if (cmd=="!read") then
-- SendToAll("<"..user.sName.."> !read")
ReadRelease(user, data, cmd)
-- return 1
end
About the pattern matching (the weird %S+%s+ stuff ...)
pay attention to the number of parenthesis, (brackets) pairs and the number of variables in the first part of the strifnd. .. ;)
s,e,cmd,release,desc = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
now if you change this to
s,e,cmd,release = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
It should be fine ...
remember %s is for saying "a space character" and
%S is for saying "a non space character"
for undesratnding the first part of the line (before the "=" ) I will give another two tips ...
This following line
aval, bval,cval,none = 1,2,"string",nil
is the same as saying
aval = 1
bval = 2
cval = "string"
none = nil
Thats one ... the other is the "s,e," part ,...
This refers to some values that the strfind is returning ... so in most cases this would stay the same (basically ppl use these letters because they stand for "
start","
end" but you can pick any other combination of letters )...
If you want to learn more about this (or not .. ;) I strongly
reccomend u read through plop's tutorial on pattern matching (http://www.plop.nl/howto/howto.php) ...
good luck :D
s,e,cmd,release = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
removes the description, but just catches the first word a user writes. so if they wrote: !write artist - album - year [genre] it would only show the album. need it to catch the entire thing they write, and have it as the release (or item).
yep ... try using instead of the last (%S+) --- that says all non space characters ...
(.*) --- that says all characters ...
this is in plop's pattern matching tutorial ;)
only catches the artist rather*
and thanks, hehe did have a look through it. is gonna take multiple reads. as you can see, am not that advanced, that first line of code i wrote took me like an hr to do. but i did write it all by myself. :) and btw, am using Ptokax 0330 15.25. gonna have a look at trying what you said and understanding more later.
Finished:
-- Verry simple release script nothing fancy
-- Make a file called releases.txt in \Scripts Folder
-- Made By Optimus
sBot = "=ReleaseBot="
timedate = date()
file = "releases.txt"
display1 = "Item"
display2 = "Description"
display3 = "Releases"
function Main()
frmHub:RegBot(sBot)
end
function DataArrival(user, data)
if (strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if (cmd=="!read") then
SendToAll("<"..user.sName.."> !read")
ReadRelease(user, data, cmd)
return 1
elseif (cmd=="!write") then
s,e,cmd,release = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
SendToAll( data )
end
if release == nil then
user:SendData(sBot, "*** No "..display1.." specified!")
return 1
end
News("By: "..user.sName.."\t Date: "..timedate.." "..display1..": "..release.." ")
SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type !read in Main-Chat to show "..display1..".")
return 1
end
end
function ReadRelease(user, data, cmd)
local release = ""
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
release = release.." "..line.."\r\n"
end
end
user:SendPM(sBot, "\r\n\r\n".." "..display3.." posted by users: ".."\r\n\r\n"..release)
readfrom()
end
function News(what)
appendto(file)
write(what.."\n")
writeto()
end
works exactly how i want it. anyway to optimise it or clean it up a bit? i'm sure i've done it messy.
if (cmd=="!read") then
-- SendToAll("<"..user.sName.."> !read")
ReadRelease(user, data, cmd)
-- return 1
end
didn't work at all, must of done soemthing wrong. nor can i work out why you'd comment out the bits you need anyway? i think it was just a thing for TD4
never mind it messed up. worked the first few times, then when a user just typed out letters with no commands in main chat it said:
"[17:51] <=ReleaseBot=> New Releases Added....By Type !read in Main-Chat to show Item."
for everything
how can i fix this?
Watch how the if-then>elseif-then>else-end sequence is going ... and what it is doing ...
... I think you really need to understand this so I will not post the corrections .. ;) trial and error ... not only it reveals how it should be but also how it works .. :D
well, i bet your are learning a lot from Herodes, but i coulden't help my self so i post this so you can compare your postet version to this one....
sometimes its easyer to see the bugs like that ..
Only made a short test and it worked..
-- Verry simple release script nothing fancy
-- Make a file called releases.txt in \Scripts Folder
-- Made By Optimus
sBot = "=ReleaseBot="
timedate = date()
file = "releases.txt"
display1 = "Item"
display2 = "Description"
display3 = "Releases"
function Main()
frmHub:RegBot(sBot)
end
function DataArrival(user, data)
if (strsub(data, 1, 1) == "<" ) then
local data=strsub(data,1,strlen(data)-1)
local s,e,cmd=strfind(data, "%b<>%s+(%S+)")
if (cmd=="!read") then
ReadRelease(user, data, cmd)
return 1
elseif (cmd=="!write") then
local s,e,cmd,release = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
if release == nil then
user:SendData(sBot, "*** No "..display1.." specified!")
user:SendData(sBot, "*** Use "..display1.." - "..display2.." to specify your release! ")
else
News("By: "..user.sName.."\t Date: "..timedate.." "..display1..": "..release.." ")
SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type !read in Main-Chat to show "..display1..".")
return 1
end
end
end
end
function ReadRelease(user, data, cmd)
local release = ""
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
release = release.." "..line.."\r\n"
end
end
user:SendPM(sBot, "\r\n\r\n".." "..display3.." posted by users: ".."\r\n\r\n"..release)
readfrom()
end
function News(what)
appendto(file)
write(what.."\n")
writeto()
end
*** Typhoon?
grrr typ ... lol
Lets hope he/she can see the mistake by comparing it at least ... ;)
thanks, i played a game of spot the difference and saw it, :) will take a few more reads to understand it all. thanks for all your help Typhoon?, nErBoS and especially Herodes, this script was for a friend. Herodes it doesn't matter if i do understand that one part or not, my level is still very basic. would say i only understand 20% of it all. so it's not like i can do much myself. i've not read any guides, just picked this little understanding up through looking through scripts. i guess i need some beginners guide or something, but as i said the one on the lua site is written for programmers.
Typhoon? - i just pasted the sendtoall lines from my script into yours, that's ok right? don't need to add anything else to them? wanted them there. it seems to work now.
sorry , des ..
and your welcome imby , But ...
why have the SendToAll() ?? , if you want users to see the commands just remove return 1 ... then it will show in main chat
*** Typhoon?
thanks, tried that and above we commented it out, which is the equivalent but didn't seem to work. think it works on testdrive but not on 0330 but not sure.
QuoteOriginally posted by imby
thanks, tried that and above we commented it out, which is the equivalent but didn't seem to work. think it works on testdrive but not on 0330 but not sure.
Yep chat msgs starting with the prefix in 033 are not send to the main ... td4 should do it with the ' return 1 '