HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Handle Systems

02-01-2008, 12:41 PM#1
Fledermaus
Is there really that much difference between handle system? Should I not be using just the regular old Local Handle Variables System?. If not, which would you recomend?
02-01-2008, 12:53 PM#2
cohadar
Handle Systems Suck Balls.
02-01-2008, 12:57 PM#3
Fledermaus
What should I be using instead then?
02-01-2008, 01:12 PM#4
zen87
cohadar will always say most of the system out there suck balls when it is not ABC

btw, try vex's caster system and CSCache, one of the things I'll never miss in my map
02-01-2008, 02:57 PM#5
chobibo
@zen87: Right on man! lol, but this time cohadar is right, some of LHVS functions sucks.
@Antiquities: you can use Local Handle Vars, use only functions that store integers, but use it with arrays, store only array indexes, that would be better
02-01-2008, 03:56 PM#6
Blue_Jeans
Well, I recently learned Handle Vars, then I heard about structs. I'm telling you, man, a system using structs such as Cohadar's ABC are the way to go. However, depending on what it is you are doing you may need more than one system. Cohadar's ABC is designed to attach things ONLY to timers. If you need to attach other things, you will need to look at other systems. Normally you are attaching things to timers anyways, so this is not a problem.
02-01-2008, 04:39 PM#7
moyack
Quote:
Originally Posted by Blue_Jeans
Well, I recently learned Handle Vars, then I heard about structs. I'm telling you, man, a system using structs such as Cohadar's ABC are the way to go. However, depending on what it is you are doing you may need more than one system. Cohadar's ABC is designed to attach things ONLY to timers. If you need to attach other things, you will need to look at other systems. Normally you are attaching things to timers anyways, so this is not a problem.
That's the problem, you get limited with the excuse that you only need to attach to timers, that's the reason why I do not use ABC. If you have one system to store on timers, other on triggers, other on units, then you are not being efficient.

If you want something safe and versatile, use CSCache and attach to the required object the struct index.

Collapse Teh example:
//This example uses CSSafety to manage timers and Kattana's handle Vars to pass data to other functions
struct Data
    unit u
    real v1
    real v2
    
    static method create takes unit u, real v1, real v2 returns Data // method used to create and add the data in one line of code
        local Data D = Data.allocate()
        set D.u = u
        set D.v1 = v1
        set D.v2 = v2
        return D
    endmethod
endstruct

function Loop takes unit u returns nothing
    local timer t = GetExpiredTimer()
    local Data D = Data( GetHandleInt(t, "Data") ) //retrieves the data from the timer
    // do your stuff...
endfunction

function Actions takes nothing returns nothing
    local Data D = Data.create(GetSpellTargetUnit(), 100., 45.)
    local timer t = NewTimer()
    call SetHandleInt(t, "Data", integer(D)) // here, you attach the struct to the timer by setting the Data index...
    call TimerStart(t, 0.1, true, function Loop)
    set t = null
endfunction
02-01-2008, 05:59 PM#8
cohadar
First of all ABC can attach to timers, triggers and dialogs.
And for some timers it is better to use TT than any other systems.

As for units PUI cannot be matched.
02-01-2008, 07:05 PM#9
Blue_Jeans
Quote:
Originally Posted by cohadar
First of all ABC can attach to timers, triggers and dialogs.
And for some timers it is better to use TT than any other systems.

This is true, however, you've said it yourself that you should only attach things to timers starting on v4.6. In v5.0 you made functions for triggers and dialogs, but you never said you should use them, or at least didn't edit your previous statement to say you should.

Off-topic: Cohadar, I have some code I'd really like you to tear to pieces and tell me what I'm doing wrong. It works as far as I can tell, but I'm not sure I'm doing thing properly. I've only recently learned structs, so I am sure I have made mistakes. I need someone who can set me straight without all the fluff or fear of offending me. From reading various threads here, you are quite the orc or troll PM me if you will do it and I'll send you the code.
02-01-2008, 07:29 PM#10
Pyrogasm
Sometimes KaTTaNa's Local Handle Variables leaks gamecaches.
The main function in some versions looks like this:
Collapse JASS:
function LocalVars takes nothing returns gamecache
    return InitGameCache("JASSLocalVars.w3v")
endfunction


Quote:
Originally Posted by Blue Jeans
Off-topic: Cohadar, I have some code I'd really like you to tear to pieces and tell me what I'm doing wrong. It works as far as I can tell, but I'm not sure I'm doing thing properly. I've only recently learned structs, so I am sure I have made mistakes. I need someone who can set me straight without all the fluff or fear of offending me. From reading various threads here, you are quite the orc or troll PM me if you will do it and I'll send you the code.
Just post a thread about it... he's not the only one who will help you, and this is a forum for a reason.
02-02-2008, 10:02 AM#11
cohadar
Quote:
Originally Posted by Blue_Jeans
Off-topic: Cohadar, I have some code I'd really like you to tear to pieces and tell me what I'm doing wrong. It works as far as I can tell, but I'm not sure I'm doing thing properly. I've only recently learned structs, so I am sure I have made mistakes. I need someone who can set me straight without all the fluff or fear of offending me.

Sorry I don't give free advice.
I like to charge my knowledge in bashing, so if you have any questions ask them in jass thread and you will receive a decent mix of bash and good advice.