Snippet CastText

Nerfpl

New Member
Reaction score
53
Cast Text

As future traning in JASS i created simple "spell"
I know its usless for maps basicly but... but nothing, i like it, it was fun to make.

Descryption: Create Text from bunch of dummy units. Text can be modified by simply typing other thing.

It works as "system" so you should put it in map Custom script place, and then just call it with function like in example.
Currently only based on dummy unit, because i didnt want to play with MUI. (now it is MUI because unit lifetime)

To use in GUI:
Custom Script:call CreatePixelText(TEXT, LOCATION, LIFETIME, DENSITY, SCALE, UNIT (RAWCODE))
better example in map
CastText.jpg

CODE: (for your own risk)
JASS:
///////////////////////////////////////////////////////////
// Simple Cast text function                                        
// Author: <a href="mailto:[email protected]">[email protected]</a>                                        
//                                                                
// -Only CAPITAL letters at the moment                           
// -Also few symbols dont work. &quot;\&quot; &quot;&quot;&quot; &quot;&#039;&quot; &quot;$&quot;                 
// -Each scale and density give basicly diffrent effect
// loc i location to start from. upper right corner of text box
// life is lifetime of text                                 
// den is Density(spacing)                                   
// scale is scale of used unit. (should go up with density) 
// integer dummy should be in raw code like &#039;e000&#039;         
////////////////////////////////////////////////////////////


