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_1example and switch+ 1to/ 2to change from adding 1 to dividing by 2 (halving).
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