Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   Scripts (http://www.wc3c.net/forumdisplay.php?f=737)
-   -   FadingText (http://www.wc3c.net/showthread.php?t=101961)

Rising_Dusk 08-10-2008 05:43 PM

FadingText
 
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.
Collapse 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
Collapse Example Use:
call FadingText(Player(3), "I am a texttag!", 255, 255, 255, x, y, 0.04, 2, 5, 10)

cohadar 08-10-2008 06:43 PM

It sux, too many parameters.

darkwulfv 08-10-2008 07:21 PM

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.

Anitarf 08-10-2008 08:19 PM

Quote:

Originally Posted by cohadar
It sux, too many parameters.

Yeah, that's a really good reason for it sucking...

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.

Rising_Dusk 08-10-2008 10:51 PM

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.

darkwulfv 08-10-2008 11:53 PM

Yeah yeah I know. Your version is better anyways, mine was tailored for my use =P

cohadar 08-11-2008 12:39 AM

Quote:

Originally Posted by Anitarf
Yeah, that's a really good reason for it sucking...


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.

Rising_Dusk 08-11-2008 12:43 AM

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.

DioD 08-11-2008 04:35 AM

This function much more weird then my, you force user to pass many useless params.

Szythe 08-11-2008 04:39 AM

I don't see a single param with no use.

DioD 08-11-2008 05:03 AM

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.

Rising_Dusk 08-11-2008 05:46 AM

Quote:

Originally Posted by DioD
Text tags created to indicate something, like bounty, damage or income, you actually do not need soo many options, you wont use them anyway.

I do. I use all 12 player colors in my map and I also use different sizes for different floating text. Maybe it's not useful for you, but it's been really useful for me.

darkwulfv 08-11-2008 05:47 AM

Quote:

Size will always be 0.024, color always red.
Double wrong. I, as a matter of fact, change everything about a texttag except duration, velocity, and fadepoint, because those are static in my situations and I like the way they look. Everything else (color, size, position) is dynamic, and should be.

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.

Fulla 08-11-2008 08:03 AM

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,
Collapse JASS:
call GoldTextTag
Collapse JASS:
call CriticalTextTag
etc. etc.

Vexorian 08-11-2008 02:08 PM

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.


All times are GMT. The time now is 05:01 AM.

Powered by vBulletin (Copyright ©2000 - 2020, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services