System Advanced Indexing & Data Storage

Bribe

vJass errors are legion
Reaction score
67
JASS:
//
                // Fire things.
                call TriggerEvaluate(OnEnter)
                
            else
                
                // The unit did not pass the filters, so does not need to be auto indexed.
                // However, for certain AIDS structs, it may still require indexing.
                // These structs may index the unit on their creation.
                // We flag that an index must be assigned by setting the current index to 0.
                set ARStackIndex[ARStackLevel]=0
                
                // Fire things.
                call TriggerEvaluate(OnEnter)


Err... add this to the list. The second OnEnter, by your description, should be OnEnterAllocated. As of now, OnEnterAllocated is never evaluated. No lie.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Err... add this to the list. The second OnEnter, by your description, should be OnEnterAllocated. As of now, OnEnterAllocated is never evaluated. No lie.
Dunno what list you mean, but nice spot. It makes no practical difference, but I guess I'll intend to change that over when I update it. It's just a dumb efficiency tweak. :)
 

SanKakU

Member
Reaction score
21
Dunno what list you mean, but nice spot. It makes no practical difference, but I guess I'll intend to change that over when I update it. It's just a dumb efficiency tweak. :)

not so sure. anyway, jesus4lyf, or bribe, have you figured out yet why that spell which isn't even used causes aids to go wonky?
 

tooltiperror

Super Moderator
Reaction score
231
So, I'm wondering what I should be doing instead of using array members. The documentation said I can't use arrays as members, so should I be using globals outside the struct, or is there a better way?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
So, I'm wondering what I should be doing instead of using array members. The documentation said I can't use arrays as members, so should I be using globals outside the struct, or is there a better way?

A linked list is an alternative.
 

tooltiperror

Super Moderator
Reaction score
231
No, I mean an example of using a Linked List with AIDS instead of an array.
 

Bribe

vJass errors are legion
Reaction score
67
I used a 3-D array in conjunction with AIDS in the past (using hashtables, of course), so trust me, anything can be done. What do you want to accomplish?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
No, I mean an example of using a Linked List with AIDS instead of an array.

Exactly how detailed..?

JASS:
struct Dummy
    unit whichUnit
    Dummy next
endstruct

struct UnitSpellThing extends array

    Dummy fireRingDummies

    //! runtextmacro AIDS()

endstruct


Essentially, you would create a local Dummy variable when you wanted to iterate through the Dummies, and fireRingDummies would refer to the first dummy in the list of dummies. The other dummies are linked to the first one, as fireRingDummies.next, fireRing Dummies.next.next ... etc., until .next == Dummy(0).

