1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. 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
  3. 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
  4. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  5. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  6. Units have been turned into heroes in our latest Icon Contest! Vote for the best icon set at the Icon Contest #18 Poll!
    Dismiss Notice
  7. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  8. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    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.

[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:
    720
    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,117
    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:
    596
    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.