• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[General] Frame Buttons

Status
Not open for further replies.
Level 3
Joined
Nov 2, 2013
Messages
48
Hello everyone, i was learning some basic about custom frames and UI modification. Im using Jass and Warcraft 3 UI Designer Tool for this, but i got some questions that i can resolve in editor.

Can i use other Glue effects using BlzCreateFrameByType ? i know there is a blue and orange "ScoreScreenTabButtonTemplate"
I saw this video The Core of Njord
and this Acolyte of Life
and seems they use a different button. The first video uses a CLICK effect, is that a custom button or he resize the frame a short sec and then return to his normal size?
I also notice that using BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0) the buttons response faster than using "GLUEBUTTON" why? can i use a faster button like scryptdialogbutton but adding hover effect? Thanks
 
and seems they use a different button. The first video uses a CLICK effect, is that a custom button or he resize the frame a short sec and then return to his normal size?
It can be done by both, one would have to look at the source code of the map to know what The Core of Njord did.

In Fdf a Button can have one BACKDROP childFrame for each state, they all could have the same texture but a different Size/DisplaySize. (ControlBackdrop, ControlDisabledBackdrop, ControlPushedBackdrop, ControlDisabledPushedBackdrop)

But it could be done by code aswell by using Frame Enter/Leave event, player-mouseclick events and then on click scale down the last entered button, on mouseRelease scale it up again.

I expect the custom frame version to be less taxing for the map's code script, but requires custom frame-blueprints.

Can i use other Glue effects using BlzCreateFrameByType ?
If you find/create other (glue)buttons blueprints that have this glow effect, then you can inherit from them and have other glow effects. But I think I found all such in the default fdf's that can be inherited, so you would need to create new blueprints.

You could base them on the default:
Code:
Frame "GLUEBUTTON" "MyIconButtonTemplate" {
    Height 0.031,
    Width 0.031,
    ControlStyle "AUTOTRACK|HIGHLIGHTONFOCUS|HIGHLIGHTONMOUSEOVER",

    ControlFocusHighlight "MyIconicButtonFocusHighlightTemplate",
    Frame "HIGHLIGHT" "MyIconicButtonFocusHighlightTemplate" {
        HighlightType "FILETEXTURE",
        HighlightAlphaFile "UI\Widgets\Glues\GlueScreen-Button-KeyboardHighlight.blp",    
        HighlightAlphaMode "ADD",
    }

    ControlMouseOverHighlight "MyIconicButtonMouseOverHighlightTemplate",
    Frame "HIGHLIGHT" "MyIconicButtonMouseOverHighlightTemplate" {
        HighlightType "FILETEXTURE",
        HighlightAlphaFile "UI\Widgets\BattleNet\bnet-button01-highlight-mouse.blp",    
        HighlightAlphaMode "ADD",
    }
}

I also notice that using BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0) the buttons response faster than using "GLUEBUTTON" why?
No idea, haven't paid attention to that, beaware that the frameEvents provided are affected by network connection.
In fdf exists a mode: ControlStyle "CLICKONMOUSEDOWN", which makes the button act on click instead of release. But "ScriptDialogButton" does not use it.
 
Level 3
Joined
Nov 2, 2013
Messages
48
It can be done by both, one would have to look at the source code of the map to know what The Core of Njord did.

In Fdf a Button can have one BACKDROP childFrame for each state, they all could have the same texture but a different Size/DisplaySize. (ControlBackdrop, ControlDisabledBackdrop, ControlPushedBackdrop, ControlDisabledPushedBackdrop)

But it could be done by code aswell by using Frame Enter/Leave event, player-mouseclick events and then on click scale down the last entered button, on mouseRelease scale it up again.

I expect the custom frame version to be less taxing for the map's code script, but requires custom frame-blueprints.


If you find/create other (glue)buttons blueprints that have this glow effect, then you can inherit from them and have other glow effects. But I think I found all such in the default fdf's that can be inherited, so you would need to create new blueprints.

