Community
    • Login

    Halving multiple numbers

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 226 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Torn 22T
      Torn 22
      last edited by

      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++.

      Terry RT PeterJonesP 2 Replies Last reply Reply Quote 0
      • Terry RT
        Terry R @Torn 22
        last edited by

        @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

        1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones @Torn 22
          last edited by

          @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).

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors