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.
  • 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