Jump to content

Help editing .pex: How Do I Divide a Value?


Recommended Posts

I asked a modder how I am to decrease the amount by which a variable increases. He highlighted the line in the .pex file that he created that would affect the change I need (+= ChangeStep) and told me to divide it:



+= ChangeStep ---------- divide change step there




How do I divide it? I don't know anything about coding. As far as I know, there is no division symbol on a keyboard, but there must be some way to divide a variable/value (ChangeStep)!



Please, does anyone know how to "divide" it in... lets say, half?

Link to comment
Share on other sites

Division in programming uses the backslash.

 

/

 

To replicate the aforementioned operation step in your post:

 

/= ChangeStep

 

What this means is, the division is performed and the result is added to the value.

Edited by Rasikko
Link to comment
Share on other sites

Division in programming uses the backslash.

 

/

 

To replicate the aforementioned operation step in your post:

 

/= ChangeStep

 

What this means is, the division is performed and the result is added to the value.

 

So, if I were inclined to divide it in half, I would write it as:

 

+ / 2 = ChangeStep

 

or

 

/ 2 = ChangeStep

 

or

 

+= ChangeStep / 2

Edited by PokemonButcher
Link to comment
Share on other sites

Definitely the latter. All else will throw a compiler error.

 

The "+= ChangeStep" is only part of a longer line of code, likely more looking like "SomeOtherVariable += ChangeStep", where the "+=" is an integral part of the assignment (equal to "SomeOtherVariable = SomeOtherVariable + ChangeStep") and should not be messed with.

What you can change is the right side of the assignment: "ChangeStep". And if you change it into "ChangeStep / 2" or "ChangeStep * 0.5", the half of what "ChangeStep" is will be what's added onto the left side variable here.

Link to comment
Share on other sites

Definitely the latter. All else will throw a compiler error.

 

The "+= ChangeStep" is only part of a longer line of code, likely more looking like "SomeOtherVariable += ChangeStep", where the "+=" is an integral part of the assignment (equal to "SomeOtherVariable = SomeOtherVariable + ChangeStep") and should not be messed with.

What you can change is the right side of the assignment: "ChangeStep". And if you change it into "ChangeStep / 2" or "ChangeStep * 0.5", the half of what "ChangeStep" is will be what's added onto the left side variable here.

 

Grand! T'anks 'o ton

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...