what is the diffrence in data arrivals?
 

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

what is the diffrence in data arrivals?

Started by SaintSinner, 26 January, 2004, 16:00:08

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SaintSinner

hello friends,
im learning to script and i have a question of diffrent
data arrivals [DA], i know what [DA] means, but why so many diffrent variations and is there a set way of
having a [DA] function.

here are some that i found
they all look the same but diffrent
how do i know what each means




function DataArrival(userdata
if(
strsub(data14) == "$To:"then 
data
=strsub(data,1,strlen(data)-1
s,e,whoTo strfind(data,"$To:%s+(%S+)"


function 
DataArrival(userdata
	
if( 
strsub(data11) == "<" then 
	
	
data=strsub(data,1,strlen(data)-1
	
	
s,e,cmd,arg strfinddata"%b<>%s+(%S+)%s+(.*)" 
	
	
if (
arg==nilthen 
	
	
	
s,e,cmd strfinddata"%b<>%s+(%S+)%s*" 


function 
DataArrival(curUserdata)
	
if 
strsub(data11) ~= "<" then return end
	
local secmdargs strfind(data"^%b<> %!(%a+)%s*(.*)%|$")


function 
DataArrival(user,data)
	
if 
strsub(data11) == "<" then
	
	
data=strsub(data,1,strlen(data)-1)
	
	
s,e,cmd strfind(data,"%b<>%s+(%S+)")


function 
DataArrival(curUserdata)
	
if (
strsub(data11) == "$" and curUser.iProfile==-and strfind(data"ConnectToMe")) then




function DataArrival(userdata
if (
strsub(data,1,1) == "<"then 
data 
strsub(data,1,strlen(data)-1
local s,e,cmd nil 
s
,e,cmd strfinddata"%b<>%s+(%S+)" 








   


[NL]Pur

weird script

i don't see use for more dataarrivals

and the missing all a

end

SaintSinner

QuoteOriginally posted by [NL]Pur
weird script

i don't see use for more dataarrivals

and the missing all a

end


LOL no pur
those are diffrent [DA] that i found in some scripts,
and i wanted to know how do i know what the diffrence
is and what each one does,....how do you read a [DA]?
   


NightLitch

Short explaination from me, becouse have just learn a few more
things about this.

for start

Always only one DataArrival

"<" = Catching what going on in mainchat

"$To" = Catch what going between users or Bot

"$MyInfo" = catching myInfo

the numbers stand for the letters/symbols

ex:

"$To: "

This will be:

if(strsub(data, 1, 5) == "$To: ") then

then it can be like this to

"$To:"

if(strsub(data, 1, 4) == "$To:") then

and

"$To"
if(strsub(data, 1, 3) == "$To") then

this is what I have learn in this so far for this.

hope it helps some.
//NL

kepp

#4
function DataArrival(user, data)
^^ --> Pretty Obvious ;)

if(strsub(data, 1, 4) == "$To:") then

"$To:"    <---- There are 4 Characters inside those double Quotes, That's why the number 4 is there! :)
Which means if it finds any data in "$To:" then

data=strsub(data,1,strlen(data)-1)
^^ -- Remove end pipe if im not wrong?

s,e,whoTo = strfind(data,"$To:%s+(%S+)")
^^ <---- Here you set "WhoTo" to (%S+)

It will search for something like this:

$To:


function DataArrival(user, data)
    if( strsub(data, 1, 1) == "<" ) then
^^ <--- 1,1 is main, Keep that in memory

        data=strsub(data,1,strlen(data)-1)
        ^^ <---- Remove end pipe

        s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.*)" )

      ^^ <----- %s+ = SPACE while %S+ is everything without a space

think of it like this, the cmd is the first thing you find in Inside parantheses, While the arg = (.*)
Which means anything actually

        if (arg==nil) then

      ^^ if arg is equal to nil then

            s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*" )


function DataArrival(curUser, data)
    if strsub(data, 1, 1) ~= "<" then return end

    ^^  This one however, You probably know that == means Equality, This ~= is the other way around.
So, If it finds anything else that IS NOT in main then
   
    local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")


function DataArrival(user,data)
    if strsub(data, 1, 1) == "<" then
        data=strsub(data,1,strlen(data)-1)
        s,e,cmd = strfind(data,"%b<>%s+(%S+)")


function DataArrival(curUser, data)
    if (strsub(data, 1, 1) == "$" and curUser.iProfile==-1 and strfind(data, "ConnectToMe")) then

"$" <-- ONE character, that's why again we have 1,1
and if user is a "Normal" user and if it finds $ConnectToMe from that user then
return 1
end?



function DataArrival(user, data)
if (strsub(data,1,1) == "<") then
data = strsub(data,1,strlen(data)-1)
local s,e,cmd = nil
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )


^^ I have no idea :S
Guarding    

[NL]Pur

oh ok, lol


if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")

this one is for if you want that commands only can be
used by sending them in a pm too a bot



function DataArrival(user, data)
    if( strsub(data, 1, 1) == "<" ) then
        data=strsub(data,1,strlen(data)-1)
        s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
        if (arg==nil) then
            s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*" )


this one has commands with and without 1 argument



function DataArrival(curUser, data)
    if strsub(data, 1, 1) ~= "<" then return end
    local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")


this one hs commands with 1 argument



function DataArrival(user,data)
    if strsub(data, 1, 1) == "<" then
        data=strsub(data,1,strlen(data)-1)
        s,e,cmd = strfind(data,"%b<>%s+(%S+)")


just for command without arguments


function DataArrival(curUser, data)
    if (strsub(data, 1, 1) == "$" and curUser.iProfile==-1 and strfind(data, "ConnectToMe")) then


This is apply's too normal users -1 ,  when they connect
too a other client




function DataArrival(user, data)
if (strsub(data,1,1) == "<") then
data = strsub(data,1,strlen(data)-1)
local s,e,cmd = nil
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )?>


same as earlier only sets the varibles first too nil
and is for command without arguments

SaintSinner

#6
WOW :D

pur
kepp
Nightlitch

thanks alot guys,
very good explanations,
very much appreciated.
i will read this over and over again.


P.S. what does
"remove end pipe" mean?
   


kepp

#7
curUser:SendData(Bot, "Hello|")

Notice "|"


Which means you will remove that one.

I suppose it is like the example above...?

No problem, :)
Guarding    

[NL]Pur

the pipe isn't needed but if you want too send a hello

you must add a $ before it

kepp

Ok, so no matter what,
You still need to add any of those two characters? "|", "$" unless you don't put that line of code in DataArrival function()?
Guarding    

pHaTTy

QuoteOriginally posted by kepp
Ok, so no matter what,
You still need to add any of those two characters? "|", "$" unless you don't put that line of code in DataArrival function()?

uh, no | is to break line, so basically if you do user:SendData(Bot,"whateer")

or

user:SendData(Bot,"whaver|")

wont make any differ except because ptokax will already do this after it sends the data so no need, as for $ its for commands, used as a key

user:SendData("$Hello ".."name")

this will make a name appear in the userlist

but i dont now what ur getting at
Resistance is futile!

kepp

Guarding    

pHaTTy

ok a few things i will add, mainly about the way i usually use "
function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")

ok strsub is finding the main keys such as $To etc, so i wont go over that unless u need help with it, removing the endpip is explained also Brrrr, and as for strfind < my fav :p

so this is about local and global

word = "whatevr" << global < usually outside the functions

local word = "whatever"
s,e,cmd = strfind(data,"%b<>%s+(%S+)") --global
local s,e,cmd = strfind(data,"%b<>%s+(%S+)") --local


x (where x is not one of the magic characters ^$()%.[]*+-?) --- represents the character x itself.
. --- (a dot) represents all characters.
%a --- represents all letters.
%c --- represents all control characters.
%d --- represents all digits.
%l --- represents all lowercase letters.
%p --- represents all punctuation characters.
%s --- represents all space characters.
%u --- represents all uppercase letters. %x --- represents all hexadecimal digits.
%z --- represents the character with representation 0.
%x (where x is any non-alphanumeric character) ---
%w --- represents all alphanumeric characters.
represents the character x. This is the standard way to escape the magic characters. Any punctuation character (even the non magic) can be preceded by a `%? when used to represent itself in a pattern.

pHaTz,,
Resistance is futile!

SMF spam blocked by CleanTalk