I dont do any UI editing; but I do a lot of dialog work to make my own UI like stuff.Considering you are setting values for this box with triggers anyway, why not just make a dialog box and use the triggers to update said dialog box?
More specifically, say what you want in the long run, so we can show you other ways of getting there.If what you want is an icon on the screen with a number on it reflecting a variable, yes, use a dialog box.This is 5 minutes worth of work.
I thought dialog was UI? At least, dialog is what I started experimenting with.
And when I first brought this to the UI thread, the information I needed to display didn't need to update. I didn't decide to add the kill counter until I realized it would be better to store all of the information in one place. (One Dialog)
To update it, you either need to run a loop endlessly (use a repeat - forever, with a wait) or trigger specifically when the data is updated.If it is just a simple display, not like HP or something that needs to be specific to the .1 second, using a 1 second loop isnt bad.Having a lot of little repeat loops isnt good though; if you have multiple repeat loops like that, you should combine them all into 1 trigger and put them on their own thread.
As long as there is only one loop running at a time, then it's okay? I have a Boolean "Break" set when the trigger fires, so that it can't be triggered repeatedly, and then when the loop is done, it destroys the dialog and sets the break back to allow it to fire again.
Don't update the UI if you don't have to. Just set the text together when you actually change the value.
Well, the idea is for the dialog text to show a kill count. And the way the map works, it will definitely be changing a lot more often than every 8 seconds...
As anyone has realized over the past couple of weeks, I'm not great when it comes to data. So here is my trigger workaround to mimic an "itch" effect that causes burrowed attackers to unburrow, leaving them vulnerable. It's upgrade is a variable that changes with upgrades, allowing friendly units to attack more times before they are affected.
You need to refresh it yourself by setting the dialog item text.
Is there a specific loop to use, or just copy paste a bunch of waits?
I attempted my first do while loop that had a Boolean break and was supposed to set a progress bar to an integer. Outside the loop was an 8 second wait and then it set the Boolean. The result was that anytime the trigger fired ingame, it froze for 8 seconds and didn't show anything.
Well, when I saw switch, I thought it was meant to switch Boolean states, but it's basically If Then Else If, only all instances are compared to the initial statement, which calls a function or variable. So I suppose this relates to my Function call vs local variable thread, now that I think about it. I'm assuming that it "saves" the initial function so that it's not called it for every case, making it (possibly) superior to If then else.
What are the differences between these three functions? Are either If functions "better" than switch?
I like Switch if I'm checking multiple things against the same variable. But if I'm checking a large number of things, I kind of prefer If else so that it "groups" the coding into tiers, so if I reviewing the trigger, I can find what I'm looking for easier. Is there any reason, be it function or aesthetics, to use one over the other two?
Unfortunately, not with what I had in mind. I understand the application to integer arrays, but what I'm trying to do is create a short hand "list" for comparing a triggering unit type from list a (a record of unit types) and changing a local variable to the matching unit type from list b (an identical record with the same unit types, just burrowed).
I already have a series of if than else statements to do that now, but I'm just trying to see if it's possible.
I've been toying around with dialog a little bit, and I've come up with a solution that I can live with, after a little more experimentation. I've not even got to the text portion yet, but is there a trick I need to know in advance to make a counter display in real time?
The dialog is supposed to show up for 8 seconds, which it does, but I want one of the text displays to show an actively changing integer value. If I convert the integer into text, will it automatically update as the integer does, or does it need to be "refreshed" every half second or so?
0
@BigDonRob: Go
Ha Ha Mother Lovin Ha!
0
I thought dialog was UI? At least, dialog is what I started experimenting with.
And when I first brought this to the UI thread, the information I needed to display didn't need to update. I didn't decide to add the kill counter until I realized it would be better to store all of the information in one place. (One Dialog)
As long as there is only one loop running at a time, then it's okay? I have a Boolean "Break" set when the trigger fires, so that it can't be triggered repeatedly, and then when the loop is done, it destroys the dialog and sets the break back to allow it to fire again.
0
Integer, Unit Type, Unit Property, Unit Property
0
Well, the idea is for the dialog text to show a kill count. And the way the map works, it will definitely be changing a lot more often than every 8 seconds...
0
As anyone has realized over the past couple of weeks, I'm not great when it comes to data. So here is my trigger workaround to mimic an "itch" effect that causes burrowed attackers to unburrow, leaving them vulnerable. It's upgrade is a variable that changes with upgrades, allowing friendly units to attack more times before they are affected.
0
@ZMilla93: Go
Glad to know it's possible, but I'm just shot on the idea. Maybe one day after I know what I'm doing, I'll write something out just to prove I can.
0
Is there a specific loop to use, or just copy paste a bunch of waits?
I attempted my first do while loop that had a Boolean break and was supposed to set a progress bar to an integer. Outside the loop was an 8 second wait and then it set the Boolean. The result was that anytime the trigger fired ingame, it froze for 8 seconds and didn't show anything.
0
@Ahli634: Go
Well, when I saw switch, I thought it was meant to switch Boolean states, but it's basically If Then Else If, only all instances are compared to the initial statement, which calls a function or variable. So I suppose this relates to my Function call vs local variable thread, now that I think about it. I'm assuming that it "saves" the initial function so that it's not called it for every case, making it (possibly) superior to If then else.
0
What are the differences between these three functions? Are either If functions "better" than switch?
I like Switch if I'm checking multiple things against the same variable. But if I'm checking a large number of things, I kind of prefer If else so that it "groups" the coding into tiers, so if I reviewing the trigger, I can find what I'm looking for easier. Is there any reason, be it function or aesthetics, to use one over the other two?
0
@temhawk: Go
Unfortunately, not with what I had in mind. I understand the application to integer arrays, but what I'm trying to do is create a short hand "list" for comparing a triggering unit type from list a (a record of unit types) and changing a local variable to the matching unit type from list b (an identical record with the same unit types, just burrowed).
I already have a series of if than else statements to do that now, but I'm just trying to see if it's possible.
0
@temhawk: Go
I've been toying around with dialog a little bit, and I've come up with a solution that I can live with, after a little more experimentation. I've not even got to the text portion yet, but is there a trick I need to know in advance to make a counter display in real time?
The dialog is supposed to show up for 8 seconds, which it does, but I want one of the text displays to show an actively changing integer value. If I convert the integer into text, will it automatically update as the integer does, or does it need to be "refreshed" every half second or so?
0
@temhawk: Go
I'm not getting anywhere. Can you show me an example code?
0
I figured. I'm bad about thinking trigger first, data never. lol
0
@JEGCPR: Go
Using the above trigger, create local variables for any information you want to save from the dying unit.
Player= Owner of (Triggering Unit) Hero= Unit Type of (Triggering Unit) Level= Level of (Triggering Unit) EXP= Experience of (Triggering Unit)
Then, instead of reviving and moving the unit
Use create unit (Hero) for player (Player) at (North Start Location)
Set last created unit property(Level) to (Level)
Set last created unit property(Experience) to (EXP)
Select last created unit for player (Player)
Pan the camera for player (Player) to North Start Location over 2.0 seconds with Existing Velocity....
0
@coffeeclubbr: Go
I am not going to offer a trigger solution...
I am not going to offer a trigger solution...
I am not going to offer a trigger solution...
There, it worked. Now feel free to ask again in the triggers thread. Or if you really want a data solution, someone here will help you out.