int TimerWindowCreateFixed (timer lp_timer, text lp_title, bool lp_visible, bool lp_elapsed) { string auto2D681054_val; playergroup group = PlayerGroupAll(); int window;
Ik how to make custom UI. That's something i was gonna try but i figured i was doing something wrong. I was hoping to make the standard one work though bc i assume it's more optimal than periodically updating a custom dialog
tried using the function you linked. The Text is still very dark. It looks terrible, any way to make the text look more visible like the old sc2 timers?
Hey prodigy, I looked into what you said. Mind posting where you might find this function's definition? I opened up the code browse via the command line, no luck. Thanks!
Update! Got sick of this INANE api and built my own. Works better than the original and with multiple instances. No weird hacks required.
const string TIMER_DIALOG_TABLE_PREFIX = "TIMER_DIALOG_TABLE_PREFIX_";
const string TIMER_DIALOG_PARAMETER_COUNT = "TIMER_DIALOG_PARAMETER_COUNT";
const string TIMER_DIALOG_PARAMETER_ELAPSED = "TIMER_DIALOG_PARAMETER_ELAPSED_";
const string TIMER_DIALOG_PARAMETER_DIALOG = "TIMER_DIALOG_PARAMETER_DIALOG_";
const string TIMER_DIALOG_PARAMETER_TIMER = "TIMER_DIALOG_PARAMETER_TIMER_";
const string TIMER_DIALOG_PARAMETER_TIMER_LABEL = "TIMER_DIALOG_PARAMETER_TIMER_LABEL_";
const string TIMER_DIALOG_PARAMETER_DIALOG_TITLE = "TIMER_DIALOG_PARAMETER_DIALOG_TITLE_";
const int TIMER_DIALOG_DEFAULT_COUNT = 0;
//Dialog Settings
const string DIALOG_TIMER_DEFAULT_TITLE = "";
const bool DIALOG_TIMER_INITIALLY_VISIBLE = true;
const bool DIALOG_TIMER_COLLAPSEABLE = true;
const bool DIALOG_TIMER_MODAL = true;
const int DIALOG_TIMER_COLLAPSE_POSITION = DIALOG_COLLAPSED_POSITION_TOP_RIGHT;
const int DIALOG_TIMER_WIDTH = 400;
const int DIALOG_TIMER_HEIGHT = 120;
const int DIALOG_TIMER_X_OFFS = 25;
const int DIALOG_TIMER_Y_OFFS = 50;
const int DIALOG_TIMER_ANCHOR = c_anchorTopRight;
//Label Time Remaining Label
const string LABEL_TIME_REMAINING_TITLE_BASE = "<1>";
const int LABEL_TIME_REMAINING_TITLE_PRECISION = 0;
const bool LABEL_TIME_REMAINING_INITIALLY_VISIBLE = true;
const int LABEL_TIME_REMAINING_ANCHOR = c_anchorBottomRight;
const int LABEL_TIME_REMAINING_WIDTH = 70;
const int LABEL_TIME_REMAINING_HEIGHT = 20;
const int LABEL_TIME_REMAINING_X_OFFS = 40;
const int LABEL_TIME_REMAINING_Y_OFFS = 35;
//Label Dialog Title
const string LABEL_TIMER_DIALOG_TITLE_BASE = "<1>...";
const int LABEL_TIMER_DIALOG_TITLE_PRECISION = 0;
const bool LABEL_TIMER_DIALOG_INITIALLY_VISIBLE = true;
const int LABEL_TIMER_DIALOG_ANCHOR = c_anchorTop;
const int LABEL_TIMER_DIALOG_WIDTH = 250;
const int LABEL_TIMER_DIALOG_HEIGHT = 20;
const int LABEL_TIMER_DIALOG_X_OFFS = 0;
const int LABEL_TIMER_DIALOG_Y_OFFS = 35;
//variable
const fixed TIMER_DIALOG_UPDATE_RATE = 0.5;
const int TIMER_DIALOG_UPDATE_TYPE = c_timeGame;
trigger timerDialogUpdate = TriggerCreate("TimerDialogUpdateActions");
int TimerDialogGetCount(){
return DataTableGetInt(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_COUNT);
}
void TimerDialogSetCount(int count){
DataTableSetInt(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_COUNT, count);
}
bool TimerDialogIsElapsed(int dialog){
return DataTableGetBool(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_ELAPSED + IntToString(dialog));
}
void TimerDialogSetElapsed(int dialog, bool elapsed){
DataTableSetBool(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_ELAPSED + IntToString(dialog), elapsed);
}
int TimerDialogGetLabel(int dialog){
return DataTableGetInt(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_TIMER_LABEL + IntToString(dialog));
}
void TimerDialogSetLabel(int dialog, int label){
DataTableSetInt(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_TIMER_LABEL + IntToString(dialog), label);
}
int TimerDialogGetTitleLabel(int dialog){
return DataTableGetInt(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_DIALOG_TITLE + IntToString(dialog));
}
void TimerDialogSetTitleLabel(int dialog, int label){
DataTableSetInt(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_DIALOG_TITLE + IntToString(dialog), label);
}
void TimerDialogSetTitle(int dialog, playergroup group, string title){
string titleStr = StringFormat1(LABEL_TIMER_DIALOG_TITLE_BASE, title);
text titleText = StringToText(titleStr);
int label = TimerDialogGetTitleLabel(dialog);
DialogControlSetPropertyAsText (label, c_triggerControlPropertyText, group, titleText);
}
timer TimerDialogGetTimer(int dialog){
return DataTableGetTimer(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_TIMER + IntToString(dialog));
}
void TimerDialogSetTimer(int dialog, timer time){
DataTableSetTimer(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_TIMER + IntToString(dialog), time);
}
int TimerDialogGet(int index){
return DataTableGetInt(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_DIALOG + IntToString(index));
}
void TimerDialogSet(int dialog, int index){
DataTableSetInt(true, TIMER_DIALOG_TABLE_PREFIX + TIMER_DIALOG_PARAMETER_DIALOG + IntToString(index), dialog);
}
bool TimerDialogIsVisible(int dialog, int p){
return DialogIsVisible(dialog, p);
}
void TimerDialogSetVisible(int dialog, playergroup group, bool visible){
DialogSetVisible(dialog, group, visible);
}
void TimerDialogUpdate(int dialog, playergroup group){
int label = TimerDialogGetLabel(dialog);
timer time = TimerDialogGetTimer(dialog);
bool elapsed = TimerDialogIsElapsed(dialog);
fixed timerValue;
string titleStr;
text title;
if(elapsed){
timerValue = TimerGetElapsed(time);
}
else{
timerValue = TimerGetRemaining(time);
}
titleStr = StringFormat1(LABEL_TIME_REMAINING_TITLE_BASE, FixedToString(timerValue, LABEL_TIME_REMAINING_TITLE_PRECISION));
title = StringToText(titleStr);
DialogControlSetPropertyAsText (label, c_triggerControlPropertyText, group, title);
}
int TimerDialogCreate(timer time, string title, bool visible, bool elapsed){
playergroup group = PlayerGroupAll();
int index = TimerDialogGetCount();
int count = index + 1;
int dialog = DialogCreate(DIALOG_TIMER_WIDTH, DIALOG_TIMER_HEIGHT,
DIALOG_TIMER_ANCHOR, DIALOG_TIMER_X_OFFS, DIALOG_TIMER_Y_OFFS,
DIALOG_TIMER_MODAL);
int labelTimeRemaining;
int labelTitle;
//dialog
TimerDialogSetVisible(dialog, group, visible);
TimerDialogSetElapsed(dialog, elapsed);
TimerDialogSetTimer(dialog, time);
TimerDialogSet(dialog, index);
TimerDialogSetCount(count);
//label time remaining
labelTimeRemaining = DialogControlCreate(dialog, c_triggerControlTypeLabel);
DialogControlSetVisible(labelTimeRemaining, group, LABEL_TIME_REMAINING_INITIALLY_VISIBLE);
DialogControlSetPosition(labelTimeRemaining, group, LABEL_TIME_REMAINING_ANCHOR, LABEL_TIME_REMAINING_X_OFFS, LABEL_TIME_REMAINING_Y_OFFS);
DialogControlSetSize(labelTimeRemaining, group, LABEL_TIME_REMAINING_WIDTH, LABEL_TIME_REMAINING_HEIGHT);
//label title
labelTitle = DialogControlCreate(dialog, c_triggerControlTypeLabel);
DialogControlSetVisible(labelTitle, group, LABEL_TIMER_DIALOG_INITIALLY_VISIBLE);
DialogControlSetPosition(labelTitle, group, LABEL_TIMER_DIALOG_ANCHOR, LABEL_TIMER_DIALOG_X_OFFS, LABEL_TIMER_DIALOG_Y_OFFS);
DialogControlSetSize(labelTitle, group, LABEL_TIMER_DIALOG_WIDTH, LABEL_TIMER_DIALOG_HEIGHT);
//
TimerDialogSetLabel(dialog, labelTimeRemaining);
TimerDialogSetTitleLabel(dialog, labelTitle);
TimerDialogSetTitle(dialog, group, title);
return dialog;
}
void InitTimerDialog(){
TimerDialogSetCount(TIMER_DIALOG_DEFAULT_COUNT);
TriggerAddEventTimePeriodic(timerDialogUpdate, TIMER_DIALOG_UPDATE_RATE, TIMER_DIALOG_UPDATE_TYPE);
}
bool TimerDialogUpdateActions(bool a, bool b){
int count = TimerDialogGetCount();
playergroup group = PlayerGroupAll();
int dialog;
int i;
for(i = 0; i < count; i = i + 1){
dialog = TimerDialogGet(i);
TimerDialogUpdate(dialog, group);
}
return true;
}
Everything we've discussed resulted in the following function. It works but only once XD. There was something missing in the function
const string TIMER_DIALOG_PATH = "UIContainer\\ConsoleUIContainer\\TriggerWindowPanel\\TimerWindowTemplate";
const string TIMER_DIALOG_ANIMATION = "HighlightStop";
const int TIMER_DIALOG_CONTROL_TYPE = c_triggerControlTypePanel;
int TimerWindowCreateFixed (timer lp_timer, text lp_title, bool lp_visible, bool lp_elapsed) {
string auto2D681054_val;
playergroup group = PlayerGroupAll();
int window;
// Variable Declarations
string lv_image;
// Variable Initialization
// Implementation
window = TimerWindowCreate(lp_timer, lp_title, lp_visible, lp_elapsed);
TimerWindowShowBorder(window, true);
TimerWindowSetImageType(window, c_timerWindowImageBackground, c_triggerImageTypeNineSlice);
TimerWindowSetImageType(window, c_timerWindowImageProgressFill, c_triggerImageTypeNineSlice);
TimerWindowSetImageType(window, c_timerWindowImageBorder, c_triggerImageTypeNineSlice);
TimerWindowSetImageType(window, c_timerWindowImageProgressFrame, c_triggerImageTypeNineSlice);
TimerWindowSetStyle(window, c_timerWindowStyleVerticalTitleTime, false);
TimerWindowSetFixedHeight(window, 80);
libVCUI_gf_RepositionTimerWindow(window);
if ((libVCUI_gv_pU_TimerWindowHighlightFrame != c_invalidDialogControlId)) {
DialogControlDestroy(libVCUI_gv_pU_TimerWindowHighlightFrame);
}
else {
}
DialogControlHookupStandard(TIMER_DIALOG_CONTROL_TYPE, TIMER_DIALOG_PATH);
DialogControlSendAnimationEvent(window, group, TIMER_DIALOG_ANIMATION);
libVCUI_gv_pU_TimerWindowHighlightFrame = DialogControlLastCreated();
libVCUI_gv_pU_TimerWindowTimer = lp_timer;
libVCUI_gv_pU_TimerWindowInDanger = false;
TriggerEnable(libVCUI_gt_PU_TimerWindowThresholdCrossed, true);
TriggerEnable(libVCUI_gt_PU_TimerWindowLoadUpdate, true);
libVCUI_gf_FlashTimerWindow(8.0, false);
auto2D681054_val = PlayerRace(1);
if (auto2D681054_val == "Prot") {
TimerWindowSetProgressColor(window, Color(100.00, 100.00, 0.00), 1);
}
else if (auto2D681054_val == "Terr") {
TimerWindowSetProgressColor(window, Color(42.75, 68.24, 16.86), 1);
}
else if (auto2D681054_val == "Zerg") {
TimerWindowSetProgressColor(window, Color(100.00, 50.20, 0.00), 1);
}
else {
}
return window;
}
In reply to DrSuperEvil:
In reply to Talv_:
In reply to Prodigy454:
In reply to Prodigy454:
In reply to Prodigy454:
We used to have skins like this:
Once you add the LOTV campaign dependency, the skin turns into this:
I tried using Galaxy native calls to darken the text. Nothing I tried worked.
Used TimerWindowSetColor. Any suggestions?