To put it simply, Linked Lists are a different way of iterating through data sets, but if you HAVE to have the same type of usage as an array in an AIDS struct (which would only be the case if you had extraordinarily large data sets), go with a hashtable.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
JASS:
    //! textmacro AIDS
        // This magic line makes default methods get called which do nothing
        // if the methods are otherwise undefined.
        
        //-----------------------------------------------------------------------
        // Gotta know whether or not to destroy on deallocation...
        private boolean AIDS_instanciated
        
        //-----------------------------------------------------------------------
        static method operator[] takes unit whichUnit returns thistype
            return GetUnitId(whichUnit)
        endmethod
        
        method operator unit takes nothing returns unit
            // Allows structVar.unit to return the unit.
            return GetIndexUnit(this)
        endmethod
        
        //-----------------------------------------------------------------------
        method AIDS_addLock takes nothing returns nothing
            call AIDS_AddLock(this)
        endmethod
        method AIDS_removeLock takes nothing returns nothing
            call AIDS_RemoveLock(this)
        endmethod
        
        //-----------------------------------------------------------------------
        
        static if thistype.AIDS_onCreate.exists then
            private static method AIDS_onEnter takes nothing returns boolean
                // At this point, the unit might not have been assigned an index.
                static if thistype.AIDS_filter.exists then
                    if thistype.AIDS_filter(AIDS_GetEnteringIndexUnit()) then
                        // Flag it for destruction on deallocation.
                        set thistype(AIDS_GetIndexOfEnteringUnit()).AIDS_instanciated=true
                        // Can use inlining "Assigned" function now, as it must be assigned.
                        call thistype(AIDS_GetIndexOfEnteringUnitAllocated()).AIDS_onCreate()
                    endif
                else
                    // Flag it for destruction on deallocation.
                    set thistype(AIDS_GetIndexOfEnteringUnit()).AIDS_instanciated=true
                    // Can use inlining "Assigned" function now, as it must be assigned.
                    call thistype(AIDS_GetIndexOfEnteringUnitAllocated()).AIDS_onCreate()
                endif
                    
                return false
            endmethod
        
            private static method AIDS_onEnterAllocated takes nothing returns boolean
                // At this point, the unit must have been assigned an index.
                static if thistype.AIDS_filter.exists then
                    if thistype.AIDS_filter(AIDS_GetEnteringIndexUnit()) then
                        // Flag it for destruction on deallocation. Slightly faster!
                        set thistype(AIDS_GetIndexOfEnteringUnitAllocated()).AIDS_instanciated=true
                        // Can use inlining "Assigned" function now, as it must be assigned.
                        call thistype(AIDS_GetIndexOfEnteringUnitAllocated()).AIDS_onCreate()
                    endif
                else
                    // Flag it for destruction on deallocation. Slightly faster!
                    set thistype(AIDS_GetIndexOfEnteringUnitAllocated()).AIDS_instanciated=true
                    // Can use inlining "Assigned" function now, as it must be assigned.
                    call thistype(AIDS_GetIndexOfEnteringUnitAllocated()).AIDS_onCreate()
                endif
                
                return false
            endmethod
        endif
        
        static if thistype.AIDS_onDestroy.exists then
            private static method AIDS_onDeallocate takes nothing returns boolean
                if thistype(AIDS_GetDecayingIndex()).AIDS_instanciated then
                    call thistype(AIDS_GetDecayingIndex()).AIDS_onDestroy()
                    // Unflag destruction on deallocation.
                    set thistype(AIDS_GetDecayingIndex()).AIDS_instanciated=false
                endif
                
                return false
            endmethod
        endif
        
        //-----------------------------------------------------------------------
        private static method onInit takes nothing returns nothing
            static if thistype.AIDS_onCreate.exists then
                call AIDS_RegisterOnEnter(Filter(function thistype.AIDS_onEnter))
                call AIDS_RegisterOnEnterAllocated(Filter(function thistype.AIDS_onEnterAllocated))
            endif
            
            static if thistype.AIDS_onDestroy.exists then
                call AIDS_RegisterOnDeallocate(Filter(function thistype.AIDS_onDeallocate))
            endif
            
            // Because I robbed you of your struct's onInit method.
            static if thistype.AIDS_onInit.exists then
                call thistype.AIDS_onInit()
            endif
        endmethod
    //! endtextmacro

A slightly more efficient textmacro. :D
 

Jesus4Lyf

Good Idea™
Reaction score
397
A slightly more efficient textmacro. :D
Noted. And I actually always intended not to call the methods if they didn't exist, but at the time this was developed, that feature did not work. :)

Haven't tested it or anything, but maybe one day I'll take a look at it.. :thup:
 

Laiev

Hey Listen!!
Reaction score
188
AIDS Struct just work for unit that will enter in map, has some way to make it work for placed units?
 

Laiev

Hey Listen!!
Reaction score
188
Because this I ask:
JASS:
//          - AIDS structs cannot be created or destroyed manually. Instead, they
//            are automatically created when an appropriate unit enters the map.


hmm... so I think I'm doing something wrong because for some reason, units placed in my map just don't set the variable inside the onCreate function...

also entering units do (I add just a TimedEffect on unit when the struct is created, just for test)


the problem may be caused because some struct initialize before others and set variable are slowly then initialize struct?

because... i do something like this:

JASS:
//in some library in the initializer function:
set id = 'U001'
set data d = data.Register(id)
set d.id

//then in the struct
method AIDS_onCreate ...
    local data d = GetId(.unit)
    set .id = d.id


some problem here?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
It's not "speed" it's "order initialisation".
Because one day grim001 asked for a special feature, and Vexorian doesn't support vJass anymore now module initializers are running before any other initializers (library,scope,struct).
It still follow the library depencies but modules initializers are done before all other ones.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top