so i've known for a while that Control::setPosition doesn't work in 1.40 - not sure why, never really even thought about it just saw that it doesn't do anything
but then bins sent me his config and it has 'popupfix.acs.cs' which seems to have some kind of workaround or fix that its using for its remoteCP/BP/TP stuff
can anyone explain how this works? i don't understand how its fixing/working around setting hud positions
like, i see that its doing
but then what's it doing with those vars? i just dont get it
plaes halp i am dumb
but then bins sent me his config and it has 'popupfix.acs.cs' which seems to have some kind of workaround or fix that its using for its remoteCP/BP/TP stuff
can anyone explain how this works? i don't understand how its fixing/working around setting hud positions
like, i see that its doing
Code:
%id = Control::getId("Popup_Container_T");
%id.position = %x ~ " " ~ %y;
but then what's it doing with those vars? i just dont get it
plaes halp i am dumb
Code:
$RemotePopup[B, y] = 25; //bottom print
$RemotePopup[C, y] = 700; //center print
$RemotePopup[T, y] = 25; //top print
$RemotePopup[B, width] = 30; //in percent
$RemotePopup[C, width] = 30; //in percent
$RemotePopup[T, width] = 30; //in percent
function RemotePopup::Init(%which)
{
if ( $RemotePopup[%which,Loaded] )
return;
$RemotePopup[%which,Loaded] = true;
%name = "Popup_Container_" ~ %which;
%text = "Popup_Text_" ~ %which;
HUD::New::Shaded(%name, 100 , $RemotePopup[%which, y], $RemotePopup[%which, width] * 1280 / 100, 55, RemotePopup::Wake, RemotePopup::Sleep);
newObject(%text, FearGuiFormattedText, 0, 1, 20, 20);
HUD::Add(%name, %text);
Control::SetVisible(%name, false);
}
function RemotePopup::Wake()
{
%width = getWord(Control::getExtent("PlayGui"),0);
Control::setExtent("Popup_Container_B", $RemotePopup[B, width] * %width / 100.0, getword(Control::getExtent("Popup_Container_B"),1));
Control::setExtent("Popup_Container_C", $RemotePopup[C, width] * %width / 100.0, getword(Control::getExtent("Popup_Container_C"),1));
Control::setExtent("Popup_Container_T", $RemotePopup[T, width] * %width / 100.0, getword(Control::getExtent("Popup_Container_T"),1));
%x = (%width / 2) - (getword(Control::getExtent("Popup_Container_B"),0)/2);
%y = getword(Control::getPosition("Popup_Container_B"),1);
//fix horrible 1.40 bug where Control::setPosition won't work
%id = Control::getId("Popup_Container_B");
%id.position = %x ~ " " ~ %y;
%x = (%width / 2) - (getword(Control::getExtent("Popup_Container_C"),0)/2);
%y = getword(Control::getPosition("Popup_Container_C"),1);
%id = Control::getId("Popup_Container_C");
%id.position = %x ~ " " ~ %y;
%x = (%width / 2) - (getword(Control::getExtent("Popup_Container_T"),0)/2);
%y = getword(Control::getPosition("Popup_Container_T"),1);
%id = Control::getId("Popup_Container_T");
%id.position = %x ~ " " ~ %y;
//what should usually work
//Control::setPosition("Popup_Container_B", %x,%y);
//Control::setPosition("Popup_Container_C", %x,%y);
//Control::setPosition("Popup_Container_T", %x,%y);
}
function RemotePopup::Sleep()
{
}
function remoteBP(%manager, %msg, %timeout) //don't rename the params or the attachments will fail
{
RemotePopup::set("B", %manager, %msg, %timeout);
}
function remoteCP(%manager, %msg, %timeout) //don't rename the params or the attachments will fail
{
RemotePopup::set("C", %manager, %msg, %timeout);
}
function remoteTP(%manager, %msg, %timeout) //don't rename the params or the attachments will fail
{
RemotePopup::set("T", %manager, %msg, %timeout);
}
function RemotePopup::set(%which, %manager, %msg, %timeout)
{
if(%manager != 2048)
return;
//fix the message of the day thing, should be fixed serverside tho
if(%timeout == 0)
%timeout = 10;
//echo(%which, %manager, %msg, %timeout);
%container = "Popup_Container_" ~ %which;
%text = "Popup_Text_" ~ %which;
if(%msg == "")
{
Control::SetVisible(%container, false);
return;
}
if(%timeout)
Schedule::Add("RemotePopup::Clear(\"" ~ %which ~ "\");", %timeout);
//determine the needed height
%tmp = %msg;
%lines = 1;
echo(string::findsubstr(%tmp, "\n"));
while( (%idx = string::findsubstr(%tmp, "\n")) != -1)
{
%lines++;
%tmp = string::getsubstr(%tmp, %idx+1, string::len(%tmp));
}
Control::setExtent(%container, getword(Control::getExtent(%container),0), (%lines * 14) + 6);
Control::SetValue(%text, %msg);
Control::SetVisible(%container, true);
}
function RemotePopup::Clear(%which)
{
%container = "Popup_Container_" ~ %which;
%text = "Popup_Text_" ~ %which;
Control::SetValue(%text, "");
Control::SetVisible(%container, false);
}
RemotePopup::Init("B");
RemotePopup::Init("C");
RemotePopup::Init("T");
function RemotePopup::RestoreFix(%i) before Hud::Restore {
%name = $Hud::Huds[%i, name];
if(String::findSubStr(%name, "Popup_Container_") != -1)
halt;
}
Last edited: