Page 1 of 1
Open files dialog with replays?
Posted: 19 Aug 2017, 18:23
by adamkooo2
I have an idea how should it look, but it does not work, becuase I've coded it with not existing elements and no ManiaScript skill.
Code: Select all
function RPLJ {
CManiaApp.OpenFileDialog.Replays();
}
TitleFlow.EditReplay(RPLJ);
I was searching on github and I found the nearest result
TitleEdition.Dialog_ImportFiles(). I think that the code I've found will not work. I will try to search again.
Can you plase help me to make it work?
Re: Open files dialog with replays?
Posted: 19 Aug 2017, 19:37
by zocka
I don't think there is a ready-to-use dialog.
With
DataFileMgr.Replay_GetGameList() (
https://maniaplanet.github.io/maniascri ... e_mgr.html)
you should be able to retrieve the replay-files and then display a list to choose from.
As general tipp: look into the documentation of the baseclass you are having (maybe try log(This); if you are not sure) and work your way through by reading up classes or methods that sound like what you need or have a fitting return type.
Re: Open files dialog with replays?
Posted: 19 Aug 2017, 20:10
by Florenzius
The lists with maps and replays are interfaces and scripts from the MP3 menu, so it's just visible in this menu. A custom list for loading files is needed here
Re: Open files dialog with replays?
Posted: 20 Aug 2017, 15:49
by adamkooo2
ManiaDesign wrote: ↑19 Aug 2017, 20:10
A custom list for loading files is needed
No, I need a classic
Choose a File dialog where I will select a replay and game will show another dialog asking what I want to do with replay.
zocka wrote: ↑19 Aug 2017, 19:37
I don't think there is a ready-to-use dialog.
I've found out a file entry element in ML designer, I've done test manialink, but it does not show up and there's no errors. In ML designer it shows up, when I try to open it in ML browser, or set it as menu ML, no manialinks is visible :/
https://dl.dropbox.com/s/lbgi9zapzayrnx ... script.txt
Code: Select all
//#RequireContext CGameManiaAppBrowser
#RequireContext CGameManiaAppTitle
declare CMlFileEntry MedPath;
declare CMlLabel Test;
Text ML() {
return """
<manialink version="3">
<frame posn="0 0">
<frame posn="0 45">
</frame>
<frame posn="0 15">
<label posn="-62 -15 0" sizen="132 13.5" text=" " style="TextButtonMedium" id="test"/>
<label posn="-62 -5 0" sizen="25.8 10.5" text="Replay" valign="center2" halign="left" style="TextButtonMedium" translate="1"/>
<fileentry posn="-40 -5 0" sizen="104 7.73" default="..." halign="left" valign="center2" style="TextButtonNav" id="medpath" folder="Replays"/>
</frame>
</frame>
<frame id="ENewTrackMenu2" hidden="" z-index="-5">
<quad pos="0 6.5" z-index="1" size="135 50" halign="center" valign="center" style="Bgs1" substyle="BgHealthBar"/>
<quad pos="0 6.5" z-index="1" size="145 80" halign="center" valign="center" style="Bgs1" substyle="BgList"/>
<quad pos="0 6.5" z-index="1" size="145 80" halign="center" valign="center" style="Bgs1" substyle="BgList"/>
<quad pos="0 6.5" z-index="2" size="145 80" halign="center" valign="center" style="Bgs1" substyle="BgTitleShadow"/>
<quad pos="0 47" z-index="8" size="144 11" bgcolor="FFFA" halign="center" style="Bgs1" substyle="BgTitle3_1"/>
<label pos="0 44" z-index="10" size="160 5" text="Select a Replay" halign="center" style="TextRankingsBig" translate="1" textsize="3"/>
<quad id="ButtonCancel" pos="30 -26" size="70.5 8.77" z-index="20" image="file://Media/Images/Icon/share_nations.png" halign="center" valign="center" imagefocus="file://Media/Images/Icon/share_nations_over.png" scriptevents="1"/>
<label pos="30 -24" z-index="21" size="50.5 5" text="Cancel" style="TextRankingsBig" textsize="3" textcolor="000000FF" halign="center" translate="1"/>
<quad id="ButtonOk" pos="-30 -26" size="70.5 8.77" z-index="20" image="file://Media/Images/Icon/share_nations.png" halign="center" valign="center" imagefocus="file://Media/Images/Icon/share_nations_over.png" scriptevents="1"/>
<label pos="-30 -24" z-index="21" size="50.5 5" text="Select" style="TextRankingsBig" textsize="3" textcolor="000000FF" halign="center" translate="1"/>
</frame>
<script><!--
#Include "TextLib" as TL
Text ConvertPath(Text _Path) {
if (_Path == "") return "";
declare SplittedPath = TL::Split("\\", _Path);
declare Path = "file://Replays";
declare FoundRPL = False;
foreach (Folder in SplittedPath) {
if (FoundRPL) Path^= "/"^Folder;
if (!FoundRPL && Folder == "Replay") FoundRPL = True;
}
return Path;
}
main() {
MedPath <=> (Page.GetFirstChild("medpath") as CMlFileEntry);
Test <=> (Page.GetFirstChild("test") as CMlLabel);
MedPath.Value = "";
Test.SetText("");
while(True) {
foreach(Event in PendingEvents) {
if(Event.Type == CGameManialinkScriptEvent::Type::MouseClick) {
if (Event.ControlId == "ButtonOk") {
//TitleFlow.EditReplay(MedPath);
}
}
}
yield;
}
while (True) {
yield;
if (MedPath.Value != "")
{
Test.SetText(ConvertPath(MedPath.FullFileName));
}
}
}
--></script>
</manialink> """;
}
main() {
declare Layer = UILayerCreate();
Layer.ManialinkPage = ML();
}
I hope there's a solution for it

Re: Open files dialog with replays?
Posted: 20 Aug 2017, 16:38
by Florenzius
adamkooo2 wrote: ↑20 Aug 2017, 15:49
ManiaDesign wrote: ↑19 Aug 2017, 20:10
A custom list for loading files is needed
No, I need a classic
Choose a File dialog where I will select a replay and game will show another dialog asking what I want to do with replay.
And this classic dialog is a part of the MP3 menu, so you can't access it in an own menu.