Community
    • Login

    Halving multiple numbers

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 487 Views 2 Watching
    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 Offline
      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 Offline
        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 Online
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors