1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Choose the best Old Gods themed skin at the Texturing Contest #29 - Poll!
    Dismiss Notice
  3. Melee Mapping Contest #2 - Poll is up! Vote for the best competitive 1v1 map!
    Dismiss Notice
  4. Please help test custom maps and more on the latest PTR!
    Dismiss Notice
  5. Evolution complete! Make Darwin proud and go vote in the Techtree Contest #12 - Poll.
    Dismiss Notice
  6. Icon Contest #17 - Results are out! Step by to congratulate our winners!
    Dismiss Notice
  7. We've created the Staff Job Openings thread. We're currently in need of icon, video production, and social/multimedia positions to be filled. Thank you!
    Dismiss Notice

[GUI] Dynamic Indexing Template

Submitted by Hanky
This bundle is marked as approved. It works and satisfies the submission rules.
This template contains five different index possibilities:
- Dynamic Indexing
- Dynamic Indexing 2
- Handle Indexing (Can be used as Unit Indexer for example.)
- Handle Indexing 2 (Can be used as Unit Indexer for example.)
- Fusion of both System for channeling spell

This is a demo map for a dynamic indexing system and some other indexing systems. The systems are pretty simple and I don't need to take credits if you use it. I just made this example map since Im sick to see all those spell demo maps using ineffective indexing systems.

In the demo map should be enough documentation to understand this really simple system. But If you have still questions about the system then you are free to ask me.

Changelog:
Version 1 = Release
Version 2 = Fix / ++ Documentation
Version 3 = Added Hashtable Indexing / ++ Documentation
Version 4 = Added channeling spell example / ++ Documentation
Version 5 = Added new indexing method / ++ Documentation / ++ Optimation
Version 6 = Added handle/unit indexer method / ++ Documentation / ++ Optimation / ++ Ingame Screenshot
Version 7 (Final) = Handle Indexer Fix / changed Documentation


Hint: The examples can be used as template.

Keywords:
index, demo, dynamic, indexing, recycle, recycling, unit indexing, zZz
Contents

DynamicIndex (Map)

