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

How to attach a frame to another

Status
Not open for further replies.
Level 9
Joined
Dec 21, 2006
Messages
490
hi everyone

i want to set a frame next to another without using offsets ( because offsets do not work properly on different resolutions).
so does anyone know how to modify "relative" ?
"$parent/framename" doesnt work nor does "$this/framename" <Anchor side="Left" relative="$parent" pos="Min" offset="0"/> <Anchor side="Bottom" relative="$parent" pos="Max" offset="0"/>

i want to set it next to the command panel (abilities), where the
unit poträt normally is.
thx in advance
 
Level 3
Joined
May 18, 2010
Messages
29
hi everyone

i want to set a frame next to another without using offsets ( because offsets do not work properly on different resolutions).
so does anyone know how to modify "relative" ?
"$parent/framename" doesnt work nor does "$this/framename" <Anchor side="Left" relative="$parent" pos="Min" offset="0"/> <Anchor side="Bottom" relative="$parent" pos="Max" offset="0"/>

i want to set it next to the command panel (abilities), where the
unit poträt normally is.
thx in advance

Would you like it centered directly over the current portrait location? Are you using dialogs or layout files?
 
Level 3
Joined
May 18, 2010
Messages
29
Well, I'm going to help under the assumption you are working with dialogs.

First think you want to do is create a reference to the frame containing the Portrait. This will allow you to easily attach your desired dialog to whatever relative location you desire. The method I give you here is functional, if not a little crude.

  • Get Game Portrait Frame As Dialog Item
    • Options: Function
    • Return Type: Dialog Item
    • Parameters
    • Grammar Text: Gets the frame containing the default game portrait
    • Hint Text: (None)
    • Custom Script Code
    • Local Variables
      • _PortraitDialogItem = No Dialog Item <Dialog Item>
      • _TempDialog = No Dialog <Dialog>
      • _TempPanel = No Dialog Item <Dialog Item>
    • Actions
      • Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
      • Variable - Set _TempDialog = (Last created dialog)
      • Dialog - Create a Panel for dialog (Last created dialog)
      • Variable - Set _TempPanel = (Last created dialog item)
      • Dialog - Hook up an existing Panel called "$parent\$parent\$parent\$parent\ConsolePanel\PortraitPanel" in dialog item pane _TempPanel
      • Variable - Set _PortraitDialogItem = (Last created dialog item)
      • Dialog - Destroy _TempPanel
      • Dialog - Destroy _TempDialog
      • General - Return _PortraitDialogItem
Using this function you can attach your desired dialog item as follows:

  • Trigger
    • Events
    • Local Variables
      • _PortraitFrame = No Dialog Item <Dialog Item>
    • Conditions
    • Actions
      • Variable - Set _PortraitFrame = (Frame containing the default game portrait)
      • Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
      • Dialog - Set (Last created dialog) to be fullscreen True
      • Dialog - Hide the background image of (Last created dialog)
      • Dialog - Show (Last created dialog) for (All players)
      • Dialog - Create an image for dialog (Last created dialog) with the dimensions (80, 200) anchored to Top Left with an offset of (50, 50) setting the tooltip to "" using the image Assets\Textures\white32.dds as a Normal type with tiled set to True tint color White and blend mode Normal
      • Dialog - Move (Last created dialog item) to (0, 0) relative to Center of _PortraitFrame for (All players) (from Center)
 
Level 9
Joined
Dec 21, 2006
Messages
490
i am using layout files...
but thx for your work Kalekin, i didn't think about this particular solution yet.
@rispetto : if $parent is the middle of the screen and you go 550 offset to the right where it is next to the command panel, it is just next to the command panel on my screen for this particular resolution, isn't it?

--- edit----
ok sleeping always brings the solution, i fixed it.
 
Last edited:
i am using layout files...
but thx for your work Kalekin, i didn't think about this particular solution yet.
@rispetto : if $parent is the middle of the screen and you go 550 offset to the right where it is next to the command panel, it is just next to the command panel on my screen for this particular resolution, isn't it?

--- edit----
ok sleeping always brings the solution, i fixed it.

From my understanding the offsets are just digits the game uses to determine where to place the dialogs.
Example: the game uses 1000 by 1000 (pixels[?], and idk the real number thats just an educated guess) and if a dialog piece is 75% to the right of the screen (left side being 0%) then no matter what resolution the game will apply the dialog to it's appropriate position, so 75% for me and 75% for the guy with the smaller screen.
I think that also applies to the size of the dialog.
It wouldn't make much sense if offsets were different for each resolution, because then you would need to run a check on the player's current resolution then adjust your dialogs accordingly.

Not to mention what if the player changes his/her resolution mid-game?
You'd need to have the game constantly running checks which would burn up incredible usage of game functionality.
 
Level 9
Joined
Dec 21, 2006
Messages
490
i am running sc2 on a desktop and a notebook with 2 different resolutions. the dialogs that are set on the desktop do not have the same position as the ones on the notebook, that's my xp, maybe this has changed meanwhile.
so i decided to use an anchor with offset as a pattern. or maybe back then i was just too dumb to make it work properly because i often had trouble with it.
 
Level 3
Joined
May 18, 2010
Messages
29
DialogSetPositionRelative would have given you the result you were looking for. It makes use of the same anchoring system you have in Layout files, if not being a little more restrictive (and buggy too I think?). It's simply a matter of attaching it to the right object to get the desired effect.
 
Level 9
Joined
Dec 21, 2006
Messages
490
DialogSetPositionRelative would have given you the result you were looking for. It makes use of the same anchoring system you have in Layout files, if not being a little more restrictive (and buggy too I think?). It's simply a matter of attaching it to the right object to get the desired effect.

yes i had problems with getting the right path but i was able to fix it.
i like this funktion you have written, maybe i gonna use this for my dialogs
 
Status
Not open for further replies.
Top