HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

ExTextTag

08-26-2008, 11:48 PM#1
DioD
This version not using triggers to pass values inside.
And uses textmacro for param settings.

Collapse JASS:
library ExTextTag initializer Init //requires Gx

globals

texttag Gxs_texttag

endglobals

//  Profile based Text Tag Creator.
//  v2.0
//
//  PURPOUSE:
//  > Emulation of ingame texttags (like mana burn or critical strike).
//  
//  CREDITS:
//  > Blizzard for miscdata.txt, vJass creators for extended syntax.
//
//  HOW TO IMPORT:
//  > Copy&Paste entire code to any trigger or map header
//
//  NOTE:
//  > You will need vJass editor for globals and library declaration.

//This is database functions block.
struct Params

 integer R
 integer G
 integer B
 real    V
 integer L
 integer F
 static integer COUNT = 0
 
endstruct

function LoadParams takes integer r,integer g,integer b,real v,integer l,integer f returns nothing
  local Params A = Params.COUNT
  set A.R = r
  set A.G = g
  set A.B = b
  set A.V = v
  set A.L = l
  set A.F = f
  set Params.COUNT = Params.COUNT + 1
endfunction

//! textmacro AddProfile takes NAME,R,G,B,V,I,F
globals
    
   integer $NAME$
    
endglobals

set $NAME$ = Params.COUNT
call LoadParams($R$,$G$,$B$,$V$,$I$,$F$)
//! endtextmacro

//    call CreateTextTagEx("HAHA",0.0,0.0,true,GOLD)

function CreateTextTagEx takes string Text,real X,real Y,boolean Vision, integer Profile returns nothing
    //Generic
    local Params A = 0
    
    if Profile < Params.COUNT and Profile >= 0 then
    set A = Profile
    endif
    
    set Gxs_texttag         = CreateTextTag()
    call SetTextTagText      (Gxs_texttag, Text, 0.024)
    call SetTextTagPos       (Gxs_texttag, X, Y, 0.0  )
    call SetTextTagVisibility(Gxs_texttag, Vision     )
    call SetTextTagPermanent (Gxs_texttag, false      )
    
    call SetTextTagColor     (Gxs_texttag,A.R,A.G,A.B,255)
    call SetTextTagVelocity  (Gxs_texttag,0,A.V)
    call SetTextTagLifespan  (Gxs_texttag,A.L)
    call SetTextTagFadepoint (Gxs_texttag,A.F)
    
endfunction

private function Init takes nothing returns nothing

    //! runtextmacro AddProfile("NULL","255","255","255","0.04","3","2")
    //! runtextmacro AddProfile("GOLD","225","220","0","0.03","2","1")
    //! runtextmacro AddProfile("LUMBER","0","200","80","0.03","2","1")
    //! runtextmacro AddProfile("BOUNTY","225","220","0","0.03","3","2")
    //! runtextmacro AddProfile("MISS","255","0","0","0.03","3","1")
    //! runtextmacro AddProfile("SS","160","255","0","0.04","5","2")
    //! runtextmacro AddProfile("CS","255","0","0","0.04","5","2")
    //! runtextmacro AddProfile("MB","82","82","255","0.04","5","2")

endfunction

endlibrary
08-28-2008, 02:59 PM#2
Vexorian
May I ask how are you managing to use the profiles now? For example, how would I show a texttag using the Gold profile?

Are users expected to use the textmacro? I think that would overcomplicate things.
08-28-2008, 10:32 PM#3
DioD
Code:
    //"Name","Red","Green","Blue","Velocity","Lifespan","Fadepoint"
    //! runtextmacro AddProfile("GOLD","255","220","0","0.04","5","2")
    call CreateTextTagEx("Text",X,Y,true,GOLD)

Every profile needs global variable, without textmacro user will be forced to create globals self.
11-19-2008, 02:55 AM#4
Pyrogasm
So... this seems pretty much okay to me, any objections?
On a related note, this could use ARGB, if you really wanted to. Dunno if that would really be good or bad, though.

Following the new rules, if you don't update or respond to this thread within 7 days, this will be graveyarded.
11-22-2008, 09:25 PM#5
DioD
This "system" using constants only, there is no need of ARGB, but i can change\fix\add anything if needed. (including argb struct loading support).
11-22-2008, 10:20 PM#6
Pyrogasm
It was just a "you could do this, but it doesn't really matter if you do or not" statement. As is, it's just fine!