Author Topic: Loading ".hfl" files.  (Read 1363 times)

Im wondering if there is a way to load .hfl files from a GuiTextList and then display them on a GUIMLTextControl? Like the f1 help menu does?

According to this garage games forum post, "An HFL is a plain text file that has an HFL extension. The formatting is for the GuiMLTextCtrl. There is nothing special about this file format. It's no more a unique format than it is a unique format when I rename script files to things like 'alien.avatar.'"

So yeah, it's perfectly possible.

Code: [Select]
%fo = new fileObject();
%fo.openForRead("Add-Ons/My_AddOn/myHFL.hfl");
while(!%fo.isEOF())
    %aggregateText = %aggregateText @ "\n" @ %fo.readLine();
%fo.close();
%fo.delete();
MyGuiMLTextCtrl.setValue(trim(%aggregateText));

How would i display this on a text control when the corresponding %list.addRow(num, "name"); is selected?

GuiMLTextControl is distinct from the GuiTextList control. As far as I know, there's no way to combine them. You may be able to overlay a multi-rowed text list with no values over the GuiMLTextControl and use it to simulate clicking on a row in the GuiMLTextControl, then use %list.getSelectedRow() along with an array on the GuiMLTextCtrl to get the selected text.

Can't i just call a function which loads the text onto theMLTextcontroller when i press a row?

But thanks for your help, very appreciated!

Or is there even a way to use listed rows as buttons like function ButtonPush()?