Frames and Buttons after New patch

Level 4
Joined
Nov 2, 2013
Messages
62
Hello guys, im want to revive some of my maps where i started years ago working on frames and buttons.

But now with the new patch, half of things arent working or buggy.
Originaly i was trying to use the gluebuttons and click events/enter mouse events with invisible buttons and backdrops with texture for simulate an icon, and everything was working fine. But now are glitchs like, clicking the button the mouse instant position in weird zones of the screen for 1 sec, or infinity loop clicking with enter Mouse event.

1) So reading a few posts, seems that simplybuttons are not affected by those glitchs. But im struggling finding a way to change the texture using a variable and make it dinamic, and not static. i guess i need to use child parent but i dont know how or if im missing something. I was trying using backdrop behind the button and is working fine, but that way the glowing inherit struggles with position or something and it doesnt work. its not seeable.
@Tasyen

2) how can i detect which button was clicked? does this codes afect sync in multiplayer? should i use it only in 1 player games?

3) Change Smooth Camera Factor doesnt work neither?

This is an example, please help me with GUI or JASS:

JASS:
globals


framehandle Button01 = null
 
framehandle Button01Dialog = null
 
framehandle BackdropButton01 = null

trigger TriggerButton01 = null

trigger TriggerButton02 = null



endglobals


 
library REFORGEDUIMAKER initializer init

private function Button01Func takes nothing returns nothing
call BlzLoadTOCFile("war3mapImported\\MySimpleButton.toc")
call BlzLoadTOCFile("war3mapImported\\MyStatusBar.toc")
call BlzFrameSetEnable(Button01, false)
call BlzFrameSetEnable(Button01, true)
call BJDebugMsg("Click")
call PlaySoundBJ( gg_snd_MouseClick1 )

endfunction

private function Button02Func takes nothing returns nothing

call StopSoundBJ( gg_snd_MouseClick1, false )
call PlaySoundBJ( gg_snd_MouseClick1 )

endfunction

function init takes nothing returns nothing

 call BlzLoadTOCFile("war3mapImported\\MySimpleButton.toc")
 call BlzLoadTOCFile("war3mapImported\\MyStatusBar.toc")