function CreatePixelText takes string text, location loc, real life, real den, real scale, integer dummy returns nothing
    local location loc2 = loc
    local integer loop1s = 1
    local integer loop1e = 7
    local integer loop2s
    local integer loop2e
    local location textloc
    local integer x1 = 1
    local integer x2 = StringLength(text)
    local integer i
    local unit array blank
    local integer u1 = 1
    local integer u2 = 49
    loop
        exitwhen x1 &gt; x2
        set loop1s = 1
        set i = 1
            loop
                exitwhen loop1s &gt; loop1e
                set loop2s = 1
                set loop2e = 7
                    loop
                        exitwhen loop2s &gt; loop2e
                        set textloc = Location( GetLocationX(loc2) + loop1s * den, GetLocationY(loc2) - loop2s * den)
                        set blank<i> = CreateUnitAtLoc(Player(15), dummy, textloc, 270.00)
                        call UnitApplyTimedLife(blank<i>, &#039;BTLF&#039;, life)
                        call SetUnitScale(blank<i>, scale,scale,scale)
                        set i = i + 1
                        call RemoveLocation(textloc)
                        set textloc = null
                        //call BJDebugMsg(&quot;loop1s:&quot;+I2S(loop2s))
                        set loop2s = loop2s + 1
                    endloop
                //call BJDebugMsg(&quot;loop1s:&quot;+I2S(loop1s))
                set loop1s = loop1s + 1
            endloop
        //Empty grid to create symbols
        if SubString(text,x1-1,x1)==&quot;A&quot; then
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;B&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[40])
        elseif SubString(text,x1-1,x1)==&quot;C&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;D&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        elseif SubString(text,x1-1,x1)==&quot;E&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;F&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[37])
        elseif SubString(text,x1-1,x1)==&quot;G&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;H&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;I&quot; then
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        elseif SubString(text,x1-1,x1)==&quot;J&quot; then
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        elseif SubString(text,x1-1,x1)==&quot;K&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[34])
        elseif SubString(text,x1-1,x1)==&quot;L&quot; then
        // L looks dumb
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;M&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;N&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;O&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;P&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        elseif SubString(text,x1-1,x1)==&quot;Q&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;R&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;S&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;T&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[37])
        elseif SubString(text,x1-1,x1)==&quot;U&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;W&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;X&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;Y&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[37])
        elseif SubString(text,x1-1,x1)==&quot;Z&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;.&quot; then
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[34])
        elseif SubString(text,x1-1,x1)==&quot;:&quot; then
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[34])
        elseif SubString(text,x1-1,x1)==&quot;&#039;&quot; then
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        elseif SubString(text,x1-1,x1)==&quot; &quot; then
        elseif SubString(text,x1-1,x1)==&quot;/&quot; then
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[37])
        elseif SubString(text,x1-1,x1)==&quot;!&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[13])
        elseif SubString(text,x1-1,x1)==&quot;?&quot; then
        //that sux too becaue its ugly
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        elseif SubString(text,x1-1,x1)==&quot;@&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;#&quot; then
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[40])
        elseif SubString(text,x1-1,x1)==&quot;$&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;%&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;^&quot; then
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[39])
        elseif SubString(text,x1-1,x1)==&quot;&amp;&quot; then
        //Fuck thats hard...
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;*&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;(&quot; then
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[34])
        elseif SubString(text,x1-1,x1)==&quot;)&quot; then
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        elseif SubString(text,x1-1,x1)==&quot;-&quot; then
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[32])
        elseif SubString(text,x1-1,x1)==&quot;_&quot; then
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;+&quot; then
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[32])
        elseif SubString(text,x1-1,x1)==&quot;=&quot; then
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[33])
        elseif SubString(text,x1-1,x1)==&quot;|&quot; then
        // same as &quot;I&quot;
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        elseif SubString(text,x1-1,x1)==&quot;[&quot; then
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[34])
        elseif SubString(text,x1-1,x1)==&quot;]&quot; then
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        elseif SubString(text,x1-1,x1)==&quot;}&quot; then
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[32])
        elseif SubString(text,x1-1,x1)==&quot;{&quot; then
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[34])
        elseif SubString(text,x1-1,x1)==&quot;1&quot; then
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        elseif SubString(text,x1-1,x1)==&quot;2&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;3&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;4&quot; then
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[24])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[26])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[32])
        elseif SubString(text,x1-1,x1)==&quot;5&quot; then
        //same as &quot;S&quot;
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;6&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;7&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[37])
        elseif SubString(text,x1-1,x1)==&quot;8&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[12])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;9&quot; then
        call RemoveUnit(blank[9])
        call RemoveUnit(blank[10])
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[13])
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[25])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[34])
        call RemoveUnit(blank[37])
        call RemoveUnit(blank[38])
        call RemoveUnit(blank[39])
        call RemoveUnit(blank[40])
        call RemoveUnit(blank[41])
        elseif SubString(text,x1-1,x1)==&quot;0&quot; then
        call RemoveUnit(blank[16])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[18])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[20])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[30])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[32])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[34])
        elseif SubString(text,x1-1,x1)==&quot;&lt;&quot; then
        call RemoveUnit(blank[11])
        call RemoveUnit(blank[17])
        call RemoveUnit(blank[19])
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[27])
        elseif SubString(text,x1-1,x1)==&quot;&gt;&quot; then
        call RemoveUnit(blank[23])
        call RemoveUnit(blank[27])
        call RemoveUnit(blank[31])
        call RemoveUnit(blank[33])
        call RemoveUnit(blank[39])
        endif
        // here it will remove last column if symbol is not last, so it give less space and dont put first column at last column
        if x1 &gt;= 1 then
            if x1 != x2 then
                call RemoveUnit(blank[43])
                call RemoveUnit(blank[44])
                call RemoveUnit(blank[45])
                call RemoveUnit(blank[46])
                call RemoveUnit(blank[47])
                call RemoveUnit(blank[48])
                call RemoveUnit(blank[49])
            endif
        endif
        set u1 = 1
        loop
            exitwhen u1 &gt; u2
            set blank[u1] = null
            set u1 = u1 + 1
        endloop
    set loc2 = Location(GetLocationX(loc2) + (den * 6), GetLocationY(loc2))
    //call BJDebugMsg(&quot;loop1s:&quot;+I2S(x1))
    set x1 = x1 + 1
    endloop
    call RemoveLocation(loc2)
    set loc2 = null
endfunction </i></i></i>


If you want edit symbols thats the grid: ( But you should write it on paper)
Code:
1 8  15 22 29 36 43
2 9  16 23 30 37 44
3 10 17 24 31 38 45
4 11 18 25 32 39 46
5 12 19 26 33 40 47
6 13 20 27 34 41 48
7 14 21 28 35 42 49
 

Attachments

  • Cast Text.w3x
    19.7 KB · Views: 189

Flare

