Open files dialog with replays?

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
adamkooo2
Posts: 1309
Joined: 13 Jun 2014, 08:43
Location: Slovakia // Slovensko
Contact:

Open files dialog with replays?

Post by adamkooo2 » 19 Aug 2017, 18:23

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?
/\rkady
Image

zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Re: Open files dialog with replays?

Post by zocka » 19 Aug 2017, 19:37

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.
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

User avatar
Florenzius
Translator
Translator
Posts: 2344
Joined: 27 Jul 2014, 20:31
Location: Germany » Saxony » Chemnitz
Contact:

Re: Open files dialog with replays?

Post by Florenzius » 19 Aug 2017, 20:10

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
Hardware specs:
MB: MB AM3+ 970 Gigabyte GA-970A-DS3P
RAM: 16GB DDR3
CPU: AMD FX-8320E Enlight-Core
GPU: Nvidia GeForce GTX 960
OS: Windows 10 Pro

User avatar
adamkooo2
Posts: 1309
Joined: 13 Jun 2014, 08:43
Location: Slovakia // Slovensko
Contact:

Re: Open files dialog with replays?

Post by adamkooo2 » 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.
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 :)
/\rkady
Image

User avatar
Florenzius
Translator
Translator
Posts: 2344
Joined: 27 Jul 2014, 20:31
Location: Germany » Saxony » Chemnitz
Contact:

Re: Open files dialog with replays?

Post by Florenzius » 20 Aug 2017, 16:38

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.
Hardware specs:
MB: MB AM3+ 970 Gigabyte GA-970A-DS3P
RAM: 16GB DDR3
CPU: AMD FX-8320E Enlight-Core
GPU: Nvidia GeForce GTX 960
OS: Windows 10 Pro

Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest