| 10-17-2007, 06:11 PM | #1 |
I have found myself in need of attaching things to timers, triggers and dialogs. (I use other stuff for units) Is there any other handle type that anyone ever needed attaching to? |
| 10-17-2007, 07:32 PM | #2 |
Units, in rare situations destructables or players, sometimes even items, I think I even attached to groups once.......But you're right, the most common ones are triggers, timers and units (never attached anything to dialogs, though). This is because those are the most common things you can reach in any function. In a function, a timer, a unit or a trigger is almost always reachable (in rare occasions it's not), so there's actually no need to attach to something else (who has ever seen attaching stuff to boolexprs, hahaha :P). This probably didn't tell you anything. Why did you ask that question anyways? Btw, why do we say "a unit" and not "an unit"? The second one is grammatically correct, the first one isn't. |
| 10-18-2007, 06:33 AM | #3 |
I always attach stuff for spells to the timer that runs them because then you can have overlapping instances of the same spell without overwriting data like you would if you attached everything to a unit. But people say that's bad. |
| 10-18-2007, 07:27 AM | #4 |
Im not sure why you would attach stuff to players, they are just integer constants and not real handles after all. As for me, timers the most common and units and destructables. |
| 10-18-2007, 08:51 AM | #5 |
Timers, triggers. I don't usualy attach to units, I like to use structs with all things units need. |
| 10-18-2007, 09:07 AM | #6 | |
Quote:
No that is the only right way to do it. That is how I do it and that is the reason I made ABC. It is also the easiest way to do it for one-shot timers, for periodic timers some form of Collections (global array) are better. @All Also the main reason I restricted ABC from handles to timers only is because people were attaching things to units and that always makes a bugged code. I think that attaching things to groups suffers from the same problems, also as far as I know ForGroup runs all actions in the same thread so it is safe to pass data to it with globals, no attaching is needed there. The only safe way to pass data to units is to use some form of extension for UnitUserData (PUI being the obvious example) Destructables are one thing that I did not have in mind, I guess I will make version of PUI for destructables. Attaching to players is ridiculous use global array and use player numbers as indexes in that array. Items and abilities are pure integers for any sort of attachment with them Hashtables are the best solution. I also thought that attaching to triggers is not needed but then emjlr3 proved me wrong, it is indeed needed in some rare and a bit advanced cases. Than you all for commenting, if anyone thinks of any other case of attaching, please let me know. |
| 10-18-2007, 10:28 AM | #7 | |
Handle types: timers, units (with PUI btw), triggers, trees and eventids. Other: coordinates, unitids, abilcodes. Quote:
It's determined how the word is spelled pronounced, not written. If the first sound is a consonant we use a, if its a vocal we use an". |
| 10-18-2007, 10:41 AM | #8 |
eventids ? I don't get this, example please. EDIT: Does anyone have example spell for attaching to destructables, I need something to put in a demo map. Something simple preferably. |
| 10-18-2007, 02:00 PM | #9 |
Attaching stuff to timers is lame and unnecessary. I don't think any attaching to dialogs is required at all, as far as I know you can only show one dialog per player so "attaching" stuff to the player works there (it would just require an array and get player id) Triggers might be necessary to attach things to , but not that much, the only two cases where you have to attach stuff to them would be range events and damage events, both are replaceable with some better stuff. One may have to attach information to some units as part of some odd system, but not really for spells, or maybe in buff related stuff. Having fun for ability and item ids it is just having a table with info, any 'cool' system needs those... I am starting to think that for all the, rather limited, legit applications for attaching, gamecache is fine enough. |
| 10-18-2007, 02:03 PM | #10 | ||||||
Quote:
Nevermind that, I lied about that :). Quote:
Yeah, that sucks, stuff shouldn't be attached to units in spells. That way you can flush a unit you don't want to flush. Quote:
Not if using local groups, then there's no chance of interfering. It can only happen if you're stupid. Quote:
Ohhh.......I understand, darn grammar. Thanks for that grammar spot. Quote:
I don't get that too. Quote:
Nah, that's rare and almost always has a workaround. |
| 10-18-2007, 02:12 PM | #11 |
you hit the nail on the head timer, triggers, and on the occasion when I need a buff on a unit, I have to end up using GC and an extension on the handles converted string ex. I2S(H2I(unit))+"Spell Name" so it can be cleaned later without botching other things but then that is not too bad, cuz I can just store the struct to the string, and grab it later as needed, just like set/getinteger, and use the struct for the rest |
| 10-18-2007, 02:41 PM | #12 |
i attach data to timers in such way. set arrint[h2i(tmr)-mintmrhandle]=xxx // i have precached timers =) the same is for dummy units. and MBs (multiboard) but MBs in other way... |
| 10-18-2007, 03:12 PM | #13 | ||||||
Quote:
using stuff like collections for periodic timers is usually better than attaching but if you need a simple one-shot timer, or passing a variable number of data to a timer you have to use attaching. I know there are other ways of passing data to timers but attaching is by far the easier one to understand/use. Quote:
Quote:
I know a couple of them for UNIT_DAMAGE_EVENT for example, but again attaching is so much easier to understand. Quote:
Quote:
Quote:
I never use gamecache and I feel good :) @Toadcop precached timers is a system made by Infrane if i remember corectly (it is somewhere in wc3c system database) But that system has the same flaw as using gamecache for attaching, it forces you to null locals, I have better stuff to do in my life than to chase variables around. |
| 10-18-2007, 03:35 PM | #14 | ||
Quote:
Quote:
|
| 10-18-2007, 04:00 PM | #15 |
Hmm yes you are right about that, precached timers are not affected by increasing handle index I guess I was thinking about systems that rely on set arrint[handle-0x100000] once handles go past 0x102000 (8192) it breaks the array limit. gamecache on the other side is prone to I2H bugs. It is also affected by your hard-disk speed witch means that if you have slow hdd you cannot play wc3 and listen to something on winamp at the same time. :P |
