System Rectwraps

Troll-Brain

You can change this now in User CP.
Reaction score
85
Aha that's evil, it's just a JassHelper future or bug, depends your opinion :D

When a method doesn't need to be evaluated (because the function exist before his call) then JassHelper doesn't evaluate it, and the state of debug mode doesn't matter.

JASS:
struct s_data

   method A takes nothing returns nothing
    // code
   endmethod

   method B takes nothing returns nothing
      call this.A.evaluate() // ignored !!!! it compiles like "call this.A()"
   endmethod

endstruct


I guess it's because Vexorian thought TriggerEvaluate didn't open a new thread, but it's false.
And also probably to inline, when it's possible, some auto evaluated methods if you don't have turned on [forcemethodevaluate] inside jasshelper.conf
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Instead of using .execute you could still use . evaluate

JASS:
    method replaceTerrain takes integer oldTerrain, integer terrain returns nothing
        set .old = oldTerrain
        set .new = terrain
        set .curX = .minX + 64
        set .curY = .minY + 64 //Magic numbers for the win.
        set .tempRW = this
        call ReplaceTerrainA.evaluate()
    endmethod
    
    private static method ReplaceTerrainA takes nothing returns nothing
        loop
            set .curX = .tempRW.minX + 64
            call ReplaceTerrainB.evaluate()
            set .curY = .curY + 128
            exitwhen .curY > .tempRW.maxY
        endloop
    endmethod
    
    private static method ReplaceTerrainB takes nothing returns nothing
        loop
            if GetTerrainType(.curX, .curY) == .old then
                call SetTerrainType(.curX, .curY, .new, -1, 1, 1)
            endif
            set .curX = .curX + 128
            exitwhen .curX > .tempRW.maxX
        endloop
    endmethod


Also i see more your attachment as a proof of concept than something that really should be used, we have GetHandleId and hashtables now.
 

Executor

I see you
Reaction score
57
What about optional Event requirement? You could add the Event library wrapped in a static if..
 

Azlier

Old World Ghost
Reaction score
461
>Instead of using .execute you could still use . evaluate

I should just manually evaluate everything the way this is headed.

>What about optional Event requirement?

Two reasons.

1. EventReg is the bane of my very existence.
2. WC3C has this unwritten and often debated rule about not being able to require outside systems, perhaps even optionally. I'd rather not get tangled in that web.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
I should just manually evaluate everything the way this is headed.
But it will create useless triggers and conditions, if you don't need to open a new thread though.
Not something really relevant, but still.

Oh and don't forget that you will save many bits of code if you don't optimize your map :D
 

Executor

I see you
Reaction score
57
>What about optional Event requirement?

Two reasons.

1. EventReg is the bane of my very existence.
2. WC3C has this unwritten and often debated rule about not being able to require outside systems, perhaps even optionally. I'd rather not get tangled in that web.

Hm, but who could say anything against sth. like this:

JASS:

library RectWraps requires optional Event
    // ...
endlibrary
static if not LIBRARY_Event then
    library Event
        // ...
    endlibrary
endif


Just putting the optional Event library on the bottom.
User has Event => Yours is 'deleted'
User hasn't Event => Yours is used
:)
 

Azlier

Old World Ghost
Reaction score
461
>Hm, but who could say anything against sth. like...

WC3C staff.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
>Hm, but who could say anything against sth. like...

WC3C staff.

You forgot one big thing, you use TriggerExecute as a method to link an integer with a trigger, so there is no way it will be approved on wc3c.
And to be honest i found this method quite nice, or at least funny, but it was BEFORE GetHandleId and hashtables.
 

Azlier

Old World Ghost
Reaction score
461
This trigger method is faster (providing you create most of your rectwraps on map initialization). This is one of the few situations where the triggers can be recycled and thus can be attached to via TriggerExecCount in a good way.

This is faster than even H2I - 0x10000 (or whatever, I forget. Never used it.). And that method is, in turn, faster than a hashtable.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
This trigger method is faster (providing you create most of your rectwraps on map initialization). This is one of the few situations where the triggers can be recycled and thus can be attached to via TriggerExecCount in a good way.

This is faster than even H2I - 0x10000 (or whatever, I forget. Never used it.). And that method is, in turn, faster than a hashtable.

I won't believe it without a benchmark.
What you say about map initialization is right, but i can't believe that's the best way to attach let's say the integer (1000) to a trigger.
But yeah with small integers it should be faster.
Ofc it will be always faster to get the data.

I were a speedfreak but not really longer know, i prefer a way which is a bit slower but always O(1), no matter situations.
 

Azlier

Old World Ghost
Reaction score
461
If you ever create a rectwrap with an index over 1000 (very unlikely) and not on map initialization (unlikely), any lag spike there could be is unnoticeable even on a crappy computer such as this.

>I won't believe it without a benchmark.

I do believe it's been benchmarked at some point in time. For some system. Was it KT2? Possibly.

>Ofc it will be always faster to get the data.

Aye. This is why I use the TriggerExecCount.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
If you ever create a rectwrap with an index over 1000 (very unlikely) and not on map initialization (unlikely), any lag spike there could be is unnoticeable even on a crappy computer such as this.

It's quite reasonable to think that you can need 1000 rect on map initialization and few other ones more during the game.

Also, i prefer a code which is always O(1) for creating/getting the integer linked, but slower with few rects than your specific code (but the player can't see the difference between the 2 codes) against a code which is O(N) for creating an instance (even if it's hardly noticeable with 1000 rects on a crappy computer)

I do believe it's been benchmarked at some point in time. For some system. Was it KT2? Possibly.
Actually that makes sense that getting an integer natively associated to the trigger is lightning fast.
I believe you without any benchmark, i worry more about how you attach this integer.

Aye. This is why I use the TriggerExecCount.
Speed is not all.

I won't try to convince you more, i know you won't change your mind anyway.
But don't expect that it will be approved on wc3c on the current state, imho (maybe you don't really care also)
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Oh and the method SetTrigData needs to be improved btw.

JASS:
    private static method SetTrigData takes trigger t, integer i returns nothing
        local integer j = GetTriggerExecCount(t)
        if i < 0 then // protect dumb users from themwelves, alternatively add a static if DEBUG_MODE, if you care about one "useless" if ...
            return
        endif
        if j > i then
            call ResetTrigger(t)
            // set TriggerExec/EvalCount to 0
        else
            set i = i-j
        endif
        
        loop
            exitwhen i == 0
            call TriggerExecute(t)
            set i = i - 1
        endloop
    endmethod


And yes i definitely hate this method, because it can fuck up the user if for some reason he want to know how many times a trigger has been evaluated.
You can't attach high integers, since the limit op will be reached ...
And finally you can attach only one data for a same trigger.

EDIT : You can't even unregister the event, hence the actual version of your method SetTrigData.
 

Azlier

Old World Ghost
Reaction score
461
Jesus Christ. It seems like none of the creation methods other than .wrap worked properly, and in all this time nobody noticed. This has been fixed.
 

luorax

Invasion in Duskwood
Reaction score
67
I did not even know about this snippet. I have to say it looks nice, I think I'm going to change my AoS movement snippet to use this.

EDIT: okay, there're things that should be fixed. For example it should require Event rather than CnP'ing it. You should also get rid of the [ljass]onDestroy[/ljass] method. Rectwrap should be an array struct, you may use Alloc.

If you fix all those things I think I'll use it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      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