1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Converting GUI into JASS

Discussion in 'Triggers & Scripts' started by GIMLI_2, Dec 16, 2015.

  1. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,435
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Hi everyone

    i want to convert all of my GUI triggers into JASS, remove BJ functions, create local variables...

    i am not familiar with JASS, but that is what i came up with:

    GUI
    • Pick Hero GUI
      • Ereignisse
        • Einheit - A unit Erwirbt einen Gegenstand
      • Bedingungen
        • (Unit-type of (Hero manipulating item)) Gleich Dummy_Select
      • Aktionen
        • Set TempPlayer = (Owner of (Triggering unit))
        • Set TempInt = (Player number of TempPlayer)
        • For each (Integer Int) from 1 to 7, do (Actions)
          • Schleifen - Aktionen
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • 'IF'-Bedingungen
                • (Item-type of (Item being manipulated)) Gleich GoblinIcon[Int]
              • 'THEN'-Aktionen
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • 'IF'-Bedingungen
                    • Int Ungleich 7
                  • 'THEN'-Aktionen
                    • Set TempInt2 = Int
                    • Set TempString = chosen
                  • 'ELSE'-Aktionen
                    • Set TempInt2 = (Random integer number between 1 and 6)
                    • Set TempString = randomed
              • 'ELSE'-Aktionen
        • Set TempInt3 = (Random integer number between 1 and 8)
        • Set TempPoint = (Random point in (Load DialogIndex_Area of TempInt3 in RegionHash))
        • Einheit - Create 1 Goblin[TempInt2] for TempPlayer at TempPoint facing Vorgabe für Gebäude-Ausrichtung degrees
        • Set TempUnit1 = (Last created unit)
        • Auswahl - Select TempUnit1 for TempPlayer
        • Einheitengruppe - Add TempUnit1 to UnitGroup
        • Kamera - Pan camera for TempPlayer to TempPoint over 1.00 seconds
        • Spiel - Display to (All players) the text: (Player[TempInt] + (( |rhas + (TempString + |cff7ebff1)) + (Name of TempUnit1)))
        • Custom script: call RemoveLocation (udg_TempPoint)
        • Held - Create Item[0] and give it to TempUnit1


    JASS
    Code (vJASS):

    function PickHeroConditions takes nothing returns boolean
        if ( GetUnitTypeId(GetManipulatingUnit()) == 'h00D' ) then
        return true
        endif
        return false
    endfunction

    function PickHeroActions takes nothing returns nothing

        local player p = GetOwningPlayer(GetTriggerUnit())
        local unit u
        local integer player_id = GetPlayerId(p) + 1
        local integer unit_id
        local integer i = 1
        local string output
        local location spawn = GetRandomLocInRect(LoadRectHandle(udg_RegionHash, GetRandomInt(1, 8), udg_DialogIndex_Area))
        local real x = GetLocationX(spawn)
        local real y = GetLocationY(spawn)
       
        loop
            exitwhen i > 10
            if(GetItemTypeId(GetManipulatedItem()) == udg_GoblinIcon[i]) then
                if (i != 7) then
                    set unit_id = i
                    set output = "chosen"
                else
                    set unit_id = GetRandomInt(1, 6)
                    set output = "randomed"
                endif
            endif
            set i = i + 1
        endloop
       
        set u = CreateUnit(p, udg_Goblin[unit_id], x, y, bj_UNIT_FACING)
        call GroupAddUnit(udg_UnitGroup, u)
       
        if (GetLocalPlayer() == p) then
            call PanCameraToTimed(x, y, 1.00)
        endif
       
        if (GetLocalPlayer() == p) then
            call ClearSelection()
            call SelectUnit(u, true)
        endif
       
        call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, udg_Player[player_id] + ((" |rhas " + (output + " |cff7ebff1")) + GetUnitName(u)))
        set bj_lastCreatedItem = CreateItem(udg_Item[0], x, y)
        call UnitAddItem(u,bj_lastCreatedItem)
       
        set u = null
        set p = null
        set spawn = null
       
    endfunction

    //===========================================================================
    function InitTrig_Pick_Hero takes nothing returns nothing
        set gg_trg_Pick_Hero = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( gg_trg_Pick_Hero, EVENT_PLAYER_UNIT_PICKUP_ITEM )
        call TriggerAddCondition( gg_trg_Pick_Hero, Condition( function PickHeroConditions ) )
        call TriggerAddAction( gg_trg_Pick_Hero, function PickHeroActions )
    endfunction


     


    the JASS trigger has the same ingame result as the GUI trigger now, but i want to know if there is anything to improve (and there is for sure) and i hope you guys can give me some tips for a beginner

    thanks
     
  2. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Code (vJASS):
        set bj_lastCreatedItem = CreateItem(udg_Item[0], x, y)
        call UnitAddItem(u,bj_lastCreatedItem)

    Unless you use "Last created item" somewhere... which I can definately understand because you used GUI before, you could create a local variable of your item or even not use a variable at all.

    Code (vJASS):
        if (GetLocalPlayer() == p) then
            call PanCameraToTimed(x, y, 1.00)
        endif
       
        if (GetLocalPlayer() == p) then
            call ClearSelection()
            call SelectUnit(u, true)
        endif

    Can you give me an example of when the first and the second if statements are not the same?

    Code (vJASS):
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, udg_Player[player_id] + ((" |rhas " + (output + " |cff7ebff1")) + GetUnitName(u)))

    When displaying a message to all players, you could simply do "DisplayTextToPlayer(GetLocalPlayer(), stuff)"

    Code (vJASS):
        call TriggerAddCondition( gg_trg_Pick_Hero, Condition( function PickHeroConditions ) )
        call TriggerAddAction( gg_trg_Pick_Hero, function PickHeroActions )

    Now that you are using JASS, you can move all the actions and conditions in one function.
    Preferably in a condition because it is slightly faster because of how the threads work behind the scenes.
    On the other hand, a condition is not able to use TriggerSleepAction() because of the same reason. (But you dont want to use it anyway.)

    Code (vJASS):
    GetRandomLocInRect(LoadRectHandle(udg_RegionHash, GetRandomInt(1, 8), udg_DialogIndex_Area))

    I havent taken a look into that function, but it should be rather easy to do that manually.
    But if the code inside that function is neat and not filled with unnecessary stuff, you can keep using that.

    Code (vJASS):
    if(GetItemTypeId(GetManipulatedItem())
    ...
    if (GetLocalPlayer() == p) then
    if (GetLocalPlayer() == p) then


    These are redundant and can/should be changed into variables.
    Doing these things inside a loop is almost always redundant.

    Code (vJASS):
        if ( GetUnitTypeId(GetManipulatingUnit()) == 'h00D' ) then
        return true
        endif
        return false

    Whenever you use such things in boolean returns, you can just return the response from your boolean check:
    Code (vJASS):
         return GetUnitTypeId(GetManipulatingUnit()) == 'h00D'
     
  3. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,532
    Resources:
    23
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    5
    JASS:
    3
    Resources:
    23
    Moved to Trigger & Scripts forum!

    Code (vJASS):

    function PickHeroConditions takes nothing returns boolean
        if ( GetUnitTypeId(GetManipulatingUnit()) == 'h00D' ) then
        return true
        endif
        return false
    endfunction

    You can directly return an expression which is or true or false. ->
    Code (vJASS):
    function PickHeroConditions takes nothing returns boolean
        return GetUnitTypeId(GetManipulatingUnit()) == 'h00D'
    endfunction


    The trigger event is a PlayerUnit event, so you can use TriggeringPlayer()
    local player p = GetOwningPlayer(GetTriggerUnit())

    ->
    local player p = GetTriggerPlayer()


    You could inline:
    GetRandomLocInRect

    and
    DisplayTextToForce

    Inline means you look what is inside the red function and write in yourself,
    but in your own function. This way you don't unnecessarly call a function.

    I cut the rest because I see someone else also postet already. :)

    But two last things.
    You don't need a location at all. You could go with reals only.
    In your JASS trigger you loop from 1-10, in GUI from 1-7.

    Edit:

    In JASS you leak the location.
     
  4. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,435
    Resources:
    2
    Maps:
    2
    Resources:
    2
    thanks for your answers!
    i have some questions:

    Code (vJASS):
    if(GetItemTypeId(GetManipulatedItem())
    ...
    if (GetLocalPlayer() == p) then
    if (GetLocalPlayer() == p) then

    the GetLocalPlayer() isnt in a loop? i dont know what you mean there

    about putting the actions into the conditions: how would i do that?

    Code (vJASS):
    function PickHeroInit takes nothing returns nothing
        local trigger PickHero = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( PickHero, EVENT_PLAYER_UNIT_PICKUP_ITEM )
        call TriggerAddCondition( PickHero, Condition( function PickHeroConditions ) )
        call TriggerAddAction( PickHero, function PickHeroActions )
        set PickHero = null
    endfunction

    i tried to create a local trigger, but my trigger stopped working. i remembered doing this some years ago but i'm not sure.


    how would i do it without using a variable at all?
     
  5. Flux

    Flux

    Joined:
    Feb 6, 2014
    Messages:
    2,333
    Resources:
    28
    Maps:
    1
    Spells:
    19
    Tutorials:
    2
    JASS:
    6
    Resources:
    28
    You remove
    TriggerAddAction
    and put the whole code in
    function PickHeroConditions

    But your code must be within a huge block of if-else.
    Example:
    Code (vJASS):

    function PickHeroConditions takes nothing returns boolean
    //assign variables
    if <your condition> then
      //copy the codes in your trigger actions
    endif
    return false
    endfunction


    If you only used the variable once, you can do something like this
    Code (vJASS):

    call UnitAddItem(u, CreateItem(...))
     
     
  6. Retarded_Hobo

    Retarded_Hobo

    Joined:
    Nov 27, 2012
    Messages:
    83
    Resources:
    0
    Resources:
    0
    applied the responses in thread, though this can still be slightly refined

    Code (vJASS):
    function PickHeroConditions takes nothing returns boolean
        local player p = GetTriggerPlayer()
        local unit u
        local integer player_id = GetPlayerId(p) + 1
        local integer unit_id
        local integer i = 1
        local integer itemid = GetItemTypeId(GetManipulatedItem())
        local string output
        local rect r = LoadRectHandle(udg_RegionHash, GetRandomInt(1, 8), udg_DialogIndex_Area)
        local real x = GetRandomReal(GetRectMinX(r), GetRectMaxX(r))
        local real y = GetRandomReal(GetRectMinY(r), GetRectMaxY(r))

        if GetUnitTypeId(GetManipulatingUnit()) == 'h00D' then
            loop
                exitwhen i > 10
                if  itemid == udg_GoblinIcon[i] then
                    if i != 7 then
                        set unit_id = i
                        set output = "chosen"
                    else
                        set unit_id = GetRandomInt(1, 6)
                        set output = "randomed"
                    endif
                endif
                set i = i + 1
            endloop
       
            set u = CreateUnit(p, udg_Goblin[unit_id], x, y, bj_UNIT_FACING)
            call GroupAddUnit(udg_UnitGroup, u)
       
            if GetLocalPlayer() == p then
                call PanCameraToTimed(x, y, 1.00)
                call ClearSelection()
                call SelectUnit(u, true)
            endif
       
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, udg_Player[player_id] + ((" |rhas " + (output + " |cff7ebff1")) + GetUnitName(u)))

            set bj_lastCreatedItem = CreateItem(udg_Item[0], x, y)  // swap udg_Item[0] out for the raw code of the item (ex. 'I091')
            call UnitAddItem(u,bj_lastCreatedItem)
        endif

        call RemoveRect(r)
        set u = null
        set p = null
        set r = null
        set output = ""
    endfunction

    function PickHeroActions takes nothing returns nothing
    endfunction

    //===========================================================================
    function InitTrig_Pick_Hero takes nothing returns nothing
        local integer index

        set index = 0
        set gg_trg_Pick_Hero = CreateTrigger(  )
        loop
            call TriggerRegisterPlayerUnitEvent(gg_trg_Pick_Hero, Player(index), EVENT_PLAYER_UNIT_PICKUP_ITEM, null)

            set index = index + 1
            exitwhen index == bj_MAX_PLAYER_SLOTS
        endloop
       
        call TriggerAddCondition( gg_trg_Pick_Hero, Condition( function PickHeroConditions ) )
        call TriggerAddAction( gg_trg_Pick_Hero, function PickHeroActions )
    endfunction
     
     
  7. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I said they were redundant and next to that, loops are a big cause of redundant function calls.

    GetLocalPlayer() was used twice which makes the second one redundant and should be a variable instead.

    Not necessarily...

    Code (vJASS):
    function foo takes nothing returns boolean
       
        if not :condition: then
            return false
        endif
       
        //stuff goes here.
       
        return false
    endfunction



    Code (vJASS):
            set bj_lastCreatedItem = CreateItem(udg_Item[0], x, y)  // swap udg_Item[0] out for the raw code of the item (ex. 'I091')
            call UnitAddItem(u,bj_lastCreatedItem)

    ->
    Code (vJASS):
    call UnitAddItem(u, CreateItem(udg_Item[0], x, y))


    Code (vJASS):
    call TriggerAddAction( gg_trg_Pick_Hero, function PickHeroActions )

    Remove this.
     
  8. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,435
    Resources:
    2
    Maps:
    2
    Resources:
    2
    thanks for your replies!

    that's how my code looks now, and it still works ingame

    Code (vJASS):

    function Trig_Pick_Hero_Conditions takes nothing returns boolean
       
            local player p = GetTriggerPlayer()
            local unit u
            local integer player_id = GetPlayerId(p) + 1
            local integer unit_id
            local integer i = 1
            local string s
            local rect r = LoadRectHandle(udg_RegionHash, GetRandomInt(1, 8), udg_DialogIndex_Area)
            local real x = GetRandomReal(GetRectMinX(r), GetRectMaxX(r))
            local real y = GetRandomReal(GetRectMinY(r), GetRectMaxY(r))
            local item h = GetManipulatedItem()
       
        if GetUnitTypeId(GetManipulatingUnit()) == 'h00D' then
       
            loop
                exitwhen i > 7
                if(GetItemTypeId(h) == udg_GoblinIcon[i]) then
                    if (i != 7) then
                        set unit_id = i
                        set s = "chosen"
                    else
                        set unit_id = GetRandomInt(1, 6)
                        set s = "randomed"
                    endif
                endif
                set i = i + 1
            endloop
       
            set u = CreateUnit(p, udg_Goblin[unit_id], x, y, bj_UNIT_FACING)
            call GroupAddUnit(udg_UnitGroup, u)
       
            if (GetLocalPlayer() == p) then
                call PanCameraToTimed(x, y, 1.00)
                call ClearSelection()
                call SelectUnit(u, true)
            endif
       
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0 , udg_Player[player_id] + ((" |rhas " + (s + " |cff7ebff1")) + GetUnitName(u)))
            call UnitAddItem(u, CreateItem(udg_Item[0], x, y))
           
        endif
       
            call RemoveRect(r)
            set u = null
            set p = null
            set r = null
            set h = null
            set s = ""
       
        return false
       
    endfunction


    //===========================================================================
    function InitTrig_Pick_Hero takes nothing returns nothing
        local integer index
        set index = 0
        set gg_trg_Pick_Hero = CreateTrigger(  )
        loop
            call TriggerRegisterPlayerUnitEvent(gg_trg_Pick_Hero, Player(index), EVENT_PLAYER_UNIT_PICKUP_ITEM, null)
            set index = index + 1
            exitwhen index == bj_MAX_PLAYER_SLOTS
        endloop
        call TriggerAddCondition( gg_trg_Pick_Hero, Condition( function Trig_Pick_Hero_Conditions ) )
    endfunction
     


    i also have a problem with setting up a global item array
    Code (vJASS):

    globals
        item array Item[5]
    endglobals

    function InitActions takes nothing returns nothing
        set Item[0] = 'I000'
        set Item[1] = 'I002'
        set Item[2] = 'I001'
        set Item[3] = 'I003'
        set Item[4] = 'I005'
    endfunction

    function Initialization takes nothing returns nothing
        local trigger Init = CreateTrigger(  )
        call TriggerAddAction( Init, function InitActions )
        set trigger = null
    endfunction
     


    it says "cannot convert item to integer" or the other way around, cannot remember
     
  9. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Code (vJASS):
    GetItemTypeId(h)

    That is a constant result in a loop... so redundant from the first iteration.
    Also, you still use GetLocalPlayer() twice.

    In your globals, you create an item array.
    Items are not the same as item types.
    And next to that, item types, unit types, destructable types, abilities, etc are all integers.
    So you need an
    integer array
    instead of your item array.
    I also recommend you to create a more unique name for your global variable.

    One last thing: InitActions content should be inside Initialization.
    It will save you a trigger and a thread :D
    (There will also be a syntax error on "set trigger = null" because you should have done "set Init = null".)

    (I am also not sure how you call "Initialization()".)
     
  10. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,435
    Resources:
    2
    Maps:
    2
    Resources:
    2
    okay, i'm a bit confused about creating an initialization trigger :D

    i also created my own function but it tells me that it expects a return? but i dont want to return anything

    Code (vJASS):

    function MoveGoblin takes unit u takes real r returns nothing

        local rect rt = LoadRectHandle(udg_RegionHash, GetRandomInt(1, 8), udg_DialogIndex_Area)
        local real x = GetRandomReal(GetRectMinX(rt), GetRectMaxX(rt))
        local real y = GetRandomReal(GetRectMinY(rt), GetRectMaxY(rt))
        local player p = GetOwningPlayer(u)
       
        call SetUnitX(u, x)
        call SetUnitY(u, y)
       
        if (GetLocalPlayer() == p) then
            call PanCameraToTimed(x, y, r)
            call ClearSelection()
            call SelectUnit(u, true)
        endif
       
        call RemoveRect(rt)
        set rt = null
        set p = null
       
    endfunction
     


    edit: i solved the return thingy
     
  11. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    You have written
    takes
    twice.
    To have multiple parameters, you just separate them with a comma:
    function foo takes real r, integer i, boolean b returns nothing


    In the init trigger, you just place all your stuff inside that "Initialization" function.
    (However, I still don't know how you run it.)
     
  12. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,435
    Resources:
    2
    Maps:
    2
    Resources:
    2
    i want to run it at map initialization :D

    basically, i have a bunch of arrays in my initialization, and as you cannot set them in the globals block i need to set them in the initialization trigger?
     
  13. Flux

    Flux

    Joined:
    Feb 6, 2014
    Messages:
    2,333
    Resources:
    28
    Maps:
    1
    Spells:
    19
    Tutorials:
    2
    JASS:
    6
    Resources:
    28
    Since you're already using JNGP, put the whole code inside a
    library
    or
    scope
    . Then follow it up with
    initializer
    .
    Code (vJASS):

    scope yourSpell initializer OnInit
    ....
    ....
    //Name must match what was written after 'initializer'
    //This function will run at Map Initialization
    function OnInit takes nothing returns nothing
    ...
    endfunction

    endscope
     
     
  14. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    You may understand that something doesnt run out of itself.
    When you convert a GUI trigger to JASS, you can see that it always has 3 functions.
    1, the conditions
    2, the actions
    3, the init function.

    The init functions is always "InitTrig_<trigger-name>" and takes no parameters and returns nothing.
    This function runs on map loading (before map init) and can be used to create some stuff like triggers/timers, store some values in variables etc.
    After that comes Map init, which is when you use the gg_trg_<trigger-name> variable and set "Run on Map Initialization" to true.
    (Be aware that this has to have actions/conditions in order to do anything.)

    In libraries, structs, etc, you can have a "initializer" or "onInit" function that will also run on map loading.
    However, you should be carefull with what you do in there because all the map loadings run on one thread which means that the OP limit is a big problem when you have a lot of things running then. (But that is only for big maps :D)
     
  15. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,435
    Resources:
    2
    Maps:
    2
    Resources:
    2
    okay thanks.

    it looks like this now and it works:

    Code (vJASS):

    globals
        integer array ItemCollection[5]
    endglobals




    scope Initialization initializer OnInit
        function OnInit takes nothing returns nothing
            set ItemCollection[0] = 'I000'
            set ItemCollection[1] = 'I002'
            set ItemCollection[2] = 'I001'
            set ItemCollection[3] = 'I003'
            set ItemCollection[4] = 'I005'
        endfunction
    endscope
     
     
  16. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    That would indeed work.
    You could change OnInit to InitTrig_<trigger-name> but your current script will allow you to simply copy and paste it into other triggers because it is independent from the name.

    It is just a matter of preference.
     
  17. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,435
    Resources:
    2
    Maps:
    2
    Resources:
    2
    next problem xD

    Code (vJASS):

    function FloatingText takes string s, player p returns nothing
       
        local real r = GetRandomReal(1.00, 360.00)
        local texttag t = CreateTextTag()
        local real x = GetCameraTargetPositionX()
        local real y = GetCameraTargetPositionY()
       
        call SetTextTagText(t, s, 15.00)
        call SetTextTagPos(t, x, y, 0)
        call SetTextTagVisibility(t, true)
        call SetTextTagColor(t, 255, 255, 255, 255)
        call SetTextTagVelocity(t, 80.00, r)
        call SetTextTagPermanent(t, false)
        call SetTextTagLifespan(t, 3.00)
        call SetTextTagFadepoint(t, 2.00)
       
        set t = null
       
    endfunction
     


    text does not show up :(
     
  18. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Your size exceeds the Texttag bounds.

    I must have saved it somewere... lemme take a look.

    EDIT:
    When you take an in-depth look into the SetTextTagTextBJ function, you can see that the size is converted from texttagsize to height.
    Those names are just the names used in the convertion function :D
    The actual size is multiplied by
    0.023
    and divided by
    10
    , which means that it is about 435 times as small as you actually tried to set it.
    So what you have to do is multiply your number (
    15.00
    ) by
    0.0023
    (
    0.0345
    ) and you should be fine.

    The maximum size of a texttag is
    0.345
    (150 in GUI or BJ function) according to my tests that I did on a combat text extension on my damage engine... this may change with graphical settings but I am not sure about that.
     
  19. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,435
    Resources:
    2
    Maps:
    2
    Resources:
    2
    ok i fixed that, but it still does not show up. maybe i did sth wrong with the position of the floating text? i want to have the center of the current camera view

    another thing. if i create a function "function f takes unit u returnst nothing" for example
    do i need to null the unit u that is needed as input?
     
  20. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Parameters dont have to be nulled.

    Try placing it slightly higher than 0... something like 100-200 would do.
    Also, place a
    call BJDebugMsg("Test message")
    in it to check it is actually running.