mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
tweaks
This commit is contained in:
parent
0b05a2bfb2
commit
606c1fbcf9
@ -12,33 +12,29 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_number", "_minLength", "_length", "_digits", "_index", "_count"];
|
||||
private ["_number", "_minLength", "_length", "_digits"];
|
||||
|
||||
_number = _this select 0;
|
||||
_minLength = _this select 1;
|
||||
|
||||
_number = _number min 999999;
|
||||
_length = floor (log _number + 1);
|
||||
|
||||
if !(isNil "_minLength") then {_length = (_length max _minLength) min 6};
|
||||
_number = str _number;
|
||||
|
||||
_length = count _number;
|
||||
|
||||
if (isNil "_minLength") then {_minLength = _length};
|
||||
|
||||
_minLength = _minLength min 6;
|
||||
|
||||
while {_length < _minLength} do {
|
||||
_number = "0" + _number;
|
||||
_length = _length + 1;
|
||||
};
|
||||
|
||||
_digits = [];
|
||||
|
||||
if (_number < 1) exitWith {
|
||||
for "_index" from 0 to (_length - 1) do {
|
||||
_digits set [_index, 0];
|
||||
};
|
||||
_digits
|
||||
for "_x" from 0 to (_length - 1) do {
|
||||
_digits pushBack parseNumber (_number select [_x, 1]);
|
||||
};
|
||||
|
||||
while {
|
||||
_count = count _digits;
|
||||
_count < _length
|
||||
} do {
|
||||
_digit = floor (_number / (10 ^ (_length - _count - 1)));
|
||||
{
|
||||
_digit = _digit - _x * (10 ^ (_count - _forEachIndex));
|
||||
} forEach _digits;
|
||||
_digits set [_count, _digit];
|
||||
};
|
||||
_digits
|
||||
|
@ -12,14 +12,24 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_digits", "_count", "_string", "_index"];
|
||||
private ["_number", "_minLength", "_length"];
|
||||
|
||||
_digits = _this call FUNC(numberToDigits);
|
||||
_number = _this select 0;
|
||||
_minLength = _this select 1;
|
||||
|
||||
_count = count _digits;
|
||||
_number = _number min 999999;
|
||||
|
||||
_string = "";
|
||||
for "_index" from 0 to (_count - 1) do {
|
||||
_string = _string + str (_digits select _index);
|
||||
_number = str _number;
|
||||
|
||||
_length = count _number;
|
||||
|
||||
if (isNil "_minLength") then {_minLength = _length};
|
||||
|
||||
_minLength = _minLength min 6;
|
||||
|
||||
while {_length < _minLength} do {
|
||||
_number = "0" + _number;
|
||||
_length = _length + 1;
|
||||
};
|
||||
_string
|
||||
|
||||
_number
|
||||
|
Loading…
Reference in New Issue
Block a user