• 🏆 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!

[Script] display item icons

Status
Not open for further replies.
Level 14
Joined
Jan 24, 2017
Messages
243
You are not very specific, but I made a proof of concept.
globals framehandle array Items endglobals library ITEMUI initializer init private function init takes nothing returns nothing set Items[1] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[1], FRAMEPOINT_TOPLEFT, 0.0136700, 0.209900) call BlzFrameSetAbsPoint(Items[1], FRAMEPOINT_BOTTOMRIGHT, 0.0536700, 0.169900) set Items[2] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[2], FRAMEPOINT_TOPLEFT, 0.0535100, 0.209900) call BlzFrameSetAbsPoint(Items[2], FRAMEPOINT_BOTTOMRIGHT, 0.0935100, 0.169900) set Items[3] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[3], FRAMEPOINT_TOPLEFT, 0.0933500, 0.209900) call BlzFrameSetAbsPoint(Items[3], FRAMEPOINT_BOTTOMRIGHT, 0.133350, 0.169900) set Items[4] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[4], FRAMEPOINT_TOPLEFT, 0.133190, 0.209900) call BlzFrameSetAbsPoint(Items[4], FRAMEPOINT_BOTTOMRIGHT, 0.173190, 0.169900) set Items[5] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[5], FRAMEPOINT_TOPLEFT, 0.173030, 0.209900) call BlzFrameSetAbsPoint(Items[5], FRAMEPOINT_BOTTOMRIGHT, 0.213030, 0.169900) set Items[6] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[6], FRAMEPOINT_TOPLEFT, 0.212870, 0.209900) call BlzFrameSetAbsPoint(Items[6], FRAMEPOINT_BOTTOMRIGHT, 0.252870, 0.169900) call BlzFrameSetTexture(Items[1], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[2], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[3], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[4], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[5], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[6], "Textures\\Black32.blp" , 0, true) endfunction endlibrary
And for simplicity I update the frames periodicly:
function Trig_Update_Actions takes nothing returns nothing local integer i = 1 local unit u = <YOUR_UNIT> loop exitwhen i > 6 if BlzGetItemIconPath(UnitItemInSlotBJ(u, i)) == null then call BlzFrameSetTexture(Items[i], "Textures\\Black32.blp" , 0, true) else call BlzFrameSetTexture(Items[i], BlzGetItemIconPath(UnitItemInSlotBJ(u, i)) , 0, true) endif set i = i + 1 endloop endfunction //=========================================================================== function InitTrig_Update takes nothing returns nothing set gg_trg_Update = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Update, 0.01 ) call TriggerAddAction( gg_trg_Update, function Trig_Update_Actions ) endfunction
I put it in a testmap so you can check it out.
 

Attachments

  • display_items.w3m
    14.6 KB · Views: 4
Level 6
Joined
Aug 26, 2016
Messages
87
You are not very specific, but I made a proof of concept.
globals framehandle array Items endglobals library ITEMUI initializer init private function init takes nothing returns nothing set Items[1] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[1], FRAMEPOINT_TOPLEFT, 0.0136700, 0.209900) call BlzFrameSetAbsPoint(Items[1], FRAMEPOINT_BOTTOMRIGHT, 0.0536700, 0.169900) set Items[2] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[2], FRAMEPOINT_TOPLEFT, 0.0535100, 0.209900) call BlzFrameSetAbsPoint(Items[2], FRAMEPOINT_BOTTOMRIGHT, 0.0935100, 0.169900) set Items[3] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[3], FRAMEPOINT_TOPLEFT, 0.0933500, 0.209900) call BlzFrameSetAbsPoint(Items[3], FRAMEPOINT_BOTTOMRIGHT, 0.133350, 0.169900) set Items[4] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[4], FRAMEPOINT_TOPLEFT, 0.133190, 0.209900) call BlzFrameSetAbsPoint(Items[4], FRAMEPOINT_BOTTOMRIGHT, 0.173190, 0.169900) set Items[5] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[5], FRAMEPOINT_TOPLEFT, 0.173030, 0.209900) call BlzFrameSetAbsPoint(Items[5], FRAMEPOINT_BOTTOMRIGHT, 0.213030, 0.169900) set Items[6] = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0) call BlzFrameSetAbsPoint(Items[6], FRAMEPOINT_TOPLEFT, 0.212870, 0.209900) call BlzFrameSetAbsPoint(Items[6], FRAMEPOINT_BOTTOMRIGHT, 0.252870, 0.169900) call BlzFrameSetTexture(Items[1], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[2], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[3], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[4], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[5], "Textures\\Black32.blp" , 0, true) call BlzFrameSetTexture(Items[6], "Textures\\Black32.blp" , 0, true) endfunction endlibrary
And for simplicity I update the frames periodicly:
function Trig_Update_Actions takes nothing returns nothing local integer i = 1 local unit u = <YOUR_UNIT> loop exitwhen i > 6 if BlzGetItemIconPath(UnitItemInSlotBJ(u, i)) == null then call BlzFrameSetTexture(Items[i], "Textures\\Black32.blp" , 0, true) else call BlzFrameSetTexture(Items[i], BlzGetItemIconPath(UnitItemInSlotBJ(u, i)) , 0, true) endif set i = i + 1 endloop endfunction //=========================================================================== function InitTrig_Update takes nothing returns nothing set gg_trg_Update = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Update, 0.01 ) call TriggerAddAction( gg_trg_Update, function Trig_Update_Actions ) endfunction
I put it in a testmap so you can check it out.
Thank you) and how to make tooltip for these items?
And sorry my knowledge of English is not very good.
 
Level 14
Joined
Jan 24, 2017
Messages
243
Thank you) and how to make tooltip for these items?
And sorry my knowledge of English is not very good.
 
Status
Not open for further replies.
Top