Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: rulk on September 07, 2009, 11:42:37 pm
-
Hya guys,
This is my version of extracting the clan tag from a players name.
It uses mIRC's regex engine and is pretty fast because strings are cached before using them.
; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered:
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Note: Combinations are also valid.
; --------------------------
alias FindClanTag {
var %HasTag = $regex( $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
if (%HasTag > 0) return $regml(1)
}
Some superb regex tutorials and one hour tests can be found at #regex on the undernet network "irc.undernet.org"
alternatively, you might find reading THIS WEBSITE (http://www.regular-expressions.info/tutorial.html) beneficial
I have enjoyed using both methods and can be found taking the regex tests quite regularly, if you need any assistance in breaking down this particular expression, don't hesitate to ask me.
Hope this helps you guys.
Kind Regards
Luke Rudge (rulk)
-
ok tranks :)
-
Hya guys,
Here is an update on the clan tag extraction using mIRC's regex engine.
It now covers both single and double delimiter clan tags (apologies to ULK. for excluding them)
I have decided not to couple both expressions into one, to eliminate confusion for beginners.
I recommend that unless this update is needed you stick with the one in the first post.
; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK_ ULK=
;
; Note: Combinations are also valid for double delimiter tags.
; Note: Combinations are NOT valid for single delimiter tags
; --------------------------
alias FindClanTag {
var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
var %Single_Delim = $regex( S_DELIM, $1, (\w+[.=_]+) )
return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}
Happy coding.
Kind Regards
Luke Rudge (rulk)
-
Very nice!
-
the underscore isn't a good idea for a clan tag detection
like if The_Don comes in without a tag, the clan would be "The"
-
Great Alias rulk, but would u please rewrite the alias so it does not detect the ULK_ ?
Thanks in advance
-
the underscore isn't a good idea for a clan tag detection
like if The_Don comes in without a tag, the clan would be "The"
wrong
that will happend if his nick was :
_The_Don
-
the underscore isn't a good idea for a clan tag detection
like if The_Don comes in without a tag, the clan would be "The"
wrong
that will happend if his nick was :
_The_Don
?_?
; Tags Covered: (Single Delimiter)
; ULK. ULK_ ULK=
i meant only 1
-
Hya Guys,
Tag detection without an underscore for single delimiter
; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK=
;
; Note: Combinations are also valid for double delimiter tags.
; Note: Combinations are NOT valid for single delimiter tags
; --------------------------
alias FindClanTag {
var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
var %Single_Delim = $regex( S_DELIM, $1, (\w+[.=]+) )
return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}
Any other combinations that need to be removed/added let me know
Kind Regards
Luke Rudge (rulk)
-
Great work rulk! Ideal for clan stats etc.
Btw. the code looks a bit complicated ;D.
Anyway, there is a polish clan with tag L.Team*. Using this script should return "L"...
/me wonders why clans cant have tags in [ ]
-
Hya [AoD]NC,
Theres going to be a few tags that wont be catered for, but as they pop up, its simple to add them.
Here is a special edition for your polish friends.
; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK= L.Team*
;
; Note: Combinations are also valid for double delimiter tags.
; Note: Combinations are NOT valid for single delimiter tags
; --------------------------
alias FindClanTag {
var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
var %Single_Delim = $regex( S_DELIM, $1, (\w.+[.*=]+) )
return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}
Hope this helps
Kind Regards
Luke Rudge (rulk)
-
Hey, rulk.
I've read the codes, But I still didn't understood why is this nessecary?
-
its in the titel
-
Hya Guys,
Here is an amended version, thanks for your comments so far.
kaje: Its a small snippet aimed at people that wish to obtain the clan tag from the players name for whatever purposes they desire.
; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK= L.Team*
;
; Note: Combinations of characters are also valid for
; both double and single delimiter tags.
; --------------------------
alias FindClanTag {
var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
var %Single_Delim = $regex( S_DELIM, $1, (\w.+[.*=]+) )
return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}
Dont forget, if there is any combination that you require me to add/remove dont hesitate to ask.
Kind Regards
Luke Rudge (rulk)
-
Rulk u are pr0! :D
-
Hya Guys,
Here is an amended version, thanks for your comments so far.
kaje: Its a small snippet aimed at people that wish to obtain the clan tag from the players name for whatever purposes they desire.
; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK= L.Team*
;
; Note: Combinations of characters are also valid for
; both double and single delimiter tags.
; --------------------------
alias FindClanTag {
var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
var %Single_Delim = $regex( S_DELIM, $1, (\w.+[.*=]+) )
return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}
Dont forget, if there is any combination that you require me to add/remove dont hesitate to ask.
Kind Regards
Luke Rudge (rulk)
Thank you for explaining me.
-
do this work ?