| 08-10-2008, 04:43 PM | #1 |
DioD posting his weird profile version of creating texttags got me checking the script section for this wonderful function. I was surprised to find that it isn't there -- So here I am. This function creates a texttag that cleans itself up happily over time, rising and fading like pretty texttags do. An example usage is below, 10 is the default font for fading text. I figure it's a pretty basic function with pretty basic applications, but it's one of those functions I find I use in every map I've ever made so I imagine it's that useful to others as well. JASS:function FadingText takes player p, string msg, integer red, integer green, integer blue, real x, real y, real vel, real fade, real life, real size returns nothing local texttag t = CreateTextTag() set size = size * 0.024 / 10 call SetTextTagText(t, msg, size) call SetTextTagPos(t, x, y, 0.00) call SetTextTagColor(t, red, green, blue, 255) call SetTextTagVelocity(t, 0, vel) if p != null then call SetTextTagVisibility(t, (GetLocalPlayer() == p)) endif call SetTextTagFadepoint(t, fade) call SetTextTagLifespan(t, life) call SetTextTagPermanent(t, false) set t = null endfunction Example Use:call FadingText(Player(3), "I am a texttag!", 255, 255, 255, x, y, 0.04, 2, 5, 10) |
| 08-10-2008, 05:43 PM | #2 |
It sux, too many parameters. |
| 08-10-2008, 06:21 PM | #3 |
I already submitted one just like this, but w/ less parameters... but since it was part of the ugly "pack" (what was I thinking?), it got tossed away without a second thought. |
| 08-10-2008, 07:19 PM | #4 | |
Quote:
Dusk, have you considered using ARGB for this? I think it's a good standard for colours and should be used, at least I intend to use it in the future. |
| 08-10-2008, 09:51 PM | #5 |
This is a pretty standardized function though, Wulf. Stuff like this and SimError and so forth can work on their own. However, a script resource that says "Bunch of useful functions" lacks description and so people don't get as much out of it. A 'FadingText' resource could then be viable where a pack of functions is not. And ARGB is something I'm unfamiliar with on how to use -- And Vex isn't the best at explaining sometimes. :p I could make a version with it, though. |
| 08-10-2008, 10:53 PM | #6 |
Yeah yeah I know. Your version is better anyways, mine was tailored for my use =P |
| 08-10-2008, 11:39 PM | #7 | |
Quote:
Of course it is. When a function has too many params it means that it is overgeneralized. Divide and Conquer is the fundamental principle of programming. |
| 08-10-2008, 11:43 PM | #8 |
I don't think 11 is too many. Besides, if you want to blame anyone, blame Blizzard for giving texttags so many different things you can change about them. |
| 08-11-2008, 03:35 AM | #9 |
This function much more weird then my, you force user to pass many useless params. |
| 08-11-2008, 03:39 AM | #10 |
I don't see a single param with no use. |
| 08-11-2008, 04:03 AM | #11 |
Text tags created to indicate something, like bounty, damage or income, you actually do not need soo many options, you wont use them anyway. You will choose text tag options for your event and will use them again and again with out any changes. Size will always be 0.024, color always red. |
| 08-11-2008, 04:46 AM | #12 | |
Quote:
|
| 08-11-2008, 04:47 AM | #13 | |
Quote:
11 params is not bad at all. Is it a lot? Yes. Is it necessary? Depends. If you don't need one, it doesn't take a genius to remove it. |
| 08-11-2008, 07:03 AM | #14 |
Well at any rate it's good to have it here for ppl to base their own custom functions on. I don't actually use this function, I just make my own custom ones for each purpose, JASS:call GoldTextTag JASS:call CriticalTextTag |
| 08-11-2008, 01:08 PM | #15 |
This was nice before blizz added the Fade natives, I think the long parameter list makes it more complicated than calling the natives alone. I guess some people would prefer it somehow, so I approve it, at least it works as a documentation on how to make fading things. |
