Author Topic: what is the diffrence in data arrivals?  (Read 3625 times)

0 Members and 1 Guest are viewing this topic.

Offline SaintSinner

  • Lord
  • ***
  • Posts: 293
  • Karma: +1/-0
what is the diffrence in data arrivals?
« on: 26 January, 2004, 16:00:08 »
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+)" 








   


PtokaX forum

what is the diffrence in data arrivals?
« on: 26 January, 2004, 16:00:08 »

[NL]Pur

  • Guest
(No subject)
« Reply #1 on: 26 January, 2004, 16:35:45 »
weird script

i don't see use for more dataarrivals

and the missing all a

end

Offline SaintSinner

  • Lord
  • ***
  • Posts: 293
  • Karma: +1/-0
(No subject)
« Reply #2 on: 26 January, 2004, 16:52:34 »
Quote
Originally 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]?
   


Offline NightLitch

  • Emperor
  • **
  • Posts: 1 455
  • Karma: +16/-0
(No subject)
« Reply #3 on: 26 January, 2004, 16:59:37 »
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

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #4 on: 26 January, 2004, 17:20:10 »
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
« Last Edit: 26 January, 2004, 17:22:47 by kepp »
Guarding    

[NL]Pur

  • Guest
(No subject)
« Reply #5 on: 26 January, 2004, 17:31:36 »
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

Offline SaintSinner

  • Lord
  • ***
  • Posts: 293
  • Karma: +1/-0
(No subject)
« Reply #6 on: 26 January, 2004, 18:09:55 »
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?
« Last Edit: 26 January, 2004, 18:10:49 by SaintSinner »
   


Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #7 on: 26 January, 2004, 18:12:49 »
curUser:SendData(Bot, "Hello|")

Notice "|"


Which means you will remove that one.

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

No problem, :)
« Last Edit: 26 January, 2004, 18:14:30 by kepp »
Guarding    

[NL]Pur

  • Guest
(No subject)
« Reply #8 on: 26 January, 2004, 18:20:56 »
the pipe isn't needed but if you want too send a hello

you must add a $ before it

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #9 on: 26 January, 2004, 18:25:21 »
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    

Offline pHaTTy

  • Forum Legend
  • ***
  • Posts: 1 916
  • Karma: +5/-1
(No subject)
« Reply #10 on: 26 January, 2004, 18:55:38 »
Quote
Originally 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!

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #11 on: 26 January, 2004, 21:42:22 »
Me Neither, lol
Guarding    

Offline pHaTTy

  • Forum Legend
  • ***
  • Posts: 1 916
  • Karma: +5/-1
(No subject)
« Reply #12 on: 26 January, 2004, 22:01:17 »
ok a few things i will add, mainly about the way i usually use "
Code: [Select]
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!

PtokaX forum

(No subject)
« Reply #12 on: 26 January, 2004, 22:01:17 »