• 0

    posted a message on [New Small Question] Code Elegance Question

    The first tutorial I learned from regularly used If Then Else statements, but never put anything in Else. Is there a better way to add a condition to an action?

    Posted in: Triggers
  • 0

    posted a message on [New Small Question] Code Elegance Question

    Okay, I used ctrlF11 and found the section that was giving me 4-5-6 when it should be giving 1-2-3. Is this what you wanted/

    while ((auto38486ABD_ai >= 0 && lv_columnTotal <= auto38486ABD_ae) || (auto38486ABD_ai <= 0 && lv_columnTotal >= auto38486ABD_ae)) {
            if ((lv_columnID < lv_columnTotal)) {
                UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, IntToText(lv_columnID));
                lv_columnID += 1;
            }
            else {
                UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, IntToText(lv_columnID));
                lv_columnID += 1;
            }
            if (lv_columnTotal == auto38486ABD_ae) {
                break;
            }
            lv_columnTotal = lv_columnTotal + auto38486ABD_ai;
        }
    

    I created a new map, copied the code, and reset it up. It produces 1-2-3. I have no idea what's going on. Using this same code in a While loop in the GUI produces the desired result, and using the For loop in a new map produces the desired result. So confusing.

    @Zandose, I'll definitely be setting player groups in the lobby, this was just about learning to code. Thanks for pitching in!

    About For vs While: I realized why he thought for loops gave you more control. They are more "controlled", like you said, not that they give you more control. I have to agree, but now I'm really iffy about for loops with this new issue.

    By the way guys, I'm having so much fun coding my interface! Everytime something works I feel like Einstein or something.

    EDIT:
    Found out why it was producing 4-5-6, I had it after my while loop that was modding the vaible +1 each time it ran. But I didn't create that While loop till after the for loop wasn't working, so I have no idea what went wrong still.

    Posted in: Triggers
  • 0

    posted a message on [New Small Question] Code Elegance Question

    Okay, so SoulCarverr, I've been converting my While loops to For loops. Then I make a new one, create an awesome dialog, but everything my If statement inside the loop is screwing up. The For is For Each Integer in ColumnTotal from 1 to 3. the IF is ColumnID < Column Total. This failed over and over again, and I tried 10 ways to find out. Once I swapped the comparison to ColumnID < 3 it worked perfectly. But I needed to use the ColumnTotal variable to let my dialog flex.

    Pull the original code out and stick it in a while loop and it works perfectly. Why do you think the for loop is so good when it fucks up your variable?

    EDIT: I just used the integer to text func to display a message with the ColumnID variable in that For loop. It gave me 4 5 6, not 1 2 3. Anyone know wtf is with that?

    EDIT2: the 4 5 6 is unrelated, I fixed that. Issue still persists.

    Posted in: Triggers
  • 0

    posted a message on [New Small Question] Code Elegance Question

    I feel very comfortable with IfThenElse and While loops, so I'll play around with For loops.

    The interface is going really well (what this practice has gone to). Now I'm just trying to figure out how to reference a dialog aside from Last Created Dialog.

    Dead, what does int i mean in your example? I don't understand it.

    Posted in: Triggers
  • 0

    posted a message on Storing Champion Icons in an Array

    I have an array set to string, 0-15, 1 dimension. I have an action "assign variable". How do I assign the image path to the variable?

    Alternatively, it seems like I could be putting these images in the name array somehow, but I have no clue (it is also a string).

    Posted in: Triggers
  • 0

    posted a message on [New Small Question] Code Elegance Question

    Er, how is that any less control? They do the exact same thing. Maybe it's just my unfamiliarity with For loops and that 101's bible bashing on using while loops that's making be biased, though.

    So... I really should start using For loops, huh?

    Posted in: Triggers
  • 0

    posted a message on [New Small Question] Code Elegance Question

    Thank you guys. I actually like while loops better, I feel I have more control without sacrificing much readabliity.

    Soul, yeah I'll be defining teams the way you suggest. I'm just using these triggers as a way to get familiar with how they run.

    I used what I learned here to create an awesome scaling dialog, where you only have to change total number of buttons, button size, row length, etc, and it will all scale correctly. Man does that feel good.

    Now I'm trying to reference a button press in 1 dialog to affect another. How do I specify a specific dialog, rather than just using "Last Created Dialog"?

    Posted in: Triggers
  • 0

    posted a message on [New Small Question] Code Elegance Question

    Thanks for the posts guys! I love your novel finite, very helpful.

    Few questions:
    1) Why do we set the varibles Number_of_teams and Number_of_players with an action, instead of setting their start values?

    2) In the "Common Sense 101 (triggering edition)" the writer goes on about how while loops are superior. I prefer the look of For loops, but I've been learning to use while loops because of his advice. Why should I use For loops, if while loops are so much better?

    3) The "Team_Members" variable starts at 0 and is not modified in the actions. I don't understand how "For Each Integer" works when there are 0 Integers in the variable.

    Also, your "back of the book" answer is so clean and simple! I face palmed when I read it.

    Thanks again.

    Posted in: Triggers
  • 0

    posted a message on [New Small Question] Code Elegance Question

    Which way should I code this?

    A tutorial I found taught me how to assign players to teams, but since I'm trying to learn how this jolly good business works, I thought I'd try to do it with a loop.

    He used 6 seperate actions to assign 6 players like so:
    http://i.imgur.com/Vq5hI.png
    (First column is the team, second is the player number)

    This is solution 1 for looping it:
    http://i.imgur.com/w8g7W.png

    Solution 2 (which I don't like as much, but I'm a noob so it may be better):
    http://i.imgur.com/pAOVU.png

    So which one is better and can I improve the code?

    Posted in: Triggers
  • 0

    posted a message on Storing Champion Icons in an Array

    Thanks guys, I'll dig in and see what I can come up with. Really appreciate it!

    Posted in: Triggers
  • 0

    posted a message on Storing Champion Icons in an Array

    So, does this mean I need a second dimension to my array variable?

    Posted in: Triggers
  • 0

    posted a message on Storing Champion Icons in an Array

    Well, I say champions/heros because that's what a lot of custom maps rock. It's actually more like "tribe" selection, or "faction" selection.

    Going to read that now! Before, I added a '- file:image' to my array paramater, and tried to make it display. Got an error message. Hm.

    Posted in: Triggers
  • 0

    posted a message on Storing Champion Icons in an Array

    I've been having a blast learning dialog triggers. I followed great tutorial on a champion selection dialog. Now I'm tweaking it for my needs.

    The dialog is generated using an array, allowing me to easily add or remove champions. One of the ways I'm trying to tweak the dialog is to have icons in the array for the buttons, rather than text.

    Is this something that can be stored in an array? While we're at it, am I actually referring to an array? All I know an array is, is a list of items with defined subcategories each item contains. It seems like it could contain images.

    Here is the current map save if this helps anything. It's clearly labeled.

    If anyone has a dialog that functions this way that I can look at, that'd be great, too.

    Thanks yo.

    Posted in: Triggers
  • 0

    posted a message on (Solved) Damaging Aura

    Oh, so that's what that does (the period on the damage apply behavior).

    I have it ticking down 25 health once per second on all the correct targets, everything is working great! Thanks so much guys.

    Posted in: Data
  • 0

    posted a message on (Solved) Damaging Aura

    First issue Solved!

    She Obelisk does not have the Unit:Attributes Structures flag checked by default.

    Final issue remaining, how do I apply the damage effect once a second, rather than constantly. It kills stuff too fast atm.

    Posted in: Data
  • To post a comment, please or register a new account.