Stops copies me!
Reaction score
662
Can't see this being the most useful thing to people, but it does look pretty cool :p

JASS:
local location loc2 = loc

Just use loc, instead of declaring another variable that points to it?

JASS:
call RemoveLocation(loc)

What if someone still needs to use the taken location after calling the function? Parameters that are capable of being destroyed shouldn't be destroyed by the function. If it leaks, the end-user should set it in a variable, use it, and destroy it later when they no longer have use of the location e.g.
JASS:
local location l = Location (100, 50)
call CreatePixelText (&quot;hello&quot;, l, ...)
//And now...
call CreateUnitAtLoc (whichPlayer, unitId, l, bj_UNIT_FACING)

The CreateUnitAtLoc line will screw up, since you've destroyed the location we were going to use

ALso, an explanation of what each parameter does would be great - where is loc with respect to the text displayed, what exactly does den do, and so on. Most people won't bother reading through the script (or won't be able to), so how are they expected to know how each parameter affects the function


Also, thread tag has been changed to [Snippet]
 

Nerfpl

New Member
Reaction score
53
ok added notes and fixed loc thingy :)

btw i know its not useful
its because i thought when it takes loc it create own local. so string shouldnt be nulled too then
 

quraji

zap
Reaction score
144
Seems to work fine..
LOLBOOBS.jpg


Although the code itself is scary..there are other ways to do this :p

>its because i thought when it takes loc it create own local. so string shouldnt be nulled too then

Yes you have your own variable but it points to the same location. When you RemoveLocation(loc) you aren't removing loc..you're removing the location pointed to by loc. Don't destroy function arguments, the user may need them.
 

Nerfpl

New Member
Reaction score
53
code looks scarry when the IFs start :)
but i thought alot and i found this most easy to edit symbols after all.
 

Exide

I am amazingly focused right now!
Reaction score
448
This is really nice. ^^

You should create a trigger to invert the text, though. (Now it's a square of dots with missing dots to show text. I want it to be dots to form the text, and missing dots around.)
Sort of like if you have a paper and paint it almost all black, except for the part where the words are, which you leave white. -Do it the other way around. :p
 

Romek

Super Moderator
Reaction score
963
Could you fix the indentation please? It's quite ugly, and is quote confusing to read.

Also, you can use the StringCase(string, true) function to make 'string' capital.
For example:
JASS:
set s = StringCase(&quot;HeLlO WoRlD&quot;, true)

Will make s == "HELLO WORLD"

Can be used to remove the "Only caps limitation. At least until you implement small letters. :))

Oh, and I should mention that "RemoveUnit()" can actually cause bugs.
A real shame for a snippet like this that uses it a lot.

Use call ShowUnit(u, false); call KillUnit(u) instead.
 

Nerfpl

New Member
Reaction score
53
Im glad you like it. I will update when i get sick of my RPG creating ^^

Also added Grid under image if any1 want to edit symbols lol gl
 

Romek

Super Moderator
Reaction score
963
> Which ones?
I heard it can cause handle stack corruption.
Actually, I've heard it many times from many people.
 

Romek

Super Moderator
Reaction score
963
> It'll be extremely hard to corrupt the stack without casting from integer to handle.
But we don't know whether the map this will be implemented into will do exactly that.

Some maps still use Ancient Handle Vars.
 

Tom Jones

N/A
Reaction score
437
> It'll be extremely hard to corrupt the stack without casting from integer to handle.
But we don't know whether the map this will be implemented into will do exactly that.

Some maps still use Ancient Handle Vars.
I agree, but that's not the issue at hand here. If you "miscast" a integer to a handle, it doesn't really matter what function you use to destroy that handle with:
JASS:
function H2I takes handle h returns integer
    return h
    return 0
endfunction

function I2Vfx takes integer i returns effect
    return i
    return null
endfunction

function Test takes nothing returns nothing
    local timer t = CreateTimer()
    local effect vfx = I2Vfx(H2I(t))
    
    call DestroyEffect(vfx)
    call DestroyTimer(t)
    set t = null
    set vfx = null
endfunction
It saves just fine, but it's oh so wrong.

*Edit*
My point is, we can't account for user stupidity.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top