Search results

  1. T

    How fast can timers execute?

    You can do this : Quick timer attach It would be faster than GetHandleId + an hashtable and even maybe than a GetHandleId - offset + an array. But i haven't made any benchmark, i just find it fun, that's all :p
  2. T

    How fast can timers execute?

    period <= 0.0001 will just be equal to 0.0001. You can do fun things with negative periods, sadly you can't return to the past, but you can link an integer to a "0" timer (even if you will have to use R2I).
  3. T

    Local variable nullification & the native CreateUnit

    1) Technically globals leak if you don't null them in the same thread you destroy them, but until you reuse them it will be only a really minor memory leak, and not an handle id one which is worse. So just assume that they don't leak, or null them when you destroy the associated handle if you...
  4. T

    Local variable nullification & the native CreateUnit

    Actually there is still the local bug explained here Though now the return bug is "fixed" and the local shadowing doesn't work anymore, indeed in the case that a local has the same name of a global variable, the global one is used. Even more even globals can make a leak, explained here...
  5. T

    Snippet Alloc

    @Nestharus : Wrong copy/paste or what ? Coz, i don't see where do you compare struct allocations here, just 15 periodic timers calling a function, and 20 periodic timers evaluating a trigger which contains 2 empty conditions which returns false. Honestly that just should be the part...
  6. T

    Linked Lists

    thistype(<integer>) == structName(<integer>), since the default vJass allocator use the index 1 to 8190, Jesus4Lyf just use the index 0 for the head of the linked list (he could use a static member instead). VJass does implicit typecasting when you use a struct instance as an integer, though...
  7. T

    Trigger Evaluate & Execute

    Both open a new thread (and so halt the previous one, since jass doesn't support multi-threads). But TriggerEvaluate is faster, plus you don't need to remove a trigger-condition when you destroy a trigger, you will have to remove a trigger-action if you destroy a trigger, else you will leak the...
  8. T

    Snippet Deflection Angle

    No it wouldn't, check the jasshelper documentation about inline, arguments must be use only one time and in the order of the function header.
  9. T

    Discussion Coolest natives

    It seems i was wrong (post edited)
  10. T

    Problem with desyncs (GetLocalPlayer?)

    There is no way even if you control the camera because it still can have a different value for each player, assuming a player minimize his warcraft3. (Btw that's how you can break the replay detection which use camera pan + a TriggerSleepAction). Alternatively you could synchronise a local...
  11. T

    Snippet TimerQueue

    The world needed this. On a serious note, just to be sure, you tested to call this wonderfull function DoNothing() in each kind of Timer callback (your script, native Timer callbacks and T32x), right ? Now in a real case scenario, where timer callback contains at very least some lines of code...
  12. T

    Efficient way to find which unit has the most units near it?

    "Mine" (which is in fact Weep's first algorithm but jassified) is neither periodical, neither got any dynamic handle allocation. But to tell you the truth, i don't understand your algorithm, i mean i don't see how it could give a right result. Maybe i should try it on a paper. :) Anyway i...
  13. T

    Efficient way to find which unit has the most units near it?

    I don't get why the worst case wouldn't be O(N²). Ofc it's not the greatest algorithm of the year but there still a pretty huge difference between doing O(N²) simple operations and O(N²) handle creations/destructions (locations at very least). But yes i didn't get that was O(N²), with 100...
  14. T

    Efficient way to find which unit has the most units near it?

    I'm not surprised that is laggy in gui, because of handles creation/destruction like location, group and such. But i would be surprised if it lags with jass code with the rect enum process, with less than let's say 100 units, you even don't need to create/destroy rects, just move them, as you...
  15. T

    Efficient way to find which unit has the most units near it?

    I agree, since accurate is not required here. (range event) Indeed for the interval check it's right, but you forgot that the periodic check is done by the wc3 engine itself, not a random jass code compiled. Or maybe i'm wrong and the final executed code is about the same. Also do you really...
  16. T

    Help with TriggerRegisterPlayerChatEvent

    A scope is a a block of code, a way to keep your code clean and organized. Well, i fail to explain what's exactly a scope, i suggest you to read the jasshelper documentation included in the JassNewGenPack.
  17. T

    Execute a code variable for callback?

    Blah, end of the word i guess. You never change your mind. Yes vJass code handling is crap but it's the most beautiful generic crap at the moment, at least for this example. And no i don't include myself in the 95 %, i'm perfectly aware about which jass2 code vJass generate. Anyway, it's always...
  18. T

    Grid "system", useful or not ? :S

    It's fine as long as you enjoy making it, i just wanted to say "don't be disappointed if nobody use your resource"
  19. T

    Execute a code variable for callback?

    Well, creating an unit just for that is way to much overkill. It's time to recognize that vJass way (function interface/.evaluate/.execute) is actually the best :D For personal purpose you can still use that, especially if you already use a dummy unit, but we can't seriously recommend it for...
  20. T

    Execute a code variable for callback?

    Ofc i thought about that, but you have to agree that's silly to open X threads instead of one, in this way the vJass solution is better, even if it needs to create a trigger in map initialisation. It was a clever idea though. It is not your fault, how ForceEnumPlayers works is totally senseless...