Essentially, I am attempting to write a WA to track my gold per session. I know there are mods to do it, but the less mods the better! I just wanted to make text with alpha 0 when 0 and then alpha 100 when not 0. I attempted to use a custom variable called goldNew, but whenever I assign data to the variable, it does not retain the information. I know I'm doing it wrong. I'm really new at this. Any ideas?
#Stuck with Custom Variables
1 messages · Page 1 of 1 (latest)
I know there are mods to do it, but the less mods the better!
You're making a mod. If you make one that's worse than the mods out there then it's certainly not better.
So that's not a good reason to make it but learning to make custom Auras is so I'm not trying to discourage you.
Regarding the question, changing alpha is a shitty workaround. You want to only show something when there's something to show, do that.
Regarding your issue, you're not interacting with TSU properly
!TSU
Trigger State Updater is an advanced custom trigger type that allows for the creation of clones, as well as generally being a very flexible custom trigger for almost all situations. While it is complex, the wiki aims to be thorough so please do use it.
https://github.com/WeakAuras/WeakAuras2/wiki/Trigger-State-Updater-(TSU)/
!aura_env no globals
Ah, thanks for that last tidbit. I know a workaround that will work nicely. I'll ready up on TSU, thank you so much!
I'm sorry, I don't know what you mean.
goldNew and goldOld are both global variable. Don't use globals. declare them as aura_env.goldNew, aura_env.goldOld
oh I see. Just for curiosity, what does that affect if they are declared globally?
any other code that happens to use the same variable name will mess everything up
Oh no, that would be awful! Thank you so much. I didn't realize global variables could be accessed outside of the aura it was in.
tracking down a problem when using global variables is nearly impossible