Hi at ALL !!!! I m an italian Boy , so i speak little ENGLISH !
So , i ask u for an HELP!!!
I have DCDM Client , but i don t understand the Script of this!!!I want to personalize my DCDM with the SCRIPT !!
But i don t understand , if that script ARE .lua but , with extension !!!
example :
dcpp:setListener( "chat","ciao",
function (hub,user,text)
Thsi code there isn t in .lua code!!!or not!?!?
So I ask u a DOC for this type of script !!!?!?
use Notepad to write your script ...
then dont save with .txt but save with .lua extension ...
then put it in the scripts folder ...
After that there are two ways to start it ...
in the chat of dcdm/bcdc write :
/luafile your_file's_name.lua
or
in the startup write :
dofile("your_file's_name.lua")
near the bottom ...
k !!! ^_^
Now , i want know , if is possible!!! , the parameter of :
function (chat , user , txt ) !!!!! .....and much morE???
Function (pm , user ) ????.......
I understand fuction (chat ,user , txt ) ,but i don know other parameter !!!
there is a LIST , a DOC , for KNOW the PARAMETER to PASS at FUNCTION?!?! !!!! :??
dcpp:setListener( "chat", "bier",
function( hub, user, text )
local s = string.lower( text )
if string.find( s, "[^a-z]bier+[^a-z]" ) or string.find( s, "[^a-z]biertje[^a-z]" ) then
hub:sendChat( "bier? ja lekker! :)" )
end
end
)
This is the example listener from startup.lua ....
watch it carefully ..
setListener is found in the startup.lua ... and it is like this ...
dcpp.setListener = function( this, ltype, id, func )
if not dcpp._listeners[ltype] then
dcpp._listeners[ltype] = {}
end
dcpp._listeners[ltype][id] = func
end
a general description to setup a listener is like this ...
dcpp:setListener(what_to_listen, the_name_of_this_listener, function(argument1, argument2 ,.... )
-- Whatever you want this listener to do ...
end
)
Why you ask "where the variable 'this' went??" u ask .. well there is the trick ...
dcpp.setListener = function( this, ltype, id, func )
is the same with saying dcpp:setListener(ltype,id,func)
the " : " passes the dcpp table as an arggument to the function ..
more ltypes are :
chat /// f( hub, user, "message" )
ownChat //// f( hub, "message" )
ownChatOut /// f( hub, "message" )
pm /// f( hub, user, "message" )
hubPm /// f( hub, user, "message which may include a " )
connected /// f( hub )
disconnected /// f( hub )
userConnected /// f( hub, user )
userMyInfo /// f( hub, user, "$MyINFO $ALL ... 1234$|" )
userQuit /// f( hub, user )
timer /// called every second, use dcpp:getHubs()[k]:getAddress() to select a hub
f()
more info on their use look in startup.lua ... go in Ctrl+F and search it .... or the rest of the default scripts ...
Also some others made by ppl around here and in other forums may help ...
Thankz !!!! HERODES !! ^__________^
Now iI try !!!!! :p
QuoteOriginally posted by ???M?N??R??????
Thankz !!!! HERODES !! ^__________^
Now iI try !!!!! :p
you are welcome ...
good luck ...
RE-Thankz!!!! :P !!!!
If I have any problem , I ask U !!! :))
mmmmmm , now i Think :P , the parameter of :
hub:sendChat ( "" ) ?? are the same of function(=>hub , user , text ) .. ??
so , exmaple user: sendPM ("") , is correct?
no it is not ...
show me the script u are working on and i will try to help ...
For example , i Want DO (and i know it isn t EASY) an ANti Spam for my y hub with DCDM!!! So , i want Scanner ALL pvt of user ,and when i found a hub adress i KICK this user !!! but I DOn t KNOW the function for scanner PVT !!!! :??
HELPPPPPP :( :(
you cant scan pm's in yhub ... and that anti spam scirpt you are talking of is not simple in nature ...
spam/flood can be expressed in more ways that MainChat and PMs ... like $MyINFO , $Search ....
before you start your script you need to know what is it exactly that you need to script ...
make up your mind and then I'll help you to find out if it is possible to do it ...
mmmmmmmmmmm .......Its not Easy really?!!?!
but , i don t KNOW : $MyINFO , $Search .... !!!! U have a guide?!?! or a texto for the lesson of like $MyINFO , $Search .... ?!?!!?
so , for scan MAIN CHAT is possible , the impossible is the PVT !!! AZZ
HEYYYYY !!!!
do u have a guide for $MyInfo or $Search ?!?!?!!!
Quotebefore you start your script you need to know what is it exactly that you need to script ...
but , I asked U a Guide , or a little lesson !!!! :P :P
Look in the DC Protocol Documentation (http://wza.digitalbrains.com/DC/doc/Introduction.html) ... under the Command Types (client to server) (http://wza.digitalbrains.com/DC/doc/Command_Types_(client_to_server).html) part ...
as for grabbing stuff from it do a search in this forum for " $MyINFO $ALL%s(%S+) " and you will meet some nice strfind lines ... use those ...
but remember that the scripts in here are Lua4 client-side uses Lua5 ..
so strfind = string.find and so on ..
regular expressions remain the same ...