• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

UI - Custom Buttons - How?

Status
Not open for further replies.
Level 12
Joined
Aug 3, 2005
Messages
745
Does anyone know how to setup buttons with custom UI via triggers?

I have scoured google searches and multiple forums, nothing seems to cover this.

There is alot of useful art already in SC2 I've tried using it but buttons just look wrong.

I tried to no avail the: Set - Dialog Item Image

What am I doing wrong, what do I need to do?

thanks.
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
I'm not sure if this is what you're looking for:
109792d1326023399-how-can-i-create-buttons-next-stats-hero-warcraft-iii-hero-attributes-testdialog.jpg


If it is, you may want to read this solved thread.

P.S. -- You've been away, haven't you? Thanks for coming back!
 
Easy. Take a look at my script here an example:

(Variables used)
  • Configure Game Menu Dialog = No Dialog <Dialog>
  • Configure Game Menu Label = No Dialog Item <Dialog Item[5]>
  • Configure Game Menu Button = No Dialog Item <Dialog Item[5]>
  • Vote Label = No Dialog Item <Dialog Item[5]>
  • optionButtonText = "" <String[5]>
JASS:
void gt_ConfigureGameMenuDialogCreate_Func () {
    const int   lv_width    = 400;
    const int   lv_height   = 600;
    const int   lv_anchor   = c_anchorCenter;
    const int   lv_offsetX  = 0;
    const int   lv_offsetY  = 0;
    const bool  lv_modal    = false;
    const string lv_bgImage = gv_errorReportBackground;
    const string lv_style   = "<s val=\"ModCenterSize24Bold\">";
    text        lv_txt;
    int         lv_i;
    gv_configureGameMenuDialog = DialogCreate(lv_width, lv_height, lv_anchor, lv_offsetX, lv_offsetY, lv_modal);
    DialogSetImage(gv_configureGameMenuDialog, lv_bgImage);
    DialogSetVisible(gv_configureGameMenuDialog, gv_allPlayers, true);
    
    gv_configureGameMenuLabel[0] = DialogControlCreate(gv_configureGameMenuDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_configureGameMenuLabel[0], gv_allPlayers, lv_width, lv_height);
    DialogControlSetPosition(gv_configureGameMenuLabel[0], gv_allPlayers, c_anchorTop, 0, 6);
    lv_txt = StringToText("<c val=\"F85F34\">Mode</n><s val=\"ModCenterSize20\">Select game mode</n></n>");
    DialogControlSetPropertyAsText(gv_configureGameMenuLabel[0], c_triggerControlPropertyText, gv_allPlayers, StringToText(lv_style) + lv_txt);
    DialogControlSetPropertyAsString(gv_configureGameMenuLabel[0], c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_configureGameMenuLabel[0], gv_allPlayers, true);
    
    gv_optionButtonText[0] = "Don't Care";
    gv_optionButtonText[1] = "Team Deathmatch";
    gv_optionButtonText[2] = "Capture The Flag";
    gv_optionButtonText[3] = "Survival";
    gv_optionButtonText[4] = "Bomb The Base";
    gv_optionButtonText[5] = "Zerg VS Marines";
    
    while(lv_i <= 5) {
        gv_configureGameMenuButton[lv_i] = DialogControlCreate(gv_configureGameMenuDialog, c_triggerControlTypeButton);
        DialogControlSetSize(gv_configureGameMenuButton[lv_i], gv_allPlayers, lv_width - 24, 24);
        DialogControlSetPosition(gv_configureGameMenuButton[lv_i], gv_allPlayers, c_anchorTop, 0, 70 + (25 * lv_i));
        DialogControlSetPropertyAsString(gv_configureGameMenuButton[lv_i], c_triggerControlPropertyImage, gv_allPlayers, gv_optionButton);
        DialogControlSetPropertyAsString(gv_configureGameMenuButton[lv_i], c_triggerControlPropertyHoverImage, gv_allPlayers, gv_optionButtonHover);
        DialogControlSetPropertyAsInt(gv_configureGameMenuButton[lv_i], c_triggerControlPropertyImageType, gv_allPlayers, c_triggerImageTypeBorder);
        
        gv_configureGameMenuLabel[lv_i] = DialogControlCreate(gv_configureGameMenuDialog, c_triggerControlTypeLabel);
        DialogControlSetSize(gv_configureGameMenuLabel[lv_i], gv_allPlayers, lv_width - 24, 24);
        DialogControlSetPosition(gv_configureGameMenuLabel[lv_i], gv_allPlayers, c_anchorTop, 0, 73 + (25 * lv_i));
        lv_txt = StringToText(gv_optionButtonText[lv_i]);
        DialogControlSetPropertyAsText(gv_configureGameMenuLabel[lv_i], c_triggerControlPropertyText, gv_allPlayers, lv_txt);
        DialogControlSetPropertyAsString(gv_configureGameMenuLabel[lv_i], c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
        DialogControlSetVisible(gv_configureGameMenuLabel[lv_i], gv_allPlayers, true);
        
        gv_voteLabel[lv_i] = DialogControlCreate(gv_configureGameMenuDialog, c_triggerControlTypeLabel);
        DialogControlSetSize(gv_voteLabel[lv_i], gv_allPlayers, lv_width - 24, 24);
        DialogControlSetPosition(gv_voteLabel[lv_i], gv_allPlayers, c_anchorTop, 0, 73 + (25 * lv_i));
        DialogControlSetPropertyAsString(gv_voteLabel[lv_i], c_triggerControlPropertyStyle, gv_allPlayers, "RightJustified");
        DialogControlSetPropertyAsFixed(gv_voteLabel[lv_i], c_triggerControlPropertyValue, gv_allPlayers, 0.0);
        DialogControlSetVisible(gv_voteLabel[lv_i], gv_allPlayers, true);
        lv_i += 1;
    }
}

Edit: Left out a few variables I used, but they're not all that relevant.
 
  • Like
Reactions: Rui
Status
Not open for further replies.
Top