System Advanced Indexing & Data Storage

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
Bribe:
1. No, because after the timer the unit's user data will already be 0.

1. Why should it? The unit is dead but it's user data is not zero.

Let me give you an example:

The example I am using is really simple, create 1 footman and 4 knights, for each I save their name and location and after the map loads
I order the knights to kill the footman. When he dies the AIDS_onDestroy method should be called but it is NOT.
But if the '==' is changed to '!=' for the above mentioned line it is called.
JASS:






library aidstest uses AIDS

    struct testaids extends array
        string name
        location l
    
        method AIDS_onCreate takes nothing returns nothing
            set name = GetUnitName(this.unit)
            set l    = GetUnitLoc(this.unit)
        endmethod
        
        method AIDS_onDestroy takes nothing returns nothing
            call RemoveLocation(l)
            call BJDebugMsg("AIDS_onDestroy called")
        endmethod
        
        static method AIDS_onInit takes nothing returns nothing
            call CreateUnit(Player(0), 'hfoo', 0, 0, 0)
            call CreateUnit(Player(0), 'hkni', 0, 0, 0)
            call CreateUnit(Player(0), 'hkni', 0, 0, 0)
            call CreateUnit(Player(0), 'hkni', 0, 0, 0)
            call CreateUnit(Player(0), 'hkni', 0, 0, 0)
        endmethod

        //! runtextmacro AIDS()
    endstruct
    
endlibrary
 

Bribe

vJass errors are legion
Reaction score
67
You don't get what this does at all.

AIDS_onDestroy is called when the unit has finished decaying, or is removed, not when the unit has simply "died".

If you have it the way it is now, if you order a footman to "undefend" it will also fire the AIDS_onDestroy method. Fail.
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
Bribe:
1. You don't get what this does at all.

1. I get it now =).
 

Jesus4Lyf

Good Idea™
Reaction score
397
Just to clarify, AIDS structs are not destroyed on death, they are destroyed when the unit is removed from the game.
[LJASS]if GetUnitUserData(IndexUnit[UndefendExpiringIndex[0]]) == 0 then[/LJASS]
This line checks that the unit no longer exists. Nothing should have set it to 0, so it can only fire if the unit is gone. :)
 

Bribe

vJass errors are legion
Reaction score
67
Well Jesus, you could still do it without a timer and just check if the unit's ability level of the "Defend" ability is 0. Nestharus found out this trick.

That way AIDS_onDestroy will fire while the unit is still in scope, and you could always rework the locks to just recycle the index instead of waiting for all locks released to fire onDestroy.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Well Jesus, you could still do it without a timer and just check if the unit's ability level of the "Defend" ability is 0. Nestharus found out this trick.
Correct, and always intended to implement this. Not that it matters, nor that I will, but y'know. Could happen, right?
That way AIDS_onDestroy will fire while the unit is still in scope, and you could always rework the locks to just recycle the index instead of waiting for all locks released to fire onDestroy.
I was about to say incorrect, but you are, in fact, totally correct.

I mean, these are changes which have trivial impact and require substantial time, thought and effort, which I'm currently dedicating to another project,a t the moment. Best I can do is assure you that said project is for this community. :)
 

Jesus4Lyf

Good Idea™
Reaction score
397
And you can ofc update the AIDS macro to be a module using static ifs
I'm not so sure that this is possible with full backwards compatibility. See, unfortunately, the init orders in JassHelper were all stuffed around while this was being made, and the result is not that the init order will not be the same if I was to do that. I tried making it a module and it actually broke some of my maps, so I gave up on the silliness at the time, and just let it be.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
now im getting a syntax error whenever I use AIDS, getting this: AIDS error.png

am i doing something wrong? should i be using vjass?
 

Dirac

22710180
Reaction score
147
Looks like you don't have the latest version of the JassHelper, check the sticky in the WEHZ page for more info on the JassNewGenPack 1.5.
static if are an special tool for programming that check for constant booleans and decides whether or not the code below should be compiled. Example
JASS:
static if LIBRARY_AIDS then
    globals
        integer Index = 0
    endglobals
endif
In that case if the user doesn't have AIDS in his map the global won't exist.
 

Bribe

vJass errors are legion
Reaction score
67
Well bad example because vJass bugs with globals in static if's, it creates it anyway because it parses globals before static if's.
 

Dirac

22710180
Reaction score
147
Rofl correct, forgot about that bug.

On a side-note, i've found this bug that both UnitIndexer and AIDS have when it comes to event-firing of preplaced units, the thing is, it doesn't happen.
Yes, preplaced units gain their custom value once the map is initialized, but the events are added to functions on unit indexation AFTER the indexation per se happens.
Any ideas on how to solve this?
 

Bribe

vJass errors are legion
Reaction score
67
It works fine with UnitIndexer if you use the current version. It was updated a few months ago to support that.
 

Jesus4Lyf

Good Idea™
Reaction score
397
There's an even better bug Azlier once pointed out about units with auto-cast activated abilities being issued orders before the enters region boolexpr fires. Get with the times, people! :p

I think this applies to most indexing systems, and is easy to solve. Can't remember if I ever did address that one.

Not saying I can't/won't address these things, I just have slightly more pressing things atm.
 

JJooKKoo

New Member
Reaction score
0
I have a question how can i take the struct that i assign to unit.I use these two bot non of them works
Code:
local MyUnitStruct uData = GetUnitId(GetTriggerUnit())
 
local MyUnitStruct uData = GetUnitIndex(GetTriggerUnit())
i made the struct AIDS struct with //! runtextmacro AIDS()

edit:
I found what is wrong now i use this
Code:
local MyUnitStruct uData = MyUnitStruct[GetTriggerUnit()]

but when i initialize the struct members in method AIDS_onCreate and use to say set this.i = 100
and when i take the value from struct is is 0 .So please smoebody help me

EDIT2:
It initialize the members of the struct for dynamic added units but not for units plased in editor.So why this hapen
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      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