Jump to content

[LE] How do I change the value of a global variable for a time?


capngagi

Recommended Posts

Why do I need to enter a post? I already asked you.

Because often times the question cannot fit within the subject title. Or one may wish to expand upon their question with more information regarding the scenario that prompts the question.

 

There are two ways to change the value of a global variable:

SetValue - which sets the value to a specific number.

Mod - which adjusts the current value by the specified value.

 

If you want to adjust the value of a global variable for a short duration, I suggest using Mod at the start and at the end. For example:

 

myGlobal.Mod(1)
;do stuff
myGlobal.Mod(-1)

 

If you need to permanently change the value of a global variable (wiping out any other adjustments), then use SetValue. For example:

 

myGlobal.SetValue(200.0) ;float version - faster
myGlobal.SetValueInt(200) ;integer version - slower

 

Mod is safer to use when dealing with global variables used by other mods and / or the game. SetValue is fine to use with your own global variables. Though Mod might still be better in some cases.

 

Hopefully this was helpful, if not feel free to use the "post section" to expand upon your question.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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