You could base them on the default:
Code:
Frame "GLUEBUTTON" "MyIconButtonTemplate" {
    Height 0.031,
    Width 0.031,
    ControlStyle "AUTOTRACK|HIGHLIGHTONFOCUS|HIGHLIGHTONMOUSEOVER",

    ControlFocusHighlight "MyIconicButtonFocusHighlightTemplate",
    Frame "HIGHLIGHT" "MyIconicButtonFocusHighlightTemplate" {
        HighlightType "FILETEXTURE",
        HighlightAlphaFile "UI\Widgets\Glues\GlueScreen-Button-KeyboardHighlight.blp",  
        HighlightAlphaMode "ADD",
    }

    ControlMouseOverHighlight "MyIconicButtonMouseOverHighlightTemplate",
    Frame "HIGHLIGHT" "MyIconicButtonMouseOverHighlightTemplate" {
        HighlightType "FILETEXTURE",
        HighlightAlphaFile "UI\Widgets\BattleNet\bnet-button01-highlight-mouse.blp",  
        HighlightAlphaMode "ADD",
    }
}


No idea, haven't paid attention to that, beaware that the frameEvents provided are affected by network connection.
In fdf exists a mode: ControlStyle "CLICKONMOUSEDOWN", which makes the button act on click instead of release. But "ScriptDialogButton" does not use it.

Wow, thanks Tasyen you are so pro in this things. I honestly, dont understand everything you said, im learning frames and codes but i will try. can u make that code for jass?

One last question, is it possible to change FloatingText Font? if is impossible, can we make frame text with custom font?
 
Last edited:
Wow, thanks Tasyen you are so pro in this things.
Thanks, I trained long enough.
One last question, is it possible to change FloatingText Font?
Yes but this is a bit wierd/buggy, I would not recomment it.
You would set TextTagFont to a different file inside war3mapSkin.txt.
can we make frame text with custom font?
yes, one can create TEXT/String frames with any font warcraft 3 supports (can be custom imported ones) and display them anywhere on the screen, also with any wanted content.
But the BlzFrameSetFont function (jass/Lua) does only work for String-Frames and I don't know how to create them with code only. Hence one has to use this files called fdf to define such frame-blueprints. And the fdf files have to be loaded over toc files.
 
Level 3
Joined
Nov 2, 2013
Messages
48
Thanks, I trained long enough.

Yes but this is a bit wierd/buggy, I would not recomment it.
You would set TextTagFont to a different file inside war3mapSkin.txt.

yes, one can create TEXT/String frames with any font warcraft 3 supports (can be custom imported ones) and display them anywhere on the screen, also with any wanted content.
But the BlzFrameSetFont function (jass/Lua) does only work for String-Frames and I don't know how to create them with code only. Hence one has to use this files called fdf to define such frame-blueprints. And the fdf files have to be loaded over toc files.
Amazing, i used a .toc and tdf from one of your tutorials, the TasButtons are exactly what i need. It took me a while to understand how all that works and how to call them by their exact name in fdf but i did it and those buttons response instantly and whit more glow effects! Thanks Tasyen. There is a way to change texture via triggers/code ingame for those buttons with background presets? i mean, looking this in fdf

JASS:
Frame "GLUEBUTTON" "TasButton" INHERITS WITHCHILDREN "TasButtonTemplate" {
    Width 0.2,
    Height 0.0265,

    Frame "BACKDROP" "TasButtonIcon" {
        UseActiveContext,
        Width 0.02,
        Height 0.021,
        SetPoint LEFT, "TasButton", LEFT, 0.002, 0,
        BackdropBackground "replaceabletextures\commandbuttons\btntemp",
    }

I can create a button frame with those presets, but there is a way to change texture backdrop ingame? how can i call it? i want to use TasButton with differents textures and change them using BlzFrameSetTexture. Another thing, Frame "StandardCampaignButtonDisabledBackdropTemplate" is not loaded by default, how can i load it in order to use it as background for a BACKDROP? I tried to add StandardTemplate.tdf in the "Include file" section in tdf and the line in Toc File too, but i cant make it to appear, just green texture. Do i need to loaded by another way? (i use a little of jass) Next time i will learn frame with custom fonts, since you told me custom fonts for floating text are buggy
 
Last edited:
but there is a way to change texture backdrop ingame? how can i call it? i want to use TasButton with differents textures and change them using BlzFrameSetTexture.
Yes, one change the Texture by map's code.
The Button's Backdrop Texture setting by code is shown in this Tutorial in the first jass block:
JASS:
//Create "HeroSelectorButton", for game UI
    local framehandle buttonFrame = BlzCreateFrame("HeroSelectorButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
//By Having created "HeroSelectorButton" also its children are created, this children are accessed using BlzGetFrameByName right after the creation or later one if the slots were not taken by other frames.
    local framehandle buttonIconFrame = BlzGetFrameByName("HeroSelectorButtonIcon", 0)
//Set a Texture
    call BlzFrameSetTexture(buttonIconFrame, "ReplaceableTextures\\CommandButtons\\BTNSelectHeroOn", 0, true)
// Place the buttonFrame to the center of the screen
    call BlzFrameSetAbsPoint(buttonFrame, FRAMEPOINT_CENTER, 0.4, 0.3)
// Give that buttonFrame a size
    call BlzFrameSetSize(buttonFrame, 0.05, 0.05)

TOC-File Loading has a bug, you need an empy ending line or the last fdf is not loaded.

toc-empty-line-white-jpg.376097


"Include file"
Is only needed when you want to use Frame-Blueprints from another FdF in this FdF. The included FdF does not need to be loaded over TOC.

 
Level 3
Joined
Nov 2, 2013
Messages
48
Yes, one change the Texture by map's code.
The Button's Backdrop Texture setting by code is shown in this Tutorial in the first jass block:
JASS:
//Create "HeroSelectorButton", for game UI
    local framehandle buttonFrame = BlzCreateFrame("HeroSelectorButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
//By Having created "HeroSelectorButton" also its children are created, this children are accessed using BlzGetFrameByName right after the creation or later one if the slots were not taken by other frames.
    local framehandle buttonIconFrame = BlzGetFrameByName("HeroSelectorButtonIcon", 0)
//Set a Texture
    call BlzFrameSetTexture(buttonIconFrame, "ReplaceableTextures\\CommandButtons\\BTNSelectHeroOn", 0, true)
// Place the buttonFrame to the center of the screen
    call BlzFrameSetAbsPoint(buttonFrame, FRAMEPOINT_CENTER, 0.4, 0.3)
// Give that buttonFrame a size
    call BlzFrameSetSize(buttonFrame, 0.05, 0.05)

TOC-File Loading has a bug, you need an empy ending line or the last fdf is not loaded.

toc-empty-line-white-jpg.376097



Is only needed when you want to use Frame-Blueprints from another FdF in this FdF. The included FdF does not need to be loaded over TOC.

Thanks Tasyen for your help, and sorry for bother you.
I understand how to change a backdrop texture, but your TasButtons got BACKDROPS inheriths in their buttons, if i create a TasButton and save that frame in a variable i can call them later, but i cant reach the backdrop of that button since it creates automatically with your tdf configuration.
JASS:
    set test = BlzCreateFrameByType("GLUEBUTTON", "TasButton", test2, "TasButtonTemplate", 0)
    call BlzFrameSetAbsPoint(test, FRAMEPOINT_CENTER, 0.3, 0.3)
    call BlzFrameSetSize(test, 0.021, 0.021)
I create the frame and then save it en "test" for future modifications, but i cant change the background since it is preset by fdf.
TasButton.png


i need to change ingame that backdrop (background) texture for this (similar but more transparent):

StandardCampaignButtonDisabledBackdropTemplateNot Loadedstandardtemplates.fdf

306318-ed0d962301f8ada88a790ec0a9fd27bc.png


I imported and loaded perfectly the Toc and Tdf files, but when i change the backdrop background for "StandardCampaignButtonDisabledBackdropTemplate" it sees green ingame. I though it coould be cause its not loaded by default?

This is your tdf code:

Lua:
//TasButtonList V10
IncludeFile "UI\FrameDef\UI\EscMenuTemplates.fdf",

Frame "GLUEBUTTON" "TasButtonTemplate" {
    ControlStyle "AUTOTRACK|HIGHLIGHTONMOUSEOVER",
    ControlMouseOverHighlight "TasButtonTemplateHighLightMouse",
    Frame "HIGHLIGHT" "TasButtonTemplateHighLightMouse" {
        HighlightType "FILETEXTURE",
        //HighlightAlphaFile "UI\Widgets\BattleNet\bnet-button01-highlight-mouse.blp",  
        //HighlightAlphaFile "ui\widgets\console\human\commandbutton\human-multipleselection-border",
        HighlightAlphaFile "ui\widgets\escmenu\human\quest-button-highlight",
        HighlightAlphaMode "ADD",
    }

    ControlBackdrop "TasButtonBackdrop",
    Frame "BACKDROP" "TasButtonBackdrop" {
        DecorateFileNames,
        BackdropTileBackground,
        BackdropBackgroundSize 0.1,
        //BackdropBackground          "EscMenuBackground",
        //BackdropBackground "EscMenuButtonBackground",
        BackdropBackground "StandardCampaignButtonDisabledBackdropTemplate",
        //BackdropBackground          "ui\widgets\escmenu\orc\orc-options-menu-background",

        BackdropCornerFlags         "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize          0.005,
        BackdropBackgroundInsets    0.0005 0.0005 0.0005 0.0005,
        //BackdropEdgeFile            "ConsoleButtonBorder",
        //BackdropEdgeFile            "UI\Widgets\Console\Human\human-console-button-up",
        //BackdropEdgeFile            "UI\Widgets\EscMenu\Human\human-options-button-border-down",
        BackdropEdgeFile "QuestDialogNormalBorder",
        BackdropBlendAll,
    }

    ControlPushedBackdrop "TasButtonBackdropPushed",
    Frame "BACKDROP" "TasButtonBackdropPushed" {
        DecorateFileNames,
        BackdropTileBackground,
        BackdropBackgroundSize 0.1,

        BackdropBackground          "QuestDialogCompletedBackground",
        BackdropCornerFlags         "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize          0.005,
        BackdropBackgroundInsets    0.0005 0.0005 0.0005 0.0005,
        //BackdropEdgeFile            "ConsoleButtonPushedBorder",
        BackdropEdgeFile            "QuestDialogCompletedBorder",

        BackdropBlendAll,
    }

}

Once again, thank you for your patience Tasyen, you are the reason i back to work in my map as inspiration! I Just need to resolve those 2 questions to continue.
 
I create the frame and then save it en "test" for future modifications, but i cant change the background since it is preset by fdf.
When a Frame is created all it's children are created as well and are stored in the frame storage accessed with BlzGetFrameByName with the same createContext you created the Frame, but with their own names.

But Children inherited lose their name and hence one can not access them using BlzGetFrameByName which happens because of the use of BlzCreateFrameByType. Either
use the FrameChild api BlzFrameGetChild(frame, index) (V1.32+ only) and then you can access childs by Index 0 or higher, the backdrops should normally have the lowest indexes.
or use BlzCreateFrame instead then the children don't lose their name and BlzGetFrameByName can be used to find them.

My Frame was build that way because I did not want to change the BACKDROPs in that Systems and that way the fdf has less lines.

I imported and loaded perfectly the Toc and Tdf files, but when i change the backdrop background for "StandardCampaignButtonDisabledBackdropTemplate" it sees green ingame. I though it coould be cause its not loaded by default?
It might be that BlzCreateFrameByType creates a BACKDROP without any setup when the inheriting & loading failed.
Try to create it with BlzCreateFrame and print it's handleId, when it is not 0 the frame was created.
 
Level 3
Joined
Nov 2, 2013
Messages
48
When a Frame is created all it's children are created as well and are stored in the frame storage accessed with BlzGetFrameByName with the same createContext you created the Frame, but with their own names.

But Children inherited lose their name and hence one can not access them using BlzGetFrameByName which happens because of the use of BlzCreateFrameByType. Either
use the FrameChild api BlzFrameGetChild(frame, index) (V1.32+ only) and then you can access childs by Index 0 or higher, the backdrops should normally have the lowest indexes.
or use BlzCreateFrame instead then the children don't lose their name and BlzGetFrameByName can be used to find them.

My Frame was build that way because I did not want to change the BACKDROPs in that Systems and that way the fdf has less lines.


It might be that BlzCreateFrameByType creates a BACKDROP without any setup when the inheriting & loading failed.
Try to create it with BlzCreateFrame and print it's handleId, when it is not 0 the frame was created.
Thanks Tasyen, i dont understan how to call a child frame and change that textures, anyway i fix it. The problem was not the path or loading neither. The "DecorateFileNames," line make the rest invalid, dont know why, but erasing that line, the "StandardCampaignButtonDisabledBackdropTemplate" loads and works perfectly.
 
Level 3
Joined
Nov 2, 2013
Messages
48
Im trying to create a backdrop frame outside the game ui bounds, i tried with ORIGIN GAME UI, WORLD FRAME UI, but those are bounded, i read that CONSOLE UI can go outisde, but when i create the frame with that origin, it just not shows up.

This is the max outside i could. but i need to reach the green circle, how i can do that ??

Sin título.png
 
You need a different parent and use - values for x.
BlzGetFrameByName("ConsoleUIBackdrop", 0) not "ConsoleUI". "ConsoleUI" belongs to SimpleFrames which can't have Frame children.

Most custom created Frames from the Frame group can not leave the 4:3 (x [0.0 to 0.8] y [0.0 to 0.6]) part of the screen. If a part of them leave it, they become malformed. A TEXT-Frame might cut off some chars. A BACKDROP becomes smaller and with that also Buttons and many others etc.
SimpleFrames are free from that limitation.
One can free Frames from that 4:3 limitation by creating them for a different Parent then GAME_UI, in Reforged (V1.32+) such a Parent could be ("ConsoleUIBackdrop",0). Through that don't comes with a price. Using ("ConsoleUIBackdrop",0) as parent pushes them to a lower Layer, below SimpleFrames.
One also could use BlzGetFrameByName("Leaderboard", 0) or BlzGetFrameByName("Multiboard", 0). Thiey are above SimpleFrames but one has to create them first with the none Frame api.
Your custom Frames can also be a child's child of that other Parents, the 4:3 Limitation is still gone.
 
Last edited:
Level 3
Joined
Nov 2, 2013
Messages
48
You need a different parent and use - values for x.
BlzGetFrameByName("ConsoleUIBackdrop", 0) not "ConsoleUI". "ConsoleUI" belongs to SimpleFrames which can't have Frame children.

Most custom created Frames from the Frame group can not leave the 4:3 (x [0.0 to 0.8] y [0.0 to 0.6]) part of the screen. If a part of them leave it, they become malformed. A TEXT-Frame might cut off some chars. A BACKDROP becomes smaller and with that also Buttons and many others etc.
SimpleFrames are free from that limitation.
One can free Frames from that 4:3 limitation by creating them for a different Parent then GAME_UI, in Reforged (V1.32+) such a Parent could be ("ConsoleUIBackdrop",0). Through that don't comes with a price. Using ("ConsoleUIBackdrop",0) as parent pushes them to a lower Layer, below SimpleFrames.
One also could use BlzGetFrameByName("Leaderboard", 0) or BlzGetFrameByName("Multiboard", 0). Thiey are above SimpleFrames but one has to create them first with the none Frame api.
Your custom Frames can also be a child's child of that other Parents, the 4:3 Limitation is still gone.

This is my code, why it doesnt show up?? what im doing wrong?

JASS:
    set logo = BlzGetFrameByName("ConsoleUIBackdrop", 1)
    set logo2 = BlzCreateFrameByType("SPRITE", "", logo, "", 0)
       call BlzFrameSetAbsPoint(logo2, FRAMEPOINT_CENTER, 0.4, 0.6) 
       call BlzFrameSetModel(logo2, "UI\\Glues\\MainMenu\\WarCraftIIILogo_exp\\WarCraftIIILogo_expbeta.mdl", 0)
       call BlzFrameSetScale(logo2, 0.80)
 
Last edited:
Status
Not open for further replies.
Top