DASH_library COMREF:
Arrays – array (vector) processing
Uses module System
Used in
module Inventory
Array call inverse – inverse array
[Integer,Item]call populate -
repeat element Item Integer
times
[Array,N]call take – take
first N elements from Array (take from left if N>0, take
from right if N<0)
NumericArray call sum – sum of array elements
NumericArray call product – product of all array elements
[NumArray1,NumArray2]call withoutN – alternative realization of
{NumArray1- NumArray2}.
[[1,2,2,3,3,3],[3,1,2]] call withoutN returns [2,3,3]
[StringArray1,StringArray2]call withoutS – alternative
realization of
{StringArray1- StringArray2}.
[[«m4»,«m4»,«m60»],[«m4»,«m21»]] call withoutS returns [«m4»,«m60»]
[Array,N] call takeRnd –
take N elements from array with random non-repeating
indexes.
[Array,Condition]call splitByRule - split Array into 2 parts using
string Condition
(if (element call Condition)==true then put it into first array else put it to second one)
[Array,Indexes]call idxToStart – shift elements with Indexes to the head of Array
[Array,Indexes]call idxToEnd - shift elements with
Indexes to the tail of Array
[Array,ConditionList]call bestFit – element
of Array, what best fit to the ConditionList
[Array1,Array2]call merge2Sorted – merge
2 ordered in ascending order arrays
[Array,ArrayOfArrays]call splitByArrays - split elements of
Array among the
ArrayOfArrays
Arithmetic progressions
[start,end,step]call makeArray – numeric array from start, not exceed end,
with step.
[start,end]call makeArray -
(default step=1)
[Array1,Array2] call compareArrays –
compares 2 arrays element by element.
[Array1,Array2] call compareHeaps – compares 2 arrays with
no respect to element order
[Array,IntegerArray]call idxTake – takes
elements from Array with indexes
IntegerArray (repeating
is possible). Returns
an array.
[Array,IntegerArray]call idxDelete – remove elements from Array with indexes
IntegerArray (repeating
is possible). Returns an «cleaned» array.
ArrayOfArrays call allVariants – all combinations:
for [[true,false],[1,2,3],[«a», «b»]]it will be an array
of 12 arrays –
from [true, 1, «a»] to [false, 3, «b»]
Array call pop – remove last element
of array and return it
[Array,element]call pushNew – if element(non-array var) is not in Array
then add ‘em to the end of Array, do nothing overwise
6 functions below returns array as a result:
[Arr,Nmb]call arrayAddNumber – add number to
each element of array.
[Arr,Nmb]call arrayMultNumber - mult number to
each element of array
[Arr,NotArr]call arrayFncNumber – call function
with each pair of
Arr elements and NotArr
variable as arguments
[Arr1,Arr2]call arrayAddArray – add one array to another element-by-element
[Arr1,Arr2]call arrayMultArray - multiple one
array to another element-by-element
[Arr1,Arr2]call arrayFncArray – call function
with each pair of correspondent
elements of 2 arrays
Examples: Arrays.Intro,
Arrays2.Intro and Arrays3.Intro
Convertion – converts one values to
another ones
Independent
module
Angle call angle2hour
– degrees 0-360 to hours 1-12
Angle call angle2compass
- degrees 0-360 to compass bearing (string)
[X,Y]call pos2Grid or
[[X,Y],
IsDefaultOFPmap]call pos2Grid [X,Y]coordinates to grid name(string).
Grid can be in AA## (OFP default)or ######
(NATO map) format.
[Oclock,TimeFormat] call time2string – format
time Oclock (in hours)according pattern TimeFormat.
Defined patterns: "HH", "HHMM", "HH:MM",
"HH:MM:SS", "HH:MM:SS:MM".
Default pattern is "HHMM" («military time» in
Number call int2Array
– number to array of digits
StrQuad call grid2Pos or
[StrQuad, IsDefaultOFPmap]
call grid2Pos - grid
name(string)to [X,Y]coordinates.
Grid can be in AA## (OFP default)or ###### (NATO map) format.
[Array]call arr2String – merge array elements into 1 string, using space as
delimiter
or
[Array,String]call arr2String - merge array elements into 1 string, using String as delimiter
Int call dec2Bin - integer Int to
«binary» array of 0 and 1
Str call miltime2Daytime – miltime string like «0630» to float day
time(0.0000-23.9999)
[FloatValue,StrFrom,StrTo]call
convert - convert FloatValue from one
metric/imperial
units of length to another.
Available units:
"ml","yd","ft","in","cm","m","km".
Examples: Convertion.Intro
EH– functions to work
with EHs + event handling scripts (“CustomEHs”)
Independent
module
[Owner,EHType,CodeToRun]call AddCustomEH or
[ArrayOfOwners,EHType,CodeToRun]call AddCustomEH – adds
Owner/Owners(unit(s), group(s) or something)
to the inner script, what fires CodeToRun if event of type EHType
occures with Owner(s).
In CodeToRun you usualy can use 3 values (_this select 0/1/2) what EH
returns – the Owner of event, old value of control parameter and new value of
it (for "rating" EH it’s {rating _this}). But CEHs "weapons" && "magazines" return 5 values:
0-unit,1-old set, 2-new set, 3-what’s added?, 4-what’s dropped?
To awoid “bottle neck” effect use array of owners for multiple CEH
addition.
If you add 2 or more custom EH of same type for same Owner, only the
last CodeToRun will be used. Available types of custom EHs:
"rating","behaviour","health","canstand","ammoprimary","primary","secondary",
"canmove","canfire","crew","crew3","weapons","magazines","freefall".
[Owner,EHType]call RemoveCustomEH – very similar
to {unit RemoveAllEventHandlers "type"}.
Owner will be removed from inner script of type EHType.
[Array1,Array2]call CompareArrays
– compare 2 arrays of same type.
Returns boolean. Copied from Arrays
module.
Each CEH type has predefined loop delay, which can be shortened for
better reaction
or prolonged for performance reasons.
[EHType,Number]call SetCEHDelay – set main loop delay
for particular CEH type.
Actual time between 2 checks of one CEH owner is slightly bigger then
delay/number of owners of this CEH.
[StringArray1,StringArray2]call withoutS
– alternative realization of
{StringArray1- StringArray2}.
[[«m4»,«m4»,«m60»],[«m4»,«m21»]] call withoutS returns [«m4»,«m60»].
Copied from Arrays module.
firedEHInfo call shotGeometry – return array
of shot information,
the elements of array are:
0th – fired bullet (object);1st - starting position; 2d - velocity 3D
vector;
3th – speed; 4th - horizontal angle; 5th – vertical
angle.
Made to use with «fired»
conventional EventHandler.
Examples: CustomEH.Intro and
CustomEH2.Intro
Environ – interaction with environment
Independent
module
call isNight - return true in night time. Not accurate.
Position call inWater
- return true, if Position is
under water
Obj call inTown
- return true, if object is in town/in village
Building call count_BuildingPos – number of predefined
positions in Building
[Position,Radius] call inForest - true, if there is a forest in the range of Radius
meters from Position (several trees!=forest).
Number call setTime – set time to number hours.
3 functions below works correctly, if starting levels of
fog and rain == 0,
and starting level of overcast
== 0.5.
Whis is default weather options in mission editor.
[Time, Level] call setFog2 –works like time setFog fog,
but also allows to find current fog level, which carried in fog
global variable
and changing while function setfog2 ends all work.
Time of fog level changing must be in seconds, fog
level must be in range 0(no fog)- 1(maximal possible fog)
[Time, Level] call setOvercast2 – clouds control, see setFog2
[Time, Level] call setRain2 – rain control, see setFog2
wind – not the function but usefull global variable. It contains current wind
direction in degrees and current wind
speed (meters per second)
call countStatic – count of static map
objects.
[Position,R] call groundSlope or
[Position,R,Step] call groundSlope - average slope and maximal slope direction
in radius R meters near Position, optional parameter
Step is a search step in degrees.
Examples: Environmental.eden,
Environmental2.eden
Geometry – different geometrical problems
Independent
module
obj call dirOfMove
– direction of moving object
Veh in degrees
[Watcher,Target] call facingDiff
– absolute difference
between face direction
of unit Watcher and the angle from
Watcher to object Target(in degrees)
[Watcher,Target] call dir2obj
– direction in degrees
from Watcher to Target
[Shelter,Guard,StepBack]call hiddenPos – find position StepBack meters behind
the Shelter, to hide some unit from the unit Guard
(Let Shelter be big enought, opaque and with no windows)
[obj1,obj2] call inFOV – true, if obj1 in field of view obj2
(less then 43 degrees from the sight line of obj1)
[obj1,obj2,FOV] call inFOV
– 3rd argument= custom field
of view angle/2
[obj1,obj2] call elevationAngle –vertical angle from obj1
to obj2. If obj1 is
located higher then obj2 then the result >0 degrees.
[Position1, Position2]
call dist2d
– distance between
positions on map
[Position1, Position2]
call dist3d
– distance between
positions in 3-D word
[Position1, Position2,proportion] call delimPoint
or [Position1,
Position2] call delimPoint – point
between 2 positions
which divides line segment in some proportion (default proportion = 1/1 = 1)
[Pos1,Pos2,Pos3] call triangleArea – triangle area with
sign of rotation. Clockwise direction of path
Pos1->Pos2->Pos3
cause negative result, counter-clockwise – positive.
[Position1, Position2]call lineParams – a and b coefficients
of the line Y=a*X+b,
painted from one position to another.
position call elevation – height of this point At
Sea Level
[pos,Range,Step]call highestLowest – return highest and
lowest
ASL positions in quad with side Range with some Step
[Pos1,Pos2] call dirToPos - direction
in degrees from Pos1 to Pos2
[Pos1,Pos2] call moveInfoClose – information for unit to move
from Pos1(his position) to Pos2. Returns 2D vector – [angle/10,distance/10]
[Pos,Rad] call overObstacle or
[Pos,Rad,ObjectArray] call overObstacle –
return true if where is an
obstacle
in radius Rad from position Pos, what makes impossible chopper
landing
on this position. You can define black list of obstacles,
which can be ignored.
[Unit1,Unit2] call tgtInfo or
[Unit,Pos]call tgtInfo
– return o’clock direction from unit to unit/pos
and most relevant of
these distances: [50,100,200,500,1000,2000,3500].
[Unit1,UnitArray]call nearestFromArray or
[Pos,UnitArray]call nearestFromArray – return
closest unit from UnitArray
to Unit1/Pos
Examples: Geometry.Intro and
Geometry2.Noe
Uses module System
[Unit1,Unit2]call isEnemy - is Unit2 a known enemy of Unit1
Unit call getGroupID or
Group call getGroupID – 2-element
vector with the group name
and group color
of particular unit/group
Unit call boss –unit becomes a leader in his group.
Unit call squadNumber –returns unit number in squad, this is a number
what unit use in group chat.
Group call groupIsCargo – check if all of the group members are in the
Cargo section of vehicle(s)
Group call getGroupSpeed – average speed
of group members
Group call getGroupSpread – effective
diameter of group
Group call mostInjured
– most dammaged unit in group
UnitArray call filterGroups – get group names from unit list
[Units,Angle]call watchDir – make units watch in
same direction
group call teleportGroup or
[groupleader,pos] call teleportGroup
– teleport all units of group in
their vehicles to pos
unitArray call any2Units or
group call any2Units or
trigger call any2Units – get unit array from any suitable
variable
unit call getIntSide – return 0 if east, 1 if west, 2 if resistance,
3 if civilian. Usefull for selecting side-specific values from array
(0th element for east, 1st
element for west...)
[ClassName,pos,grp]call createUnit2 or
[ClassName,pos,grp,initString] call
createUnit2
or
[ClassName,pos,grp,initString,skill] call
createUnit2
or
[ClassName,pos,grp,initString,skill,strRank] call createUnit2
–
very similar to "createUnit" native command, but also return new unit
as a result, and
enables to get his rank, despite of his further
rating changes.
GrpLeader call squadOrder – return units of some
leader in order of increasing
their squad numbers. Leader is always 0th.
UnitArray call enableQueryRank – enable ranking
functions to work with
the units from
UnitArray.
Unit call getRank
– get rank of Unit (string)
Unit call getRankID
– get rank of Unit (integer)
UnitArray call getBoss
– return unit with highest rank from UnitArray.
If all units have the same ranks, the most skilled one will be returned.
Examples: Groups.Intro, Groups2.Intro and Groups3.Intro
Inventory – weapons and magazines
Uses modules
System and Arrays
Man call emptySlots – number of empty
non-pistol slots of unit Man
Man call emptySlots2
- returns 2 numbers – number of empty
non-pistol slots
and number of empty pistol slots
of unit Man
Man call handgun
– name of the pistol slot item of unit Man
MagazineName call magMass – determines,
how many slots will occupy this type of
magazine
UnitArray call ammo3 – modificated function ammo. Returns 3-element vector, containing
projectile number for each of 3 slots: primary, secondary and pistol. For empty weapon slots element will be -1.
UnitArray call
allArmoury – returns 2 vectors: list of all weapons of unit array,
and list of all theirs magazines.
[UnitArray,WeaponNamesArray] call armedWith - returns 2 vectors:
list of units which has something from WeaponNamesArray
in inventory and
list of all unit’s guns, wich belongs to
WeaponNamesArray.
Names of weapons are registry-depended!
[UnitArray,MagazineNamesArray]
call equipedWith – returns 2 vectors:
list of units which has something from MagazineNamesArray
in inventory and
list of all unit’s mags, wich belongs to
MagazineNamesArray.
Names of magazins are registry-depended!
[UnitArray,WeaponName,MagazineName,IntMinimalMags] call armedAndEquiped –
returns vector of units, having
WeaponName and not less then IntMinimalMags
of MagazineName.
Man call radioState – radio state.
>0:radio can work, 0:no battery charge,-1: not
has radio.
[unitArray,strUnitType] call equipLikeThis – equip each unit in unitArray
with typical ammunition of strUnitType .
Unit call canFire2 – for soldiers returns true, if he has some ammo and
some weapon,
for wehicle returns true if guns are not heavy dammaged and there is at
least 1 charged gun.
Binoculars, nightvision and car horn are not considerated as weapons.
[Unit,
MagazineNamesArray]
call addMagazines or
[Unit,
MagazineName, MagsCount] call addMagazines – equip unit with all mags from MagazineNamesArray,
or equip him with MagsCount magazines of type MagazineName.
[Unit,
WeaponNamesArray]
call addWeapons – equip unit with all weapons from
array.
[Unit,OldMag,NewMag] call replaceMagazines or
[Unit,OldMagArray,NewMagArray] call replaceMagazines – replace one magazine
type(s)
to another type(s) in inventory of unit.
Unit call noSlotWeapons – all weapons of
unit which are not in (weapons unit)array,
like “Put” or “StrokeFist”.
Unit call weapons2 – ALL weapons of unit
including no slot weapons
[unitArray,[Name1,count1,Name2,count2...]] call addMagazinesM or
[Grp,[Name1,count1,Name2,count2...]] call addMagazinesM – add the same set
of magazines for multiple soldiers.
[VehicleArray,[Name1,count1,Name2,count2...]] call addMagazinesCargoM – set
the same set of magazines for multiple vehicles.
[unitArray,[Name1,count1,Name2,count2...]] call call removeMagazinesM or
[Grp,[Name1,count1,Name2,count2...]] call removeMagazinesM – remove the same
set of magazines from multiple soldiers.
Unit call isRTO – true, if Unit has
radio
Unit call isMGSoldier – true, if Unit has
machine gun
Unit call isSniper – true, if Unit has
sniper riffle
Unit call isLaserSoldier – true, if Unit
has laser designator
Unit call isAASoldier – true, if Unit has
anti-air launcher
Unit call isRPGSoldier – true, if Unit has
reloadable RPG/LAW
Unit call isATSoldier – true, if Unit has
heavy AT launcher
[UnitArray,Type] call getSpecialist or
[Grp,Type] call getSpecialist– return first unit of speciality Type;
Type can be one from: "RTO","AA","LD","MG","SNP","RPG","AT".
[UnitArray,Type] call getSpecialists or
[Grp,Type] call getSpecialists - return ALL units of speciality Type;
Type can be one from: "RTO","AA","LD","MG","SNP","RPG","AT".
Unit call getLaserDot – return laser dot
object of soldier with
active (switched on) laser designator. If no dot found - returns objnull.
Examples: Inventory.Intro,
Inventory2.Intro and Inventory3.Intro
Markers – works with markers on map
Independent
module
call userMarkers – return array of all usermarkers.
Deleted usermarkers will not be shown.
[«Marker1», «Marker5»] call markerDist –distance between 2 markers.
[Pos,Markerarray] call nearestMarker or
[Pos,Markerarray,MaxDistance] call
nearestMarker – get closest marker
from Markerarray to position Pos. You can define
maximal search radius.
MarkerName call hideMarker – makes marker size 5000 times smaller == hides it.
MarkerName call showMarker – makes marker size 5000 times bigger == makes
reduced marker visible again. If marker has zeroed X or Y side - then
it
sets marker size to [1,1] (default marker size for non-area icons).
But using only hideMarker to
hide your markers you will save their
positions and sizes in any cases.
[Unit,MarkerName] call attachMarker or
[Unit,MarkerName,Delay] call attachMarker – attach marker with name “Mark” to
unit.
You can define loop delay.
MarkerName call detachMarker – exit "attaching"
script of MarkerName
[MarkerName,Delay]call animateMarker or
[MarkerName,Delay,ScaleFactor]
call animateMarker – make MarkerName pulse.
You can define ScaleFactor in range (0 – 1000).
If it’s less then 1, marker will pulse with size
reducing.
Default scale f. is 0.5.
MarkerName call stopMarkerAnim – stops animation of
MarkerName.
Original size will be restored.
Examples: Markers.Intro
MachineLearning – to
be implemented…
Uses modules System and Arrays
NOTE:
Functions 1-6 needs equal count of both arrays!
The result of functions 1-5 is a measure of similarity
of 2 points in the
multi-dimensional space of patterns.
[NumArray1,NumArray2]call m_dist – “Manhatten” or
“City-Block” distance between
2 vectors. Returns number. The fastest function in the
collection.
[NumArray1,NumArray2]call e_dist – eucleadian distance between 2 vectors.
Returns number.
[Array1,Array2]call h_dist – hamming distance between 2 vectors.
Arrays can contain any values. Returns number.
[NumArray1,NumArray2]call cos_dist – cosine distance
between 2 vectors.
Arrays can contain any values. Returns number.
[NumArray1,NumArray2]call k_dist – kanberra distance between 2 vectors.
Arrays can contain any values. Returns number.
[Array1,Array2]call match – the percent of
matching between 2 equal-length
vectors which can contains of numbers or strings.
Purpose: compare actual and calculated classification
in supervised learning.
[Array,_Xpression]call makeDataRecords – call
_Xpression for each _x in Array.
_Xpression sample: {_x knowsabout player}. Returns an
array.
[Etalons,ClassLabels,Point]call etalonUse or
[Etalons,ClassLabels,Point,DistFunction]call etalonUse – classification of Point,
by founding class label of the closest etalon point.
DistFunction determines how we will determine
disatance between points,
default measure is m_dist.
[Data,ClassLabels]call ANN1Learn or
[Data,ClassLabels,Ages]call ANN1Learn – simple 1-layer Artificial Neural Network
with no activation function, which can solve not very
difficult classification problems
with good speed. Data is a vector of vectors, each
element is a point in the space of
patterns. ClassLabels vector must contain only 1 and 2
– this works with 2 classes only.
Ages is a number of learning loops, default number is
200.
Returns vector: weights of each pattern + [weight of
bias].
[Weights,NewPoint]call ANN1Use – use the calculated weight vector to
classify NewPoint. Returns 1 or 2.
[Weights,NewPoints]call ANN1UseM – use the calculated
weight vector to
classify all NewPoints vector. Returns the vector of 1
or 2.
NestedArray call arrayMean – mean value on each dimension of NestedArray.
Returns simple vector with the same length as
(NestedArray select 0)
[Array,Condition] call getMatchArray – returns the
array with 1 where
Condition is true and 0 where not.
Array_0_1 call boolNot – each
[Array_0_1,anotherArray_0_1,strCode]call boolOperation – produce
boolean operation between each correspondent elements
of 2 pseudo-boolean
arrays. Each awailable operation has 2 possible key
codes:
{and}/{&&}, {or}/{ ||},{xor}/{!=},{equal}/{==}.
Examples: MachineLearning.Intro,
MachineLearning2.Intro and MachineLearning3.Intro
Rnd – randomization
Independent
module
[Min,Max]call rndFloat – random float value
between Min and Max.
Gets less correlating random numbers then native
function (random)
Max call rndInt – random integer
between 0 and Max-1
Array call rndElement – select random element
from Array
Array call shuffle - intermixing of the Array.
Modifying Array but returns no explicit result.
NestedArray call shufflePivoted – all subarrays
of NestedArray
will be intermixed, in each subarray same indexes will be swaped.
Modifying NestedArray
but returns no explicit result.
[Array,N]call rndSample – N random elements of
Array with non-repeating indexes.
[Array,N]call rndSample2 – N random elements of
Array, indexes can be repeated.
NumArray call rndCase – get random integer in
range [0, (count NumArray)-1 ].
The bigger the value on position _i – the bigger the chance of this
integer.
Probability of each integer is «NumArray[_i] /
SUM(NumArray)»
[Array,NumArray]call rndElementPro – random element
selection with non-equal
chanses. Probability of each element is
«NumArray[_i] /
SUM(NumArray)»
Examples: Random.Intro
System – core functions
This
independent module provides correct work of modules:
Arrays,
Groups, Inventory, MachineLearning and Text
«VarName» call isNil – return true, if variable VarName NOT defined,
or destroyed with expression VarName=nil
Variable call varType – return variable type
(«number»,«string»,«array»,«bool»,«side»,«object»,«group» or «trigger»).
Array call unique
– return all element types from array(only unique elements)
Array may contain numbers,
strings, objects and groups.
Strings are case-sensitive.
Array call typeList
– array of unique elements and
corresponding array of
Element types from
array Array. Strings are
case-sensitive.
NumericArray call min
– minimal element in array
NumericArray call idxMin – index of minimal element
NumericArray call max - maximal element
NumericArray call idxMax - index of maximal element
Any call msg – similar to MsgBox from VB – get message with variable value.
[ArrayKeys,ArrayRecords] call selectByKeys – return records from the table
ArrayRecords, which starts from
corresponding elements of ArrayKeys.
ArrayOfArrays call transpose –array of rows to array of columns.
[Integer,Item]call populate
- repeat
element Item Integer times
[item,ArrayOfArrays] call findInNested -
index of the first array in ArrayOfArrays
which contains item; return «-1» if no such array.
Strings are case-sensitive.
NumArray call qsort – sort an array in
ascending order. Method - fast sort.
Returns no result,deals with array itself.
[NumArray,Array1,Array2...ArrayN] call qsortM – sort several arrays in ascending order of
first array. Method - fast
sort. Returns no result,deals with array itself.
array call any2pos or
Object1 call any2pos or
Group2 call any2pos or
SomeMarkerName
call any2pos – return 3-D
position,
In case of group – return the position of group leader.
{[PropOwner,StrPropName,Value]call propSet – set user-defined
property StrPropName
of PropOwner (object, group or string) to Value.
{[PropOwner,StrPropName]call propGet – get user-defined property StrPropName
of PropOwner.
PropOwner call propCutOwner – delete all
user-defined properties of PropOwner.
AddonName call isAddonLoaded – check if such
addon exists. Don’t write extension!
{JAM3} is right, {LSR_USWP.pbo} is wrong. For PBOs
with custom “stringtable.csv”
or "cfgAmmo"
class is fast enought, for most unit packs is very slow.
Addon database contains now about 200 PBO names and
signatures.
Var call isArray – checks if Var is an
array. Returns bool.
["SLX_Path","ECP_Path"]call deleteGlobals – remove all denoted global
variables. Returns nothing.
[Array,Expression]call qsortByExpr – sort Array in order
of increasing Expression.
Returns no result, Array will be modified.
[Array,Sample]call qsortByExample – sort Array in
order of elements in Sample.
Returns no result, Array will be will be modified.
[Array,anyVar]call findAll – find all indexes where anyVar ==
Array element.
Array call array2Pairs – array like
[name1,v1,name2,v2,name3,v3] will be treated as
[[name1,v1],[name2,v2],[name3,v3]]. Usefull for
creating functions with big and/or
variable number of arguments.
[unitArray,[p1,v1,p2,v2,p3,v3...]]call propSetM – set list of
properties and
correspondent values 4 unit array.
Array call split1212 – split array into param. names and
param. values.
The odd elements is in the second one.
[Array,String]call findString – find string in array in despite
of case (lower/upper)
[Array,Old,New]call replace – replace all occurencies of Old in Array to New
[Array,ArrOld,ArrNew]call replaceM – replace all occurencies of each element
from ArrOld to corresponding elements of ArrNew
language – global
variable, can be 1 of 6 standart languages:
"Spanish","Czech","English","Italian","German"
or "French".
Shows the language you selected in
"preferences".
Examples: System.Intro,
System2.Intro and System3.Intro
Text – functions what works with strings and character(string) arrays
Uses module System
CharArray call soundex
– char array hash function
the result is 4-char array (1 letter + 3 digits)
CharArray call cv2string – merge char array to make 1 string
Any call alphabet – returns char array:
latin alphabet. If first argument
is 1, «l», or «L» - returns lowercase array, else – uppercase alphabet.
CharArray call lCase – char array to lower case.
CharArray call uCase –char array to upper case.
[Array1, Array2] call inStr –returns a position in
Array1,
where starts Array2 or
-1 if no match.
[Array1,Delimiter] call split –splits array on 2 subarrays,
using 2nd argument as a delimiter.
[Array_of_CharArrays, CharArray]call catAfter èëè
[Array_of_ Strings,String] call catAfter – add string/string vector
to the end of each array element.
[Array_of_CharArrays, CharArray]call catBefore or
[Array_of_ Strings,String] call catBefore – add string/string vector
to the start of each array element.
[String,CV] call FuzzyStrCVCompare – compare String
and Char Vector, if
there is no more then 1 mismatch – return true
CV call soundex2 – char vector reducing,
similar to SOUNDEX method, but better
for OFP tasks. Purpose: fuzzy text match.
Number call nth – number to numeral:
1==1st, 12==12th
[CV,CV_Old,CV_New] call replaceCV – replace 1st occurrence of CV_Old in CV to CV_New.
All arrays are character vectors.
[CV,StartIdx,EndIdx] call subStr – get a substring (new CV) from CV
[Array, strDelimiter]
call array2Report or
[Array, strDelimiter, bUseEnds] call array2Report –
make report-like string
from an array, using strDelimiter
between report parts and (optionally)
endings for numerics.
[Array, strFormat,strDelimiter] call array2ReportFMT – make report-like
string from
an array, using strFormat
as template(%1 – what, %2 – how many) and with
strDelimiter between report parts.
[CV1,CV2]call fuzzyCVCVCompare – return number[0...1], the
bigger==the better
matching.
Good: works with arrays of different length
Bad: anagrams like["c","a","t"] and ["a","c","t"] always get 1
Examples: Text.Intro, Text2.Intro
Vehicles – works with transport
Independent
module
Unit call vehiclePos
– unit position name in unit’s transport.
Can return:
"Driver","Gunner","Commander","Cargo","None".
Vehicle call cargo - array of units in cargo section
of Vehicle
[Veh,NewSpeed] call setSpeed
– immediately set speed of Veh to NewSpeed
Vehicle call hasDriverPlace – self-evident
Vehicle call hasGunnerPlace – self-evident
Vehicle call hasCommanderPlace
– self-evident
Vehicle call canMove2
– modification of native command canmove, it also
checks fuel level and driver position presence.
UnitArray call vehicles – returns array of transports, occupied by
UnitArray
Examples: Vehicles.Intro
STOLEN BORROWED
Some of
discribed functions are renamed and/or revorked functions,
originally created
by experiensed scripters from OFP community:
Respect for
these SQF-masters:
Backoff
- createUnit2
Baddo - count_BuildingPos
BINMOD
team -dirofmove, vehiclePos
Bn880 - vartype
The
Chain of Command
team - transpose
Dschulle - grid2Pos
ECP mod
team - isNil, getIntSide, deleteGlobals
Fox2 - pos2Grid
General
Baron - squadNumber, squadOrder
LIBMOD
team - cargo
Mandoble
– inFOV
Mr.
Peanut - rndFloat, elevation, highestLowest
Raptorsaurus
– elevationAngle, inForest,
groundSlope,
SLX mod
team - radioState, DASH_VehicleTester(model+config)
snYpir - dir2Obj
SPOONer
- getLaserDot
Toadlife
- watchDir
Vectorboson
- getGroupSpeed, getGroupSpread, groupIsCargo,
filterGroups,
mostInjured,
nth, array2Report, isRTO
+idea of module Rnd.sqf
+help with isNil and varType reworking.
Special
thanks for Rinza ,who wrote excellent OFP all-in-one
tutorial,
and
for DenVdmj , who translated into Russian BIS scripting comref.