set Button01 = BlzCreateSimpleFrame("MySimpleButtonGlowing", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0)
set BackdropButton01 = BlzCreateFrameByType("BACKDROP", "BackdropButton01", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetAllPoints(BackdropButton01, Button01)
//set BackdropButton01 = BlzFrameGetChild(Button01, 0)
//call BlzFrameSetTexture(BlzGetFrameByName("MySimpleButtonTexture", 0), "ReplaceableTextures\\CommandButtons\\BTNHeroPaladin", 0, true)
call BlzFrameSetTexture(BackdropButton01, "ReplaceableTextures\\CommandButtons\\BTNSelectHeroOn", 0, true)

call BlzFrameSetAbsPoint(BackdropButton01, FRAMEPOINT_CENTER, 0.4, 0.3)
call BlzFrameSetAbsPoint(Button01, FRAMEPOINT_CENTER, 0.4, 0.3)

call BlzFrameSetSize(BackdropButton01, 0.025, 0.025)
call BlzFrameSetSize(Button01, 0.025, 0.025)

set TriggerButton01 = CreateTrigger()
call BlzTriggerRegisterFrameEvent(TriggerButton01, Button01, FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(TriggerButton01, function Button01Func)
set TriggerButton02 = CreateTrigger()
call BlzTriggerRegisterFrameEvent(TriggerButton02, Button01, FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(TriggerButton02, function Button02Func)


endfunction

endlibrary
 
Last edited:
As shown in this tutorial UI - Simpleframes
you make in a fdf a simplebutton with a loose texture and highlight texture.
Code:
Texture "MySimpleButtonButtonHighlight" {
    File "UI\Glues\ScoreScreen\scorescreen-tab-hilight.blp",
    AlphaMode "ADD",
}
Frame "SIMPLEBUTTON" "MySimpleButtonGlowing" {
    Width 0.039,
    Height 0.039,
    UseHighlight "MySimpleButtonButtonHighlight",
    Texture "MySimpleButtonTexture" {
    }
}
After you created the simplebutton use BlzGetFrameByName("MySimpleButtonTexture", 0) to get the texture. The textures image you can change with BlzFrameSetTexture. The texture mimics the buttons position & size only change the buttons pos & size.

BlzFrameSetTexture(BlzGetFrameByName("MySimpleButtonTexture", 0), "ReplaceableTextures\\CommandButtons\\BTNHeroPaladin", 0, true)

inside FrameEvent callbacks you have the getters to know some stuff about the event. The events are mp synced and safe to use.

Code:
BlzGetTriggerFrame()
BlzGetTriggerFrameEvent()
GetTriggerPlayer()
BlzGetTriggerFrameText()
BlzGetTriggerFrameValue()
 
Level 4
Joined
Nov 2, 2013
Messages
62
Ty @Tasyen i really thank your help.
What im not understanding is how can i use two or more simplebuttons with different textures? and change his textures ingame?

BlzFrameSetTexture(BlzGetFrameByName("MySimpleButtonTexture", 0), "ReplaceableTextures\\CommandButtons\\BTNHeroPaladin", 0, true)

Cause that only call the symplebutton general texture. but if got multiple simplebuttons, how can i change the texture of one simplebutton specifically?
 
You either store the texture-Frame into a framehandle variable.
Or you use unique createcontexts, the last number in the CreateFrame natives. Then you also use a different number than 0 inside BlzGetFrameByName.

When you reuse the same number the old frame can not be accessed over BlzGetFrameByName anymore.
 
Level 4
Joined
Nov 2, 2013
Messages
62
You either store the texture-Frame into a framehandle variable.
Or you use unique createcontexts, the last number in the CreateFrame natives. Then you also use a different number than 0 inside BlzGetFrameByName.

When you reuse the same number the old frame can not be accessed over BlzGetFrameByName anymore.
Uff dont hate me, but i dont know how to store the texture-frame of a simplebutton into a variable in jass. could you write me an example? or a map test?

my idea is to setup an easy way for use icon like buttons. I guess the first method (store into a variable) is easy than store in different numbers into natives.
 
fine, thats how you store the frame gained by BlzGetFrameByName into a variable. Right after the create frame line you get the child frame.
JASS:
globals
  framehandle Button01
  framehandle BackdropButton01
endglobals


set Button01 = BlzCreateSimpleFrame("MySimpleButtonGlowing", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0)
set BackdropButton01 = BlzGetFrameByName("MySimpleButtonTexture", 0)

The number is easier, just would need to use something others than 0 in the last arg and the number needs to match in the create line and in the BlzGetFrameByName line. Whatever your choice.
 
Level 4
Joined
Nov 2, 2013
Messages
62
E
fine, thats how you store the frame gained by BlzGetFrameByName into a variable. Right after the create frame line you get the child frame.
JASS:
globals
  framehandle Button01
  framehandle BackdropButton01
endglobals


set Button01 = BlzCreateSimpleFrame("MySimpleButtonGlowing", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0)
set BackdropButton01 = BlzGetFrameByName("MySimpleButtonTexture", 0)

The number is easier, just would need to use something others than 0 in the last arg and the number needs to match in the create line and in the BlzGetFrameByName line. Whatever your choice.
xcellent. thanks again Tasyen, i would try and see how it goes.


set Button01 = BlzCreateSimpleFrame("MySimpleButtonGlowing", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0)
set BackdropButton01 = BlzGetFrameByName("MySimpleButtonTexture", 0)
call BackdropButton01 = BlzFrameSetTexture(BlzGetFrameByName("MySimpleButtonTexture", 0), "ReplaceableTextures\\CommandButtons\\BTNHeroPaladin", 0, true)


Thats with variable, so i can change texture with that when i want?
 
Level 4
Joined
Nov 2, 2013
Messages
62
after you have set the variable with the framehandle, you use the variable in other calls.

call BlzFrameSetTexture(BackdropButton01, "ReplaceableTextures\\CommandButtons\\BTNHeroPaladin", 0, true)
Well everything works fine. Except the delay that the simplebutton got. when you click it its not instant liek scryptbuttons. it had little ms of delay and thats annoying. There is no way to use scryptdialog or gluebuttons without the glitchy of infinit loop clicks or mouse weird position?

here is my test map.
and i saw a talent map who uses another buttons and he hasnt that glitch. can you check it? the code is way more larger and im not able to find how he evade the glitch.
The Frame Test is my button map test.
the other one is the way i want to copy the button behaviour without glitch and more faster response to clicks.
Ty !
 

Attachments

  • Frame Test.w3m
    26.1 KB · Views: 7
  • STKDruidWowTalent.w3m
    813.5 KB · Views: 5
Level 4
Joined
Nov 2, 2013
Messages
62
Dont use mouse enter/leave events for gluebuttons then the endless loop should stop.
I doubt that simplebutton and gluebutton have different callback speeds, both are synced to game turns and network sync.
But i need the enter eventsfor the map. there is no way to fix that or evade the glitch?
i realized that scryptbuttons got more react speed that simple and gluebuttons
 
Level 4
Joined
Nov 2, 2013
Messages
62
simplebuttons can do enter/leave & control click in warcraft 3 V 2.0+. Make simplebuttons
Or wait for a fix.

Or check visbility of the mouse hover highlight/tooltip, this is not mpsafe.
how can i do that? i mean code in jass
 
Level 4
Joined
Nov 2, 2013
Messages
62

@Tasyen how did you made it work fine there without buggingg
 
Level 4
Joined
Nov 2, 2013
Messages
62
TasButtonList does not use FrameEvent Mouse Enter/leave. It uses the SetFrameTooltip Feature. That feature shows some other frame while a frame which can have control is hovered.

@Tasyen

Screenshot_1.jpg


How can i put the background on the simplebar fill texture? im struggling trying to put the border on the fill bar so the black border of the fill dont cover the border background. how can i stablish priority visibility of the textures or frames?

JASS:
set BackHorizBarWithBG01 = BlzCreateFrameByType("BACKDROP", "BackHorizBarWithBG01", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), "", 0)
call BlzFrameSetAbsPoint(BackHorizBarWithBG01, FRAMEPOINT_TOPLEFT, 0.350000, 0.160590)
call BlzFrameSetAbsPoint(BackHorizBarWithBG01, FRAMEPOINT_BOTTOMRIGHT, 0.461670, 0.149440)
call BlzFrameSetTexture(BackHorizBarWithBG01, "ui\\feedback\\buildprogressbar\\human-buildprogressbar-border.dds", 0, true)

set HorizBarWithBG01 = BlzCreateFrameByType("SIMPLESTATUSBAR", "HorizBarWithBG01", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 1), "", 0)
call BlzFrameSetTexture(HorizBarWithBG01, "ui\\feedback\\buildprogressbar\\human-buildprogressbar-fill.dds", 1, true)
call BlzFrameSetAbsPoint(HorizBarWithBG01, FRAMEPOINT_TOPLEFT, 0.350000, 0.160590)
call BlzFrameSetAbsPoint(HorizBarWithBG01, FRAMEPOINT_BOTTOMRIGHT, 0.461670, 0.149440)
call BlzFrameSetValue(HorizBarWithBG01, 25)
 
Random thought from the distance, just as a passerby, are you able to fix your background issue by reversing the order you spawn the frames and spawning the background secondly, such that it renders "most recently" and ends up always on top?

If that doesn't work, is it possible to change your parent from from BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0) on the backdrop to instead be the HorizBarWithBG01 itself, or does that kill the render for the backdrop entirely due to some quirk with childing and SIMPLESTATUSBAR?

Full disclosure, I have mostly been using my rewrite of Warcraft III in my own codebase, where the FDF UI functions are similar but not identical (because of how much I don't know and didn't study the original to the extent of someone like Tasyen). So if what I'm saying is madness, just ignore it. If I was trying to do what you are doing, I would probably add HorizBarWithBG01 and HorizBarWithBG01Border to the war3skins.txt definition, enable decorated strings, and then expect the texture to load for these things automatically instead of defining it with a second function call to SetTexture. But that way of thinking requires full system control, instead of a few access points for poking the system from the Reforged API. Maybe you can accomplish what I'm saying using your map specific war3mapSkins.txt file, but maybe you will not bother if you would rather to use JASS.
 
can i suggest to use statusbar, modelbar then you only have frames.
example from The Big UI-Frame Tutorial
Lua:
local bar = BlzCreateFrameByType("STATUSBAR", "", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)        
BlzFrameSetAbsPoint(bar, FRAMEPOINT_TOPLEFT, 0.4, 0.3)
-- Screen Size does not matter but has to be there
BlzFrameSetSize(bar, 0.00001, 0.00001)

-- Models don't care about Frame Size, But world Object Models are huge . To use them in the UI one has to scale them down alot.
BlzFrameSetScale(bar, 1)

--BlzFrameSetModel(bar, "ui/feedback/cooldown/ui-cooldown-indicator.mdx", 0)
--BlzFrameSetModel(bar, "ui/feedback/XpBar/XpBarConsole.mdx", 0)        
BlzFrameSetModel(bar, "ui/feedback/progressbar/timerbar.mdx", 0)
--BlzFrameSetModel(bar, "ui/feedback/buildprogressbar/buildprogressbar.mdx", 0)
--BlzFrameSetMinMaxValue(bar, 0, 100)
local i = 0
TimerStart(CreateTimer(), 0.1, true, function()
    BlzFrameSetValue(bar, i)
    i = i + 1
    --i = GetRandomInt(0, 100)
    print(BlzFrameGetValue(bar))
end)

print("done")

or to only use simpleframes which you could do by creating 2 SIMPLESTATUSBAR one is 100% and the border. while the other is the filling texture they can have a clear order by parent/child.



if you dont like any of my suggestings above, well here my view on warcraft 3 render/layer order. Which you need, when you want to mix simpleframes & frames in map script. fdf allows some other mixing but your example only was map script and i did not test that as much.
You try to mix simpleframes and frames. Difficult because simpleframes are managed by frames called simpletops and simpleframes are pushed into the layer created by simpletops. Except for string/texture which have fixed layers inside simpleframes,
Unlike frames, each of them starts new layers in which their children reside which again start new sub-layers.

the rendering starts with gameUI then it renders all its children. children with lower indexes are rendered directly above while the child with the higest index is furthest above the parent. but lower than the brother of the parent.
Frame%20LeveL2.jpg


that would be simpleframes, at the time i made this image i didn't know the name simpletop yet, therefore i called it simple-ancient. simpletop is a frame and follows the normal frame render order. But it also renders many simpleframes managed by this simpletop.
SimpleFrame%20Level%20Order.jpg


ORIGIN_FRAME_GAME_UI
on default GameUI has this children with this order: ignore the order after [6] it is random because loose children with level/prio 0 all are added to the end of the loose children list, but the highest is mouse (when you did not use set level)
[0] ORIGIN_FRAME_WORLD_FRAME
[1] Probably Parent of World Object Hover info box & HP/Mana Bars
[2] BottomUI Black Background "ConsoleUIBackdrop"
[3] Parent of ORIGIN_FRAME_PORTRAIT
[4] InventoryText / simpletop
[5] Day Time Clock & Minimap ancestor/Parent
[6] "CinematicPanel"
[7] "ChatDialog"/"LogDialog"
[8] "Multiboard"
[9] "Leaderboard"
[10] "TimerDialog"
[11] No Idea
[12] "QuestDialog"
[13] "AllianceDialog"
[14] No Idea
[15] Parent Of "EscMenuBackdrop"
[16] Chat Input
[17] EscOptions
[18] Mouse Cursor (Parent)

to have your frame above/below simpleframes you need to choose a parent/ancestor that is above/below the simpletop which is the child at index [4] of gameUI.
 
Top