Halving multiple numbers



  • Hello.
    I have a 10k line long .txt file which contains many set parameters for a game
    There is one specific every number of which I need to halve, it looks like this:
    gold_cost = number
    This may look very simple yet I haven’t found a way to do this in Notepad++.



  • @Torn-22 said in Halving multiple numbers:

    There is one specific every number of which I need to halve,

    Regular expressions in Notepad++are not capable of doing calculations like you require.

    I do however remember some old posts in this forum where using PytonScript achieves what you need

    Do some searching here using pythonscript and calculation as key words and I think you will find the relevant posts.

    I’m not on a PC currently so cannot provide those links currently.

    Terry



  • @Torn-22 ,

    Further to @Terry-R’s suggestion, if you search for “add_1”, you will find examples of such calculation (because the PythonScript documentation has an example that adds one to each integer found). All you have to do is take that add_1 example and switch + 1 to / 2 to change from adding 1 to dividing by 2 (halving).


Log in to reply