System IDEA - Item Death Event & Autoindexer

Azlier

Old World Ghost
Reaction score
461
>no guarantee that the removed items will last for 5 seconds, they will just last at most five seconds

I have tested that issue, and another system called HT has been implemented into KT to handle long periods with accuracy. The items are removed after 5 seconds, in exactly the order I spam-picked them up.
 

Azlier

Old World Ghost
Reaction score
461
Quick fix for 1.23b. It's slower now. Hurray. Let's hope Blizzard gives us GetTriggerItem, then it becomes fast.

Also, structs attached to items via the module will now attempt to destroy themselves. Sooner or later. Best I could do without a timer scanning indices.

A MyData[MyItem] == 0 check before messing with IDEA structs can do a lot of good.

Great, now I have to wait for both Blizzard AND Vexorian. :(
 

Azlier

Old World Ghost
Reaction score
461
No. We're talking about an item death event, here.
 

Azlier

Old World Ghost
Reaction score
461
Blizzard isn't supporting casting from widgets directly to units, destructables, or items anymore. So, in a way, it did use "unsafe" upcasting. Even though it could only be an item the entire time.
 

Jesus4Lyf

Good Idea™
Reaction score
397
I think this needs resurrection.
JASS:
struct MyItemData extends array
    real x
    real y
    implement IDEA
    private method IDEA_onCreate takes nothing returns nothing
        set this.x=GetItemX(this.item)
        set this.y=GetItemY(this.item)
    endmethod
    private method IDEA_onDestroy takes nothing returns nothing
        call BJDebugMsg("Item Removed")
    endmethod
endstruct

Can you make it work? :p
 

Azlier

Old World Ghost
Reaction score
461
I can't at the moment.

I'd be glad to make it work. It's teeeerrible at the moment.

And I'm still waiting for better hooks to perfect this.
 

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:
function RemoveItemEx takes item i returns nothing //For compatibility.

That's not compatible - it doesn't remove items?

IDEA structs should have the static IDEA_filter method, because that would allow you to make structs specific to an item type (very useful with items). Of course, the filter would just prevent onCreate and onDestroy from firing. :)

I don't think IDEA structs support recursion - what if when one item is created, we create another item? Won't subsequent onCreate methods fail for the original item?

How about methods like onAquire, onDrop and onUse?
(And a documented paradigm about when these fire, such as an item cannot come to be on a unit without onAquire firing immediately after it is picked up). :)

You probably noticed my attempt at making this redundant, but the code was ridiculous... but the methods you can implement could work well here.
 

Azlier

Old World Ghost
Reaction score
461
And I thought I could sneak away without a filter method. I should go back to AIDS and steal more code to fix the recursion thing, if there is indeed a problem.

I suppose those other methods are certainly doable.

EDIT:
It does indeed fail recursively.

>That's not compatible - it doesn't remove items?

Oh snap. You're right.

Can't fix that either, unless I remove it. Remove it I shall.

EDIT2:

Having big problems trying to figure out how AIDS handles recursion.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Having big problems trying to figure out how AIDS handles recursion.
*Nods and smiles*

A function which calls itself stores its local variables somewhere, naturally, and obviously not in the same place each time. It attaches to the instance of the function. Rite?

So it makes a stack. In AIDS, I make a parallel stack in JASS. To simulate locals, which can be accessed globally... eh, you get the picture. Maybe someone else can explain it better (or myself, if you still don't get it).
 

grim002

New Member
Reaction score
0
Or maybe you could actually use local variables.

I can't believe that you would need to store local variables in a stack and access them globally except in cases of bad code design.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Or maybe you could actually use local variables.

I can't believe that you would need to store local variables in a stack and access them globally except in cases of bad code design.
Having not written a system like this for efficiency yourself, fair enough to say that...

To fire a dynamic number of functions in the most efficient way, where the number is decided on map init, one uses a single trigger - to which all said functions are attached (as conditions). If that fires itself (or potentially can), one must use the said method (a stack) to cause the same values to be passed to each called function on the trigger successfully.

It actually has nothing to do with local variables, it's just attaching the value to the instance of the function calls.

You prefer to make n triggers and run through them manually using an array (function interface solution to the problem, as seen in AI last time I checked). It's just not as efficient.

Edit: It's actually for anything recursive that uses WC3 natives. You stab your efficiency if you don't. My Damage system does it, recursive GroupEnums should use it, etc. :)
On the same token as it's "poor code design", so is attaching values to timers. The timer should natively contain the data.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
Woah, holy shit, hiding an item apparently causes IDEA to destroy it.
 

Azlier

Old World Ghost
Reaction score
461
Well that's a problem now isn't it. I wonder what causes that...
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
I think also unhiding an item reallocates it? Although that might be a problem on my side...

EDIT:
Hmmm....

JASS:
function GetItemIndex takes item i returns integer
    if GetItemUserData(i) != null then
        //! runtextmacro IDEA__RegisterItem("i")
    endif
    return s_Data.tempData
endfunction


This doesn't look right. If the item already has data, register it again? And what's with the strange return?

EDIT2:

JASS:
function GetItemIndex takes item i returns integer
    local integer k = GetItemUserData(i)
    if k == 0 then
        //! runtextmacro IDEA__RegisterItem("i")
        return s_Data.tempData
    endif
    return k
endfunction


this seems to solve my other problem (not the destroying problem)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • 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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top