System Advanced Indexing & Data Storage

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
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
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
Bribe:
1. You don't get what this does at all.

1. I get it now =).
 

Jesus4Lyf

Good Idea™
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
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™
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™
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.
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
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
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
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
It works fine with UnitIndexer if you use the current version. It was updated a few months ago to support that.
 

Jesus4Lyf

Good Idea™
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
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.
  • The Helper The Helper:
    seeing some weird stuff doing some moves to the new Weird News forum please see the bathroom admins
  • The Helper The Helper:
    :) it is weird
  • The Helper The Helper:
    btw it was just lag the weirdness is gone
  • Wizard Wizard:
    I checked!
    +1
  • Blackveiled Blackveiled:
    How is everyone doing?
  • Wizard Wizard:
    Alright!
  • The Helper The Helper:
    Doing well thanks!
  • The Helper The Helper:
    Tom Mai check out the post I just found you made in 2006, from an apparent banned account, I do not remember that happening, the post is in the General Discussion Hall of Fame about record breakers
  • Blackveiled Blackveiled:
    Lmao thats somethin right there.
  • tom_mai78101 tom_mai78101:
    How far back were you looking at?
  • tom_mai78101 tom_mai78101:
    But yes, that was me.
  • The Helper The Helper:
    Do you think I am looking back in the forums for this stuff? LOL, no, I find these posts in the Members Online section or the stats - all these old posts I am bumping and moving around are what people are actually looking at on the website
  • tom_mai78101 tom_mai78101:
    Interesting.
  • The Helper The Helper:
    hey Tom your Burrito news is going viral by TheHelper.net standards LOL
  • The Helper The Helper:
    looks like The Burrito has been shared to facebook lol I am getting the facebook bots in now
  • The Helper The Helper:
    I am going to do one more News Forum like the Weird News but this one is Science News for all the cool science and technology articles in the Archive
  • tom_mai78101 tom_mai78101:
    Hmm, do I need to start posting some of the Science and Technology news to this new section in the future?
  • tom_mai78101 tom_mai78101:
    Or do we need to move the news to their respective sections once the threads are old enough, read to be put into the News Archive?
  • The Helper The Helper:
    The 2nd thing
  • The Helper The Helper:
    I have been moving stuff from the current Headline news like a year old and stuff over when I see it in the logs or members online but mostly I have been moving stuff from the Archives
  • The Helper The Helper:
    It is possible to automate it so that instead of moving to Archive if it has the Science, technology or sci tech tag that it gets archived there instead. I am considering a new Weird News Tag
  • tom_mai78101 tom_mai78101:
    Please do. I'll try to tag the news appropriately when I get the chance.
  • The Helper The Helper:
    The new Discourse forum software we are moving to next does alot with the tags and also hashtags
  • The Helper The Helper:
    OK I found the source of your burrito post stuff it is from Reddit and possibly a facebook post too but definitely reddit

    Staff online

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top