Reviews
Moderator
7 Dec 2011 Bribe: Promoted to Director's Cut. We are recommending this template to users all the time and have many approved resources using it. 18:32, 6th Oct 2009 The_Reborn_Devil: This is really nice for GUI'ers, but can also be good for...
  1. 7 Dec 2011
    Bribe: Promoted to Director's Cut. We are recommending this template to users all the time and have many approved resources using it.

    18:32, 6th Oct 2009
    The_Reborn_Devil:

    This is really nice for GUI'ers, but can also be good for JASS'ers as well.
    It is a nice method which I often use myself.
    Approved and Highly Recommended.
     
  2. Lambdadelta

    Lambdadelta

    Joined:
    Jul 6, 2009
    Messages:
    730
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I guess this could be useful for GUI coders.
     
  3. Demongrip

    Demongrip

    Joined:
    Sep 8, 2009
    Messages:
    80
    Resources:
    6
    Spells:
    6
    Resources:
    6
    Yeah just what i needed thanks,now i`ll make the blood bolt like that.
     
  4. Aspard

    Aspard

    Joined:
    Jul 2, 2008
    Messages:
    595
    Resources:
    1
    Spells:
    1
    Resources:
    1
    But I guess for just beggining GUI coders :)
    And those "begginers" will never try look for this system before creating and uploading unefficient spells. ;(
     
  5. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    you might should add some note that when using Integer A/B you have to do this:
    • Custom script: set bj_forLoopAIndexEnd = bj_forLoopAIndexEnd - 1

    or that:
    • Custom script: set bj_forLoopBIndexEnd = bj_forLoopBIndexEnd - 1

    cause the internal counter won't be reduced the other way

    and if the last slot is empty and the current slot runs out the last slot will only be recycled after the whole thing started again
    Example:
    (0 means the slot is empty)
    1 0
    2 0
    3 0
    slot 1 is replaced with slot 3 and index reduced to
    3 0
    2 0
    slot 2 will be deleted
    3 0
    trigger runs again
    -
    and just by now the third slot got removed

    this might sound like a minor bug while everything is executed every 0.03 sec but imagine a trigger running every minute or a trigger running every 0.03 sec with 1000 slots

    I'd recommend setting the counter variable to counter - 1 too

    however I probably did not understand it fully
    I'd do it like that:
     

    Attached Files:

  6. Hanky

    Hanky

    Joined:
    Jan 15, 2007
    Messages:
    353
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Ok sure...

    oO I have forgot to do this... will be added ... seems like I was yesterday just to tired...

    Edit: Ok new version is up with those fixes...

    Edit2:

    Sure they won't but next time if a guy is using an ineffective indexing system I'll just link to this system... ;)
     
  7. D4RK_G4ND4LF

    D4RK_G4ND4LF

    Joined:
    Feb 4, 2009
    Messages:
    1,196
    Resources:
    20
    Models:
    3
    Spells:
    15
    Tutorials:
    2
    Resources:
    20
    that's genius!

    we should make some text containing all the usual noob mistakes and just copy and paste them :grin:
     
  8. Hanky

    Hanky

    Joined:
    Jan 15, 2007
    Messages:
    353
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Well at least it would save time... since normally nearly every newbie is making the same mistakes...
     
  9. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    Duh... why do you think I've worked my ass on the Essentials Tutorial? :p

    ----

    And well the best thing with this is that unlike tutorials, it's there for you to use... :) and it's very simple dynamic indexing.

    I've seen other methods, and even though some are similar to this, they were explained in such a complicated manner that it's impossible to know what's going on...

    So I definitely advice using this =)
     
  10. Reaper2008

    Reaper2008

    Joined:
    Jul 27, 2008
    Messages:
    1,118
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Deuterium, get a link to here in your tut.
     
  11. Deuterium

    Deuterium

    Joined:
    Mar 17, 2009
    Messages:
    1,301
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    off-topic:
    I sure will once I update the tutorial ;)
     
  12. Hanky

    Hanky

    Joined:
    Jan 15, 2007
    Messages:
    353
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Added another index system. I think it'll be harder to understand but it'll be still useful. Since If you don't use loops in your spell something like this is pretty much needed. Of course I also added some documentation to the new system...
     
    Last edited: Nov 30, 2009
  13. Foopad

    Foopad

    Joined:
    Jun 15, 2008
    Messages:
    171
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    This is really useful to GUI'ers like me, I've always had a hard time understanding indexing properly - now I've actually created a spell and released on the hive already :). I've gotten a better understanding of it! + rep!
     
  14. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    588
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    wow great job! Deut's tutor and this are really awesome for GUI beginners. i will suggest this as well to GUI guys :)

    Best Regards, 5/5!
    ~Dark Dragon
     
  15. Hanky

    Hanky

    Joined:
    Jan 15, 2007
    Messages:
    353
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Update:

    New example added. The example is about how to make a MUI channeling spell in GUI using those index systems.
     
  16. Foopad

    Foopad

    Joined:
    Jun 15, 2008
    Messages:
    171
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    I've found a "bug". If you copy paste the trigger into a new map, the integer SPELL_LOOP is not copied as a variable correctly, it is never used besides in an array. I don't know if this could be fixed by setting it to something somewhere, or you just have to mention it. I may cause confusion to rookies :)
     
  17. Hanky

    Hanky

    Joined:
    Jan 15, 2007
    Messages:
    353
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    It's used in the loop. It's just an integer like for example Integer A. And if it's not copied correctly it seems like it's the fault of the editor and not mine ;)
     
  18. M_Vegeta

    M_Vegeta

    Joined:
    Feb 20, 2008
    Messages:
    439
    Resources:
    1
    Spells:
    1
    Resources:
    1
    I wonder why this system more efficient than paladon dynamic indexing system with the DDR recycle thingy o_O
     
  19. Hanky

    Hanky

    Joined:
    Jan 15, 2007
    Messages:
    353
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Because "Paladons Indexing System" (if you really want to call it so) isn't dynamic at all.

    Ok I'll describe you what "Paladons Indexing System" does:
    After really every object in an/a array/loop is inactive the whole indexing get reseted and it start from zero. The bad thing about that is that this way is pretty ineffective. Just imagine that you have one spell and you cast it like 40 times in a row. Not at the same time but so that like short before the spell really ends you begin to cast the spell once again. So it will loop through the array also if objects are inactive. Just after really every object is inactive the whole indexing thing get reseted. I hope understood what I mean.

    Now I describe what this dynamic indexing template does:
    Well this template is an effective dynamic indexing system. Instead of looping through the whole array until the indexing get reseted it recycle the index instantly. That means if you cast one spell 40 times in a row (like in the example I told you in the description of "Paladons Indexing System"). It will loop really just through those indexes that are active. That's a big performance difference to "Paladons Indexing System".


    I also added in the last version an example that shows how easy it is with using this template to make a MUI channeling spell in GUI. There are many possibilities to use this template to make your spell MUI and effective at the same time.

    But in the end you have to decide what system you are using. This template is just a help. How I said in the description it's not needed to give me credits if you use it since everybody should know this simple indexing stuff.