1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. The results are out! Check them out.
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Few Questions

Discussion in 'Triggers & Scripts' started by kennyman94, Mar 16, 2010.

  1. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    I don't make useless functions like the one you posted. The only times I ever add to a group it is already known by variable reference how many are in the group. If not I would never use a function to find that out for me.
     
  2. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,033
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Everything I posted serves no practical purpose, it's just to show how organized it is and how little typing is required to achieve everything (omitting "private" and "takes nothing returns nothing" and all those noisy "endif/endfunction/endlibrary" lines is almost priceless).
     
  3. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    Okay, well how about this one:

    Code (vJASS):
    struct useless
        readonly you
        readonly cant
        readonly touch
        readonly this
    endstruct
     
  4. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,033
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    yeah, the one thing Zinc can't do, I'll take it over mindless redundant typing.
     
  5. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    Writing the repetitive lines of code really doesn't bother me, it takes me maybe two seconds to type up a function with a couple of parameters and no actions.
     
  6. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,033
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    This is about the features Zinc has to offer, I'm not going to debate features just because you're willing to put up with them.
     
  7. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    Oh I wasn't debating you, I was just saying that I don't mind it. It's all about preference.
     
  8. kennyman94

    kennyman94

    Joined:
    Nov 22, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    what do you mean by that?

    how exactly do you make a trigger mui?
     
  9. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,033
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Code (vJASS):
    call ForGroup(g,function enumerate)
    native ForGroup takes group whichGroup, code callback returns nothing
    // code is a primitive type.

    // this means that "enumerate" must "take nothing return nothing", otherwise
    // it's an invalid argument.  The only time a code can return a value is in a
    // boolean expression, where it must return true or false:

    set expression = Condition(function verify)
    native Condition takes code func returns conditionfunc
    type conditionfunc      extends     boolexpr
    type boolexpr           extends     agent
    type agent              extends     handle
    // handle is a primitive type.
     


    Not sure I follow; every trigger is automatically "MUI" until you include a
    TriggerSleepAction
    .
     
  10. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    PolledWait
    just calls
    TriggerSleepAction
    so don't get ahead of yourself.
     
  11. kennyman94

    kennyman94

    Joined:
    Nov 22, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    so can i use polled wait or no? and can you make a trigger with a wait mui by having another trigger that creates a trigger for the triggering unit?
     
  12. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,033
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    OK everything you said just now was a terrible idea.

    1. Don't use polled wait.
    2. You're asking about creating triggers dynamically just for the sake of MUI? That's like pouring water on burning oil, you're just making more work for yourself.
     
  13. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    Yea just use a stack with a periodic timer. Add elements to the stack as you need the periodic actions, and in the periodic trigger perform all of the actions necessary by looping through each index of the stack.
     
  14. kennyman94

    kennyman94

    Joined:
    Nov 22, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    what do you mean by stack?
     
  15. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,033
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
  16. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Might want to first start off with hashtables... Just to get the basics of MUI.

    Then TimerUtils -> KT2/Struct Loops/Stack Loops (High freq) -> T32/Lists (High freq)

    Progressively your code will become more efficient. If you know some stuff about structs, jumping to TimerUtils red/orange is fine, as its coding is pretty simple with
    NewTimer()
    /
    ReleaseTimer()
    .

    Read up on this post:
    http://www.hiveworkshop.com/forums/1589982-post3.html

    It has some nice examples of the latest timer systems.
     
  17. kennyman94

    kennyman94

    Joined:
    Nov 22, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    ok thank you.

    does the trigger event
    Code (vJASS):
    EVENT_PLAYER_UNIT_SELL
    refer to when a unit owned by a player purches a unit from a structure like a hero tavern or does it refer to when a structure owned by a player sells a unit to another player?

    so basically would GetTriggeringUnit() refer to the buying unit or the selling unit?

    ok stacking seems very confusing. probably since i don't know c and that is what the examples seem to be in.
     
  18. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    In JASS
    GetTriggerUnit
    always refers to the logical associated unit based on the event-name. In this case, I believe it would refer to the unit that sold the purchased unit. In GUI the names are a little skewed, but if you're ever unsure you can always do:

    Code (vJASS):
    call BJDebugMsg(GetUnitName(GetTriggerUnit()))


    This will let you know what unit is being referenced. If there is no unit, you will know because it will display "(null)".
     
  19. kennyman94

    kennyman94

    Joined:
    Nov 22, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    ok thanks. i guess i could do that. so should i use:
    Code (vJASS):
    TriggerRegisterPlayerUnitEvent(t, Player(15), EVENT_PLAYER_UNIT_SELL, null)
    to register when a hero is bought from a hero tavern (owned by neutral passive player)?
     
    Last edited: Jun 8, 2010
  20. kennyman94

    kennyman94

    Joined:
    Nov 22, 2009
    Messages:
    181
    Resources:
    0
    Resources:
    0
    so basically you can only change the value of a multiboard item once without fiirst releasing then getting the item again?

    is there a way to detect whenever a variable within a struct has been set to a new value and use the instance member that was set within a seperate struct or function?

    also can you hook method operators?