• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

JASS Description Frame?

Status
Not open for further replies.
Level 7
Joined
Sep 11, 2013
Messages
220
Guys I am having trouble learning these new updates in war3 1.31 TFT non-reforged. Can you please provide me a simple trigger on how to make a description box frame with words in it? Kinda like how the tooltip works but I need to move it to an area I also need to have a way to hide/unhide it (Although I might have an idea on how to hide/unhide it with this call BlzFrameSetVisible. I tried downloading spells and stuff but I find the codes very complicated xD

I tried creating a frame but can't seem to get it to work
call BlzCreateFrame(test_string, test_player, test_integer)

Any help is appreciated! :)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,563
Here's a map with all sorts of UI frames.

You'll need to Export the Imported Files from the Asset Manager and Import them into your own map for this to work. DON'T Export All Files at once, do it 1 by 1, otherwise it could bug out.

Some Notes:
Disabling a Frame (BlzFrameSetEnable(Frame, false)) means that it ignores mouse events, so it can't be clicked/highlighted.

AbsPoint is where the Frame will be anchored. 0.4, 0.3 is the center of the screen.

You can edit the FDF files in Notepad, these contain information regarding the Frames you're using. If you wanted to increase Font Size for example, you could edit these files to do so.

You're correct about BlzFrameSetVisible. Setting this to False will hide the frame.

If you want to learn how to create triggers in Jass so that you can interact with these Frames follow this tutorial (Lesson 5: Triggers in JASS): Beginning JASS Tutorial Series

I provided the Events for Frames in the map but here they are again:
vJASS:
BlzTriggerRegisterFrameEvent(YourTrigger, YourFrame, FRAMEEVENT_CONTROL_CLICK)
BlzTriggerRegisterFrameEvent(YourTrigger, YourFrame, FRAMEEVENT_MOUSE_ENTER)
BlzTriggerRegisterFrameEvent(YourTrigger, YourFrame, FRAMEEVENT_MOUSE_LEAVE)

Since Hiding/Unhiding a Frame will do it for ALL players, you will also have to take advantage of GetLocalPlayer() in order to Show/Hide Frames for specific players only.

Edit: If you can't open the map, here's the code:
vJASS:
globals
    framehandle WindowFrame
    framehandle DialogButtonFrame
    framehandle TextureFrame
    framehandle TextFrame
    framehandle TooltipFrame
    framehandle TooltipTextFrame
endglobals

