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. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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.

[Snippet] MUI DummyCasters

Discussion in 'Graveyard' started by mckill2009, Feb 11, 2012.

  1. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    which one?

    EDIT:
    INdexing for this is not going to happen...if this is graveyarded Ima post it in the spell's section instead with GUI format...
     
  2. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Nothing wrong with struct initializer? Basically if I use a module initializer and want a dummy, it will not work.
     
  3. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    About the struct initializer thing he could say that it requires Cohadar's jasshelper and give the link to it though.
    At least that's what i've done for my resource.
     
  4. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Balh I guess a developer would just edit the resource instead of fixing all other coding thingies that that JH breaks.
     
  5. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    This does not require Cohadar's JH coz Im not using it due to the bad color tesh setup (IMO) and I'm too lazy to do it manually...but I just tested it and works for this one...
     
  6. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    moyack posted on some thread a setting file if you want the old color set-up... anyway, if ur planning on using Cohadar's JH, might as well update to the new JNGP...
     
  7. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    Im just bumping, asking what's the status of this submission?
     
  8. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,087
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    You focused too much on code size on paper, forgetting that your compiled code is far greater than what you're looking at.

    First, you make no use of destroy and create members, thus your struct should extend array. Even if you would, its more efficient to write those yourself, or use parent ones if you extend another struct.

    There are multiple snippets in jass resources made to cut overall code size in map and improve both, efficiency and code readability. You don't generate many handles with your hash, so Table support should be implemented at first.
    Then, deal with indexing your dummies. Jass resources is visited mostly by experienced users, granted they use UnitIndexers. Protection from indexing your dummies should be added. There are many UnitIndexes, but since Nes' one is the most powerfull, you should at least provide:
    Code (vJASS):
        static if LIBRARY_UnitIndexer then
            set UnitIndexer.enabled=false
            set dummy=CreateUnit("some shit here")
            set UnitIndexer.enabled=true
        else
            set dummy=CreateUnit("some shit here")
        endif

    Next, I belive there is support for RegisterAnyUnitEvent too =)

    After comparing this to DummySpellcast and Dummy Caster, I don't see point of using this over any of mentioned ones. Want to add GUI friendly support? Add functions, dont force them to write:
    YourStruct.yourMethod
    . Struct and method names should also be improved, look how unpleasant is to type:
    MuiDummyCasters.hitXXX // that sucks


    FoG isn't the best method nowadays for dummy recycling ;/ Better make use of linked list.
    Last but not least, lets talk about globals block. Quote from your lib:
    //The DUMMY_CASTER raw ID is the only one you may adjust, NEVER touch the rest!
    says everything. Whats the reason of providing configurables when you do not want them to be configurable? Instead, you should split your data block into:
    Code (vJASS):
    globals
        // configurables
        private constant player             OWNER = Player(15)
        private constant integer     DUMMY_CASTER = 'xcvb'
    endglobals

    // some free room to clean the view
    globals
        private hashtable                       H = InitHashtable()
        private group                   DummyTake = CreateGroup()
        private unit                        dummy = null
    endglobals
    Now it clearly shows, what user can touch and what he should not.

    DEBUG_MODE - o'rly? Look at right top corner of WE menu -> JassHelper. It contains an option to enable debug mode, so additional stuff is pointless.
     
  9. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    Code (vJASS):

    //The DUMMY_CASTER raw ID is the only one you may adjust, NEVER touch the rest!
        private constant player             OWNER = Player(15)
        private constant integer     DUMMY_CASTER = 'xcvb'
        private hashtable                       H = InitHashtable()
        private group                   DummyTake = CreateGroup()
        private unit                        dummy = null
        //===FOR TESTING ONLY ON HOW MANY DUMMIES ARE CREATED:
        private constant boolean DEBUG_MODE = true
        private integer index = 0
     


    The first green line says that I shouldn't touch the rest, so if I don't want the debug mode enabled, I can't turn it off because I'm not supposed to touch any of the rest...
     
  10. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,087
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    buahahaha
    You're so smart xd
     
  11. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    Also, put the editables at the top... its better that way... in that block, put the DUMMY_ID at the top part instead of having the player variable at the top...
     
  12. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    Im not using any destroy/create so yeah you have a point there...

    I am cutting all requirements, that's why I didnt use those snippets, but anyway v4.4 is already finished long time ago and I applied the above snippets, just went on vacation before posting it...

    Me and Nes already debated that so pls, dont repeat it, indexing is not gonna happen :)...

    All those dummy casters out there including the above mentioned DOES NOT SUPPORT CHANNELING...

    It's not gonna bite you (doesnt hurt), so nothing wrong with it my friend...:ogre_hurrhurr::ogre_hurrhurr::ogre_hurrhurr:

    :huh::huh::huh: I thought people here are smart enough that "NEVER touch the rest!" means the 5 declared variables below?...

    Most of the time I dont use that, instead doing it my way inside the script. Planning to remove it anyway...
     
  13. Magtheridon96

    Magtheridon96

    Joined:
    Dec 12, 2008
    Messages:
    6,006
    Resources:
    26
    Maps:
    1
    Spells:
    8
    Tutorials:
    7
    JASS:
    10
    Resources:
    26
    Review

    • I think you should call it MUIDummyCasters or MUIDummyCaster.
    • The struct must extend an array because you're not using
      thistype.allocate()
      nor are you using
      this.deallocate()
      , meaning JassHelper is generating some useless code.
    • The code should be moved outside of a hidden tag and everything should be cleaned up. I want to enforce some formatting rules in the JASS section so everyone can see good-looking code. This may sound pedantic, but I believe there is a difference between a resource that has all documentation contiguous and unaligned and a resource that has nice-looking documentation that just screams:

      C'n'P me now and win a free PS3! Limited Time Offer!

      Point is, you want to sell your code to users. You want to convince them that is a standard resource. For that, the code needs to be perfect.
    • The code needs to be consistent in its conventions. Either all your parameter lists are written
      func(arg,arg,arg)
      or they're written
      func(arg, arg, arg)
      (I lean towards the latter because it's more readable). Another problem having to do with convention is the inconsistent variable/function naming. Some would wonder why you camelCased everything except for
      owningplayer
      .
    • I'd recommend leaning towards using
      DisplayTimedTextToPlayer
      for debug messages instead of
      BJDebugMsg
      . It's not about performance, it's about presentation. Also, make the debug messages properly cite where they're coming from and make sure the mechanics are flawless (Capital letters used where necessary, punctutation, etc...). The same applies to some of the code comments.
    • I noticed that DummyTake violates the camelCase convention adopted in the rest of the code. This may encourage users to do so too. We need people to stick to certain conventions. If you're going to use one convention per global, all hell will break loose (Same applies to the H hashtable variable).
    • See if you can make this resource extend off of some other Dummy Recycling system (Like Dummy by Nestharus). The more code you can remove from the resource, the better. Really, I find a resource that can do something with very little code quite impressive. Especially if it uses external resources. This makes it more relevant to actual maps. No one would use a resource that has its own dummy recycler when they already have a dummy recycler incorporated in their map. Having little requirements is not ultimately a good thing. Having a lot of requirements should not be viewed as a bad thing because people only import resources once. When they do it for one resource, they don't need to do it for another (Once per map that is).
    • The API listing in the documentation should define the function headers with the types and their names. It's not very obvious what target is (No one should be forced to read your code). target could be a widget for all I know. This allows me to pass in a destructable and wonder why I'm getting a compiler error when I am passing in a valid "target".
    • The hitNone function is not very meaningful. What does it mean to hit nothing?

    To wrap it up, you need to improve the API, follow a common convention and be consistent with it, fix the documentation, improve the formatting of the resource overall and fix the aesthetic details and reduce code size by relying on external libraries (Minimalism: Less code is More)​
     
  14. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
  15. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
  16. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    How does Spell not support Channeling? It's made to work with any spell with n number of spells running
     
  17. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    coz your Spell requires additional instance to cast another channeled spell, mine doesnt, coz if you cast it in a loop like my sample from the first page, it wont work...
     
  18. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    so you want to cast two channeled spells at the same time with 1 unit?
     
  19. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    let me rephrase by posting this...

    yours doesnt work on this...
    Code (vJASS):

    local real a = 0
    loop
       exitwhen a>6.3
       call MuiDummyCasters.hitPoint(Player(0),0,0,300*Cos(a),300*Sin(a),'AHfs',852488,2)
       set spell.abilityId = 'AHfs' //flame strike
       set spell.abilityLevel = 2
       set spell.abilityOrder = 852488
       call spell.castPoint(300*Cos(a),300*Sin(a))
       set a = a+1.04
    endloop
     


    mine does...meaning it will create an instance by getting another dummy caster automatically...
    Code (vJASS):

    local real a = 0
    loop
       exitwhen a>6.3
       call MuiDummyCasters.hitPoint(Player(0),0,0,300*Cos(a),300*Sin(a),'AHfs',852488,2)
    endloop
     


    EDIT:
    Ima make a GUI version on this and post on the spell's section...
     
  20. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    So you're saying that it's better to have dummy casters made in the background rather than creating them yourself..

    I tend to disagree ;)

    Bot to each their own

    Given two different design philosophies, both should be approved