Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. function FindClan( strPlayer )
  2.  
  3. {
  4.  
  5. local
  6.  
  7. D_DELIM = regexp(@"([\[(=^<{]+\w+[\])=^>}]+)"),// Checking for double delimiter like [TX],{TX},(TX),=TX=,^TX^,<TX>
  8.  
  9. D_DELIM_SYM_2 = regexp(@"([\[(=^<{]+\w+[\.*-=]+\w+[\])=^>}]+)"), // Checking the presence of symbolic clan tag with 2 alphanumeric values like [T-X]Azazel [ Double Delimiter ]
  10.  
  11. D_DELIM_SYM_3 = regexp(@"([\[(=^<{]+\w+[\.*-=]+\w+[\.*-=]+\w+[\])=^>}]+)"), // Checking the presence of symbolic clan tag with 3 alphanumeric values like [F.O.X]Sofia [ Double Delimiter ]
  12.  
  13. S_DELIM = regexp(@"(\w.+[.*=]+)"), // Checking for single delimiter like VT. VT= VT*
  14.  
  15.  
  16.  
  17. D_DELIM_res = D_DELIM.capture(strPlayer),// Capturing for the double delimiter expression in player.Name [ will return some array blocks of clan as [TX] < WITH THE CLAN TAG SYMBOL INCLUDED>]
  18.  
  19. D_DELIM_SYM_2_res = D_DELIM_SYM_2.capture(strPlayer), // Capturing for T-X / T.X / T*X Type
  20.  
  21. D_DELIM_SYM_3_res = D_DELIM_SYM_3.capture(strPlayer), // Capturing for F-O-X / F.O.X / F*O*X Type
  22.  
  23. S_DELIM_res = S_DELIM.capture(strPlayer); // Capturing for the single delimiter expression in player.Name [ will return some array blocks as VT. < WITH THE CLAN TAG SYMBOL INCLUDED>]
  24.  
  25.  
  26.  
  27. if ( D_DELIM_res != null ) // Are captured expressions true ? Do they physically exist in memory?
  28.  
  29. {
  30.  
  31. return strPlayer.slice( D_DELIM_res[ 0 ].begin + 1, D_DELIM_res[ 0 ].end - 1 ); // Slicing [TX] into TX by moving 1 step forward from beginning & same step backward from the end
  32.  
  33. }
  34.  
  35. else if ( D_DELIM_SYM_2_res != null )
  36.  
  37. {
  38.  
  39. local tag_sym_2 = strPlayer.slice( D_DELIM_SYM_2_res[ 0 ].begin + 1, D_DELIM_SYM_2_res[ 0 ].end - 1 ); // Slicing [T-X] into T-X by moving 1 step forward from beginning & same step backward from the end
  40.  
  41. local amalgamate_2 = split(tag_sym_2, ".*-="); // Splitting T-X into 2 array blocks like a[0] = T, a[1] = X [ DEFINED BY SEPARATORS ]
  42.  
  43. return (amalgamate_2[0]+amalgamate_2[1]); // Returning the Sum i.e. TX
  44.  
  45. }
  46.  
  47. else if ( D_DELIM_SYM_3_res != null ) // Are captured expressions true ? Do they physically exist in memory?
  48.  
  49. {
  50.  
  51. local tag_sym_3 = strPlayer.slice( D_DELIM_SYM_3_res[ 0 ].begin + 1, D_DELIM_SYM_3_res[ 0 ].end - 1 ); // Slicing [F.0.X] into F.O.X by moving 1 step forward from beginning & same step backward from the end
  52.  
  53. local amalgamate_3 = split(tag_sym_3, ".*-="); // Splitting F.O.X into 3 array blocks like a[0] = F, a[1] = 0, a[2] = X [ DEFINED BY SEPARATORS ]
  54.  
  55. return (amalgamate_3[0]+amalgamate_3[1]+amalgamate_3[2]); // Returning the Sum i.e. FOX
  56.  
  57.  
  58.  
  59. }
  60.  
  61. else if ( S_DELIM_res != null )
  62.  
  63. {
  64.  
  65. return strPlayer.slice( S_DELIM_res[ 0 ].begin, S_DELIM_res[ 0 ].end - 1 ); // Slicing VT. into VT by moving 1 step backward from the end
  66.  
  67. }
  68.  
  69. else return null; // No such expressions found? Probably player isn't in a clan. Let's return null !!!
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement