Example: if (%my_object.firstValue < %my_object.secondValue) echo("Not complete.");
- Code: Select all
//
// CmGuiDoubleValTextCtrl::onWake()
//
function CmGuiDoubleValTextCtrl::onWake(%this)
{
%gui = new GuiMLTextCtrl()
{
text = "";
maxChars = -1;
lineSpacing = 0;
bottomOffset = 0;
allowColorChars = 1;
useURLMouseCursor = 0;
extent = %this.extent;
position = %this.position;
vertSizing = %this.vertSizing;
horizSizing = %this.horizSizing;
profile = %this.profile;
tooltip = %this.tooltip;
canSave = %this.canSave;
canHit = %this.canHit;
isContainer = 0;
visible = 1;
};
%this.getParent().add(%gui);
%this.textCtrl = %gui;
}
//
// CmGuiDoubleValTextCtrl::setFirstColor(%color)
//
function CmGuiDoubleValTextCtrl::setFirstColor(%this, %color)
{
%this.firstColor = strFormat("%x", getWord(%color, 0)) @ strFormat("%x", getWord(%color, 1)) @ strFormat("%x", getWord(%color, 2));
%this.updateText();
}
//
// CmGuiDoubleValTextCtrl::setSecondColor(%color)
//
function CmGuiDoubleValTextCtrl::setSecondColor(%this, %color)
{
%this.secondColor = strFormat("%x", getWord(%color, 0)) @ strFormat("%x", getWord(%color, 1)) @ strFormat("%x", getWord(%color, 2));
%this.updateText();
}
//
// CmGuiDoubleValTextCtrl::setFirstValue(%value)
//
function CmGuiDoubleValTextCtrl::setFirstValue(%this, %value)
{
if (%this.skipSecondValue) %this.format = "%.2f";
%this.firstValue = strFormat(%this.format, %value);
%this.updateText();
}
//
// CmGuiDoubleValTextCtrl::setSecondValue(%value)
//
function CmGuiDoubleValTextCtrl::setSecondValue(%this, %value)
{
%this.secondValue = strFormat(%this.format, %value);
%this.updateText();
}
//
// CmGuiDoubleValTextCtrl::setFirstFloatValue(%value)
//
function CmGuiDoubleValTextCtrl::setFirstFloatValue(%this, %value)
{
%this.firstValue = strFormat(%this.format, %value);
%this.updateText();
}
//
// CmGuiDoubleValTextCtrl::setSecondFloatValue(%value)
//
function CmGuiDoubleValTextCtrl::setSecondFloatValue(%this, %value)
{
%this.secondValue = strFormat(%this.format, %value);
%this.updateText();
}
//
// CmGuiDoubleValTextCtrl::updateText(%value)
//
function CmGuiDoubleValTextCtrl::updateText(%this)
{
if (isObject(%this.textCtrl))
{
%this.visible = 0;
if (strlen(%this.firstColor) == 0) { %firstText = %this.firstValue; } else
{
%firstText = "<spush><color:"@%this.firstColor@">"@%this.firstValue@"<spop>";
}
if (%this.skipSecondValue == 0 && strlen(%this.secondValue) > 0)
{
if (strlen(%this.secondColor) == 0) { %secondText = %this.secondValue; } else
{
%secondText = "<spush><color:"@%this.secondColor@">"@%this.secondValue@"<spop>";
}
%this.textCtrl.setText("<just:center>"@%firstText@"/"@%secondText);
}
else
{
%this.textCtrl.setText("<just:center>"@%firstText);
}
}
}
Append high-light effect for items in list into "Stables".
- Code: Select all
//
// GuiListDeed::onAdd()
//
function GuiListDeed::onAdd(%this)
{
%gui = new GuiTilingBitmapOverlap()
{
position = "0 0";
extent = "328 32";
horizSizing = "width";
internalName = "highlighPanel";
profile = "GuiAtlas3ImageProfile";
TopLeftIndex = ThickMenuItemMouseOverLeft;
TopIndex0 = ThickMenuItemMouseOverCenter0;
TopIndexN = ThickMenuItemMouseOverCenter1;
TopRightIndex = ThickMenuItemMouseOverRight;
visible = "0";
canHit = "0";
};
%this.add(%gui);
}
//
// GuiListDeed::onStateChanged()
//
function GuiListDeed::onStateChanged(%this, %state)
{
if (isObject(%this-->highlighPanel)) %this-->highlighPanel.visible = %this.getStateOn();
}
Make movable a progress bar by creating window gui on PlayGUI.
- Code: Select all
//
// OVERRIDE ["scripts\client\default.bindCommands.cs"] toggleCmEditGuiMode()
//
function toggleCmEditGuiMode(%down)
{
if (%down)
{
ContextMenuClose();
if (!$cmEditGuiMode)
{
$saveFreelook = $cmFreelookMode;
setCmFreelookMode(false,true);
setCmEditGuiMode(true);
}
else
{
setCmFreelookMode($saveFreelook, false);
setCmEditGuiMode(false);
saveGui();
}
if (isObject(cmProgressBarHud))
{
cmProgressBarHud.onGuiEditMode($cmEditGuiMode);
}
}
}
//
// cmProgressBarHud::onAdd()
//
function cmProgressBarHud::onAdd(%this)
{
if (!isObject(cmProgressBarWindow))
{
%position = Canvas.extent.x * 0.5 - 239.5 SPC Canvas.extent.y * 0.5 - 42;
%gui = new GuiWindowCtrl(cmProgressBarWindow)
{
text = "Progress Bar";
canLock = "0";
canMove = "1";
canClose = "0";
canSetup = "1";
forGuiEdit = "1";
canMinimize = "0";
canMaximize = "0";
canCollapse = "0";
resizeWidth = "0";
resizeHeight = "0";
extent = "479 70";
position = %position;
minExtent = "479 70";
maxExtent = "479 70";
profile = "GuiSmallWindowProfile";
canHideOnFreelook = "1";
isContainer = "1";
edgeSnap = "0";
visible = "1";
opacity = "1";
active = "1";
locked = "1";
new cmBarWidget()
{
position = "5 25";
extent = "469 30";
MinExtent = "469 30";
internalName = "Bar";
profile = "GuiBarProfile";
leftHiddenBar = 0;
rightBarOffset = 2;
LeftBarOffset = 0;
visible = 1;
backgroundLeftIndex = ProgressBarBackgroundLeft;
backgroundCenterIndex = ProgressBarBackgroundCenter;
backgroundRightIndex = ProgressBarBackgroundRight;
firstBarLeftIndex = ProgressBarLeft;
firstBarCenterIndex = ProgressBarCenter;
firstBarRightIndex = ProgressBarRight;
firstBarRightDecorIndex = ArrowRight;
new GuiBitmapCtrl()
{
extent = "30 30";
position = "404 0";
profile = "GuiAtlas1ImageProfile";
imageIndex = "ProgressEscLbl";
VertSizing = "center";
centered = 1;
visible = 1;
canHit = 0;
};
new GuiBitmapCtrl()
{
extent = "17 17";
position = "434 0";
horizSizing = "left";
vertSizing = "center";
profile = "GuiAtlas3ImageProfile";
useManualIndex = "true";
imageIndex = "Cross";
visible = 1;
};
};
};
PlayGui.add(%gui);
}
loadPropertyXml(cmProgressBarWindow, $HUDPresetPath @ "ProgressBar.obj");
}
//
// cmProgressBarHud::onThisControlResized()
//
function cmProgressBarHud::onThisControlResized(%this)
{
ProgressBar.position = cmProgressBarWindow-->Bar.getGlobalPosition();
}
//
// cmProgressBarHud::onWake()
//
function cmProgressBarHud::onWake(%this)
{
if (isObject(cmProgressBarWindow))
{
ProgressBar.position = cmProgressBarWindow-->Bar.getGlobalPosition();
cmProgressBarWindow-->Bar.visible = 0;
%this.onUpdate();
}
}
//
// cmProgressBarHud::onSleep()
//
function cmProgressBarHud::onSleep(%this)
{
if (isObject(cmProgressBarWindow) && $cmEditGuiMode)
{
cmProgressBarWindow-->Bar.visible = 1;
}
}
//
// cmProgressBarHud::onGuiEditMode()
//
function cmProgressBarHud::onGuiEditMode(%this, %state)
{
if (isObject(cmProgressBarWindow) && isObject(ProgressBar))
{
cmProgressBarWindow-->Bar.visible = %state && !cmProgressBarHud.getParent();
if (%state == 0) savePropertyXml(cmProgressBarWindow, $HUDPresetPath @ "ProgressBar.obj");
}
}
//
// cmProgressBarHud::onUpdate()
//
function cmProgressBarHud::onUpdate(%this)
{
if (isObject(cmProgressBarWindow) && cmProgressBarHud.getParent())
{
if ($cmEditGuiMode)
{
ProgressBar.position = cmProgressBarWindow-->Bar.getGlobalPosition();
}
%this.schedule(10, "onUpdate");
}
}