Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Add the same amount to every selected value?

    Help wanted · · · – – – · · ·
    5
    23
    655
    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.
    • Alan Kilborn
      Alan Kilborn @Diz Hydron last edited by

      @diz-hydron said in Add the same amount to every selected value?:

      Is my understanding of that part correct?

      Sounds right, although for sure don’t bother with the shortcut key thing right out of the box. That would only be useful if this whole thing actually works for you, and if you need to do it multiple times. Just run the script from the menus to start with.

      1 Reply Last reply Reply Quote 1
      • PeterJones
        PeterJones @Neil Schipper last edited by

        @neil-schipper said in Add the same amount to every selected value?:

        he is a rapper by night,

        I have never been accused of that particular moonlighting before…

        @Diz-Hydron ,

        Is my understanding of that part correct?

        That seems a reasonable summary of the process.

        If nothing happens, I would tell PythonScript to show the console, and you can look to see if there is an error message.

        1 Reply Last reply Reply Quote 0
        • guy038
          guy038 last edited by guy038

          Hello, @diz-hydron and All,

          Well, @diz-hydron, I suppose you could begin with this very simple script, named diz.py

          def player_1(m):
              return str(int(m.group(1)) + X1) + ', ' + str(int(m.group(2)) + Y1)
          
          def player_2(m):
              return str(int(m.group(1)) + X2) + ', ' + str(int(m.group(2)) + Y2)
          
          editor.rereplace('"player1": \[\K(-?[0-9]+), (-?[0-9]+)', player_1);
          
          editor.rereplace('"player2": \[\K(-?[0-9]+), (-?[0-9]+)', player_2);
          

          Before running the script, of course, change the X1, Y1, X2 and Y2 values for true positive or negative integers ( e.g. +7 or -3 )

          It should work nicely with your text posted here


          In a next step, it would be better to enter the different values with, for instance, the notepad.prompt python command and assign the 4 typed numbers to the X1, X1, X2 and Y2 variables…

          Best Regards,

          guy038

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors