Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 02:27

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



AutoIt piece of code explain

Discussion on AutoIt piece of code explain within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2014
Posts: 43
Received Thanks: 1
AutoIt piece of code explain

Hi, it passed a long time since i was here and i get back

I found some interested piece of code so if anyone can explain me what he do i will be very appreciate.

Just please dont tell me to , i do but it is too complicated.

Code:
$tmp = StringRegExp(FileRead($file), '(?s)\[(\d+)\].*?\v1=(\V+)', 3)

;~  _ArrayDisplay($tmp, "Results")

Redim $matches[UBound($tmp)/2][3]
For $i = 0 to UBound($tmp)-1 step 2
	$matches[$i/2][0] = $i/2
	$matches[$i/2][1] = $tmp[$i]
	$matches[$i/2][2] = $tmp[$i+1]
Next
LiveLong23 is offline  
Old 08/29/2015, 21:42   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
It regexes a file which is built up probably like this
Code:
    [8888]abcde   1=
(?s) according to regex101 means: s modifier: single line. Dot matches newline characters
The \[(\d+)\] catches numbers which look like this [12345] [2132123] [12]
and the .*? means that it matches anything between the number and the \v.
The \v stands for a vertical tab sign and finally the (\V+) matches all the vertical tabs after the equal sign.

That's as much as I can see, there might be a few errors though.
alpines is offline  
Thanks
1 User
Old 08/29/2015, 21:57   #3
 
elite*gold: 0
Join Date: Jan 2014
Posts: 43
Received Thanks: 1
And what about
Code:
Redim $matches[UBound($tmp)/2][3]
For Redim stand in help file

Resize an existing array.

ReDim $aArray[subscript 1]...[subscript n]

Parameters
-$aArray The name of the array to resize.
-subscript The number of elements to create for the array dimension, indexed 0 to n-1.

Then this one
Code:
$matches[UBound($tmp)/2]
Returns the size of array dimensions.

UBound ( Array [, Dimension = 1] )

Parameters
Array The array variable which is being queried.
Dimension [optional] Which dimension of a multi-dimensioned array to report the size of:
$UBOUND_DIMENSIONS (0) = Number of subscripts in the array
$UBOUND_ROWS (1) = Number of rows in the array (default)
$UBOUND_COLUMNS (2) = Number of columns in the array
Constants are defined in Constants.au3

Return Value
Success: the size of the array dimension.
Failure: 0 and sets the @error flag to non-zero.
@error: 1 = Array given is not an array.
2 = Array dimension is invalid.

So what it all do and this one too

Code:
For $i = 0 to UBound($tmp)-1 step 2
	$matches[$i/2][0] = $i/2
	$matches[$i/2][1] = $tmp[$i]
	$matches[$i/2][2] = $tmp[$i+1]
Next
LiveLong23 is offline  
Old 08/30/2015, 13:03   #4
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
It iterates in a for loop from 0 to the size of $tmp -1 in 2 steps.
So it goes like this
Code:
For $i = 0 To 10 Step 2
$i = 0
$i = 2
$i = 4
.
.
.
The code inside the for loop rearranges the matches in a way that the script can handle it better.
In $matches[$i/2] you see that the $tmp Array contains 2 founds for every "line" therefore $i / 2 is used.
In [0] the index of the found is stored. ($i/2)
In [1] the 1. found of the "line" is stored ($tmp[$i])
In [2] the 2. found of the "line" is stored ($tmp[$i+1])
alpines is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
I need a piece of code :P
08/28/2012 - CO2 Private Server - 12 Replies
Hey, first post! Been a lurker for four years, not just this summer. I use a loft source, I would like to know the packet/code to open up a website from the game client. Thanks!
[Help] A piece of code ^^
08/10/2009 - CO2 Private Server - 5 Replies
I need the code, rather, the line to make a monster does appear after speaking with an NPC. I have this: SingleMob FG = new SingleMob((short)MyChar.LocX, (short)MyChar.LocY, (short)MyChar.LocMap, 65535, 65535, 2500, 3000, 1007, "FaisanGigante", 104, 115, 0, 0, 0, true); Mobs.AllMobs.Add(FG.UID, FG); World.SurroundMobs(MyChar, false); But this creates a Spawn and the monster is created to die again and I need...



All times are GMT +1. The time now is 02:27.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.