function CreateUIFrames takes nothing returns nothing
    //This loads the imported UI files
    call BlzLoadTOCFile("war3mapImported\\Templates.toc")
    call BlzLoadTOCFile("war3mapimported\\BoxedText.toc")

    //This frame is used to encompass other frames, purely visual
    set WindowFrame = BlzCreateFrame("EscMenuTextAreaTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
    call BlzFrameSetSize(WindowFrame, 0.61, 0.16)
    call BlzFrameSetAbsPoint(WindowFrame, FRAMEPOINT_CENTER, 0.4, 0.3)
    call BlzFrameSetEnable(WindowFrame, false)

    //This is like the Dialog buttons that you would see in a Dialog Menu
    set DialogButtonFrame = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0, 0)
    call BlzFrameSetSize(DialogButtonFrame, 0.08, 0.04)
    call BlzFrameSetAbsPoint(DialogButtonFrame, FRAMEPOINT_CENTER, 0.4, 0.3)
    call BlzFrameSetText(DialogButtonFrame, "Click Me")

    //This can be any texture you want, it doesn't have to be an icon
    set TextureFrame = BlzCreateFrameByType("BACKDROP", "icon", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
    call BlzFrameSetSize(TextureFrame, 0.04, 0.04)
    call BlzFrameSetAbsPoint(TextureFrame, FRAMEPOINT_CENTER, 0.2, 0.3)
    call BlzFrameSetTexture(TextureFrame, "ReplaceableTextures\\CommandButtons\\BTNHeroArchMage.blp", 0, true)
    call BlzFrameSetEnable(TextureFrame, false)

    //This is Text that you can put anywhere
    set TextFrame = BlzCreateFrame("TestText", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
    call BlzFrameSetAbsPoint(TextFrame, FRAMEPOINT_CENTER, 0.4, 0.4)
    call BlzFrameSetText(TextFrame, "Hello World")
    call BlzFrameSetEnable(TextFrame, false)

    //This is a Tooltip Box + Tooltip Text. They're linked to one another and share attributes. This works like the Tooltip for Items/Abilities/Units.
    set TooltipFrame = BlzCreateFrame("BoxedText", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0, 0)
    call BlzFrameSetAbsPoint(TooltipFrame, FRAMEPOINT_CENTER, 0.6, 0.3)
    call BlzFrameSetSize(TooltipFrame, 0.14, 0.10)
    //This frame contains the actual text
    set TooltipTextFrame = BlzGetFrameByName("BoxedTextValue",0)
    call BlzFrameSetAbsPoint(TooltipTextFrame, FRAMEPOINT_CENTER, 0.6, 0.3)
    call BlzFrameSetText(TooltipTextFrame, "This works like a standard Tooltip that you would see on an ability. It will automatically format itself to fit inside the tooltip.")

    //These are the Events for clicking and mousing over a Frame. These don't work for every type of frame, but I can say for sure that they work for Buttons.
    //You would have to create the triggers for them in Jass.
    //BlzTriggerRegisterFrameEvent(SomeTrigger, YourFrame, FRAMEEVENT_CONTROL_CLICK)
    //BlzTriggerRegisterFrameEvent(SomeTrigger, YourFrame, FRAMEEVENT_MOUSE_ENTER)
    //BlzTriggerRegisterFrameEvent(SomeTrigger, YourFrame, FRAMEEVENT_MOUSE_LEAVE)
endfunction
The frame you want is the TooltipFrame + TooltipTextFrame.
 

Attachments

  • UI Example.w3m
    18.6 KB · Views: 60
Last edited:
Level 7
Joined
Sep 11, 2013
Messages
220
Thanks man! I appreciate it :D also is JASS code similar to making games in unity, unreal engine etc?

[EDIT] I couldn't open it, it says "Level info data missing or invalid"

[EDIT] Oh never mind I see now what you mean.

Also what does this mean?

function CreateUIFrames takes nothing returns nothing
//This loads the imported UI files
call BlzLoadTOCFile("war3mapImported\\Templates.toc")
call BlzLoadTOCFile("war3mapimported\\BoxedText.toc")

What are those files I need to import?

Also do these cause leaks? How do I completely remove a frame?

I was able to make a frame with an icon that I choose but I can't seem to update date it on another trigger. It wont detect, it tells me undeclared variable if I try to hide it using
call BlzFrameSetVisible(TextureFrame, false) on a different trigger.

[EDIT] Oh i think i found a way to destroy it using BlzDestroyFrame.

[EDIT] Oh wait I think I see now, I used local instead of global that's probably why it didn't detect.

[EDIT]

This doesn't work.
globals
framehandle TEST
framehandle TESTA
endglobals

set TEST = BlzCreateFrame("BoxedText", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI,0), 0, 0)
call BlzFrameSetAbsPoint(TEST, FRAMEPOINT_CENTER, 0.550, 0.17)
call BlzFrameSetSize(TEST, 0.14, 0.10)
set TESTA = BlzGetFrameByName("BoxedTextValue",0)
call BlzFrameSetAbsPoint(TESTA, FRAMEPOINT_CENTER, 0.550, 0.17)
call BlzFrameSetText(TESTA, "TESTING TESTING TESTING.")
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,563
I'm unable to upload the required UI files here. Can you PM me your email?

And yes, it's similar to using Unity. vJass/Lua are programming languages just like C# (which is what Unity uses). There will be a lot of similarities between these languages because at the end of the day they're all using Integers, Booleans, Reals, Strings, Arrays/Tables, For Loops, etc...

The thing about programming in Warcraft 3 is that regardless of whether you use vJass or Lua, they both use the same API: JASS Manual: API Browser - API Browser: Types (I don't know how up to date this is)

Here's two simple functions that create a Footman for Player 1 at the center of the map (x:0, y:0) facing 270 degrees. One made in vJass and the other made in Lua.

vJass Example:
vJASS:
function CreateAUnitExample takes nothing returns nothing
    call CreateUnit(Player(0), "hfoo", 0, 0, 270)
endif
Lua Example:
Lua:
function CreateAUnitExample()
    CreateUnit(Player(0), FourCC("hfoo"), 0, 0, 270)
end

They both use the same API:
Code:
CreateUnit(playerid, unitid, x, y, face)
But have subtle differences in their syntax.

If you're interested in learning vJass, then I would recommend learning Lua instead. It's a lot easier to use in my opinion once you learn it's few quirks.

Take a look at my first two posts in this thread: Getting started with Lua scripting in Wc3 maps
 
Last edited:
Level 7
Joined
Sep 11, 2013
Messages
220
I
I'm unable to upload the required UI files here. Can you PM me your email?

And yes, it's similar to using Unity. vJass/Lua are programming languages just like C# (which is what Unity uses). There will be a lot of similarities between these languages because at the end of the day they're all using Integers, Booleans, Reals, Strings, Arrays/Tables, For Loops, etc...

The thing about programming in Warcraft 3 is that regardless of whether you use vJass or Lua, they both use the same API: JASS Manual: API Browser - API Browser: Types (I don't know how up to date this is)

Here's two simple functions that create a Footman for Player 1 at the center of the map (x:0, y:0) facing 270 degrees. One made in vJass and the other made in Lua.

vJass Example:
vJASS:
function CreateAUnit takes nothing returns nothing
    call CreateUnit(Player(0), "hfoo", 0, 0, 270)
endif
Lua Example:
Lua:
function CreateAUnit()
    CreateUnit(Player(0), FourCC("hfoo"), 0, 0, 270)
end

They both use the same API:
Code:
CreateUnit(playerid, unitid, x, y, face)
But have subtle differences in their syntax.

If you're interested in learning vJass, then I would recommend learning Lua instead. It's a lot easier to use in my opinion once you learn it's few quirks.

Take a look at my first two posts in this thread: Getting started with Lua scripting in Wc3 maps
I think I downloaded have those 2 already. I tried importing them and now by importing them as war3mapImported\BoxedText.toc and war3mapImported\Templates.toc
then I added this:

call BlzLoadTOCFile("war3mapImported\\Templates.toc")
call BlzLoadTOCFile("war3mapimported\\BoxedText.toc")

It still doesn't work.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,563
Did you get them from my map? Also, make sure to Load those TOC files BEFORE you try to create any frames. Your trigger should be formatted exactly like mine.

You should have 3 imported files in total. Templates.toc, BoxedText.toc, and BoxedText.fdf.
 
Level 7
Joined
Sep 11, 2013
Messages
220
Did you get them from my map? Also, make sure to Load those TOC files BEFORE you try to create any frames. Your trigger should be formatted exactly like mine.

You should have 3 imported files in total. Templates.toc, BoxedText.toc, and BoxedText.fdf.
OH NICE IT'S WORKING NOW THANKS! :D I thought I didn't need the fdf. Turns out that's it! Thank dude! +rep and credits in my map :)

[EDIT] Oh yeah I couldn't open your map, it gives me an error. But I think I got things to work now
 
Level 7
Joined
Sep 11, 2013
Messages
220
Did you get them from my map? Also, make sure to Load those TOC files BEFORE you try to create any frames. Your trigger should be formatted exactly like mine.

You should have 3 imported files in total. Templates.toc, BoxedText.toc, and BoxedText.fdf.
Bro may I ask. How do I make this with an integer?

From this "framehandle backpackicon" to this "framehandle backpackicon[1]"

So I can do things faster. I also tried converting the framehandle to string so I could do a concentrate string like this backpackicon + INTEGER but it doesn't work, error.

As of the moment I've made a massive amount of them but I can't detect them through integers.

framehandle backpackicon0
framehandle backpackicon1
framehandle backpackicon2
framehandle backpackicon3
framehandle backpackicon4
framehandle backpackicon5
etc.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,563
A framehandle is like any other type of variable, you can create an Array for it like you would with an Integer.

Simply add "array" to the variable name:

framehandle array backpackicon

set backpackicon[1] = BlzCreateFrame(etc...)
 
Last edited:
Level 7
Joined
Sep 11, 2013
Messages
220
Hey I have a question, why does this not work?

set TextFrame = BlzCreateFrame("TestText", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
call BlzFrameSetAbsPoint(TextFrame, FRAMEPOINT_CENTER, 0.4, 0.4)
call BlzFrameSetText(TextFrame, "Hello World")
call BlzFrameSetEnable(TextFrame, false)

I've done this, the only thing I changed is the TextFrame handle into equipmenttext2 and I also added the visibility enable line.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,563
It's missing toc/fdf files.

BoxedText.fdf
Code:
// -- LOCAL TEMPLATES -------------------------------------------------------
Frame "BACKDROP" "BoxedTextBackgroundTemplate" {
        DecorateFileNames, //Look-Up Names in some String table (for example gameinterface)
        BackdropTileBackground, //Tile mode enabled
        BackdropBackground  "ToolTipBackground", //BackgroundFile
        BackdropCornerFlags "UL|UR|BL|BR|T|L|B|R",
        BackdropCornerSize  0.008, //higher numbers make the corners bigger.
        BackdropBackgroundInsets 0.0022 0.0022 0.0022 0.0022, //makes the background smaller, from the outside.
        BackdropEdgeFile  "ToolTipBorder", //the border File
        BackdropBlendAll,
}
// -- Frames -------------------------------------------------------
Frame "BACKDROP" "BoxedText1" INHERITS "BoxedTextBackgroundTemplate" {
    UseActiveContext,
   
    Frame "TEXT" "BoxedTextValue" {
        UseActiveContext,
        DecorateFileNames,
        SetPoint TOPLEFT, "BoxedText1", TOPLEFT, 0.005, -0.005,
        SetPoint BOTTOMRIGHT,  "BoxedText", BOTTOMRIGHT, -0.005, 0.005,
        FontFlags "FIXEDSIZE",
        FrameFont "MasterFont", 0.008, "",
        FontColor 1.0 1.0 1.0 1.0,
        FontShadowColor 0.0 0.0 0.0 0.9,
        FontShadowOffset 0.001 -0.001,
    }
}

Frame "BACKDROP" "BoxedText2" INHERITS "BoxedTextBackgroundTemplate" {
    UseActiveContext,
   
    Frame "TEXT" "BoxedTextValue2" {
        UseActiveContext,
        DecorateFileNames,
        SetPoint TOPLEFT, "BoxedText2", TOPLEFT, 0.005, -0.005,
        SetPoint BOTTOMRIGHT,  "BoxedText2", BOTTOMRIGHT, -0.005, 0.005,
        FontFlags "FIXEDSIZE",
        FrameFont "MasterFont", 0.009, "",
        FontColor 1.0 1.0 1.0 1.0,
        FontShadowColor 0.0 0.0 0.0 0.9,
        FontShadowOffset 0.001 -0.001,
    }
}

Frame "BACKDROP" "BoxedText3" INHERITS "BoxedTextBackgroundTemplate" {
    UseActiveContext,
   
    Frame "TEXT" "BoxedTextValue3" {
        UseActiveContext,
        DecorateFileNames,
        SetPoint TOPLEFT, "BoxedText3", TOPLEFT, 0.005, -0.005,
        SetPoint BOTTOMRIGHT,  "BoxedText3", BOTTOMRIGHT, -0.005, 0.005,
        FontFlags "FIXEDSIZE",
        FrameFont "MasterFont", 0.010, "",
        FontColor 1.0 1.0 1.0 1.0,
        FontShadowColor 0.0 0.0 0.0 0.9,
        FontShadowOffset 0.001 -0.001,
    }
}

MySimpleButton.fdf
Code:
Texture "MySimpleButtonButtonHighlight" {
    File "UI\Glues\ScoreScreen\scorescreen-tab-hilight",
    //File "textures\red_glow1",
    //File "textures\yellow_glow",
    //File "textures\blue_glow2",
    AlphaMode "ADD",
}

Frame "SIMPLEBUTTON" "MySimpleButtonGlowing" {
    Width 0.039,
    Height 0.0195,
    UseHighlight "MySimpleButtonButtonHighlight",
    Texture "MySimpleButtonTexture" {
    }
}

Frame "SIMPLEBUTTON" "MySimpleButton" {
    Width 0.039,
    Height 0.039,
    Texture "MySimpleButtonTexture" {
    }
}

Frame "SIMPLEFRAME" "TestString" {
    Width 0.0001,
    Height 0.0001,
    DecorateFileNames,
    String "TestStringValue" {
        Anchor CENTER, 0, 0,
        Font "InfoPanelTextFont",0.01,
    }
}

Frame "SIMPLEFRAME" "TestString2" {
    Width 0.0001,
    Height 0.0001,
    String "TestString2Value" {
        Anchor TOPLEFT, 0, 0,
        Font "InfoPanelTextFont",0.01,
    }
}

Frame "SIMPLEFRAME" "TestString3" {
    Width 0.0001,
    Height 0.0001,
    String "TestString3Value" {
        Anchor TOPRIGHT, 0, 0,
        Font "InfoPanelTextFont",0.01,
    }
}

Frame "TEXT" "TestText" {
    FrameFont "MasterFont", 0.010, "",
    FontColor 1.0 1.0 1.0 1.0,
    FontShadowColor 0.0 0.0 0.0 0.9,
    FontShadowOffset 0.001 -0.001,
}


Frame "SIMPLEFRAME" "TestStringEx" {
    DecorateFileNames,
    String "TestStringValue" {
        //FontJustificationH JUSTIFYLEFT,
        //FontJustificationV JUSTIFYTOP,
        //FontColor 0.99 0.827 0.0705 1.0,
        //FontShadowColor 0.0 0.0 0.0 0.9,
        //FontShadowOffset 0.001 -0.001,
        Font "InfoPanelTextFont",0.01,
        //Width 0.15,
        //Height 0.15,
    }
}


Frame "SIMPLEFRAME" "TestTextureFraction"{
    Width 0.04,
    Height 0.04,
    Texture "TestTextureFractionValue" {
        TexCoord 0.0, 0.5, 0.0, 0.5,
    }
}

Frame "SIMPLEFRAME" "TestTexture2"{
    Width 0.01,
    Height 0.01,
    Texture "TestTextureValue2" {
    }
}

Frame "SIMPLEFRAME" "TestTexture"{
    Width 0.26,
    Height 0.18,
    Texture "TestTextureValue" {
    }
}


Frame "SIMPLEFRAME" "TestTextureAlphaAdd"{
    Width 0.06,
    Height 0.06,
    Texture "TestTextureValue" {
        AlphaMode "ADD",
        File "UI\Console\Human\HumanUITile01",
    }
}

Frame "SIMPLEFRAME" "TestTextureAlphaBlend"{
    Width 0.06,
    Height 0.06,
    Texture "TestTextureValue" {
        AlphaMode "BLEND",
        File "UI\Console\Human\HumanUITile01",
    }
}


Frame "SIMPLEFRAME" "TestTextureAlphaAlphaKey"{
    Width 0.06,
    Height 0.06,
    Texture "TestTextureValue" {
        AlphaMode "ALPHAKEY",
        File "UI\Console\Human\HumanUITile01",
    }
}

Frame "SIMPLEFRAME" "TestTextureAlphaDisable"{
    Width 0.06,
    Height 0.06,
    Texture "TestTextureValue" {
        AlphaMode "DISABLE",
        File "UI\Console\Human\HumanUITile01",
    }
}


Frame "SIMPLEFRAME" "TestTextureAlphaMod"{
    Width 0.06,
    Height 0.06,
    Texture "TestTextureValue" {
        AlphaMode "MOD",
        File "UI\Console\Human\HumanUITile01",
    }
}

Frame "SIMPLEFRAME" "TestTextureLayer" {
    Width 0.1,
    Height 0.1,
    //UseActiveContext,
    Layer "ARTWORK" {
        Texture {
            Width 0.05,
            Height 0.05,
            Anchor BOTTOMLEFT, 0, 0,
            File "ReplaceableTextures\CommandButtons\BTNHeroMountainKing",
        }
        Texture {
            Width 0.05,
            Height 0.05,
            Anchor BOTTOMRIGHT, 0, 0,
            File "ReplaceableTextures\CommandButtons\BTNHeroBloodElfPrince",
        }
        Texture {
            Width 0.05,
            Height 0.05,
            Anchor TOPRIGHT, 0, 0,
            File "ReplaceableTextures\CommandButtons\BTNArthas",
        }
        Texture {
            File "ReplaceableTextures\CommandButtons\BTNHeroArchMage",
            Width 0.05,
            Height 0.05,
            Anchor TOPLEFT, 0, 0, 
        }
    }   
   
    Layer "BACKGROUND" {
        Texture {
            Width 0.2,
            Height 0.2,
            Anchor CENTER, 0, 0,
            File "ReplaceableTextures\CommandButtons\BTNHeroPaladin",
        } 
    }
    Frame "SIMPLEFRAME" "TestTextureLayerChild" {
        SetAllPoints,
        UseHighlight "MySimpleButtonButtonHighlight",
        Layer "BACKGROUND" {
            Texture {
                Width 0.04,
                Height 0.03,
                Anchor CENTER, 0, 0,
                File "ReplaceableTextures\CommandButtons\BTNHeroDeathKnight",
            } 
        }
    }
}

Frame "SIMPLESTATUSBAR" "TestBar" {

   
}
 
Status
Not open for further replies.
Top