V
V
Vyacheslav2021-02-04 18:00:30
Parsing
Vyacheslav, 2021-02-04 18:00:30

How to multiply/divide a value between characters of a string?

Hello everyone, maybe I'm asking something obvious but still.
I'm running a DayZ server, there are a lot of configs that affect the balance of the game. I can massively change them by searching and replacing, adding or removing, for example, a zero at the end. For example
dmax="100" by dmax="1000"

But how can you change the value by multiplying by 2 for example? For example dmax="100" to dmax="200".
As I understand it, this can be done using regular expressions, but they are completely zero.
Please poke your nose where to dig, or if you know a simple quick solution - please tell me.
Thanks

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander, 2021-02-05
@Frontman32

You can do it with spreadsheets. On one sheet there will be customizable parameters, on the second - lines of the desired format combined using formulas.
Or, in general, one sheet with parameters, and the output configuration file is formed by a macro (script).

S
Stalker_RED, 2021-02-04
@Stalker_RED

and who's stopping you from replacing dmax="100" with dmax="200"?
jBZ9Z7j.png
By themselves, regular expressions cannot multiply and divide. They look for text that matches a "pattern" or "rule".
Sometimes in the same engine there is a replacement option.
In some cases, when replacing, you can apply some kind of function (in js for example).

V
vreitech, 2021-02-05
@fzfx

perl -i -pe 's~dmax=\"(\d+)\"~$1*2~ge' filename

D
dollar, 2021-02-05
@dollar

You need to go through the script , not regular expressions.
Although, regular expressions can also be used in the script, but only for searching, and not for calculations.
Almost any programming language will do. Install yourself php, or lua, or node, or compiled ones, etc.
Next, you will need the help of a programmer. Ask around in the DayZ community, among your playing friends. You need a script to enumerate files in a folder recursively plus replace attributes by formula and name .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question