I'm e "newbie" of SCRIPT !!! for DCDM client
 

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

I'm e "newbie" of SCRIPT !!! for DCDM client

Started by ???M?N??R??????, 14 October, 2004, 10:49:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

???M?N??R??????

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

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
? ??M?N??R????[/COLOR]    ?
The OWN of : ? - ? ? ? ? ? ` ? ? ? ?   I T A L I A N  ?  S A L O O N     ? ? ? ? ` ? ? ? ? ? ? - ?  

Herodes

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

???M?N??R??????

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?!?! !!!! :??
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
? ??M?N??R????[/COLOR]    ?
The OWN of : ? - ? ? ? ? ? ` ? ? ? ?   I T A L I A N  ?  S A L O O N     ? ? ? ? ` ? ? ? ? ? ? - ?  

Herodes

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

???M?N??R??????

Thankz !!!! HERODES !! ^__________^  

Now iI try !!!!! :p
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
? ??M?N??R????[/COLOR]    ?
The OWN of : ? - ? ? ? ? ? ` ? ? ? ?   I T A L I A N  ?  S A L O O N     ? ? ? ? ` ? ? ? ? ? ? - ?  

Herodes

QuoteOriginally posted by ???M?N??R??????
Thankz !!!! HERODES !! ^__________^  

Now iI try !!!!! :p
you are welcome ...
good luck ...

???M?N??R??????

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?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
? ??M?N??R????[/COLOR]    ?
The OWN of : ? - ? ? ? ? ? ` ? ? ? ?   I T A L I A N  ?  S A L O O N     ? ? ? ? ` ? ? ? ? ? ? - ?  

Herodes

no it is not ...

show me the script u are working on and i will try to help ...

???M?N??R??????

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  :(  :(
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
? ??M?N??R????[/COLOR]    ?
The OWN of : ? - ? ? ? ? ? ` ? ? ? ?   I T A L I A N  ?  S A L O O N     ? ? ? ? ` ? ? ? ? ? ? - ?  

Herodes

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

???M?N??R??????

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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
? ??M?N??R????[/COLOR]    ?
The OWN of : ? - ? ? ? ? ? ` ? ? ? ?   I T A L I A N  ?  S A L O O N     ? ? ? ? ` ? ? ? ? ? ? - ?  

???M?N??R??????

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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
? ??M?N??R????[/COLOR]    ?
The OWN of : ? - ? ? ? ? ? ` ? ? ? ?   I T A L I A N  ?  S A L O O N     ? ? ? ? ` ? ? ? ? ? ? - ?  

Herodes

Look in the DC Protocol Documentation ... under the Command Types (client to server) 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 ...

SMF spam blocked by CleanTalk