Tutorial : Create a custom menu and Custom Interface Key (WIP)
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Thank you very much for the tutorial.
Just created my first menu system.
Just created my first menu system.
Android Software Engineer
Try my hands-free notification reader for your car.
Try my hands-free notification reader for your car.
I have a quick question about the xml file. I have been trying to create my own simple version of LV's menu to start off with, but it seems that the game won't recognize the xml file. I'm basing this on the fact that I cannot see the command in the list of commands when I'm working on my setup script.
The file name is 8829-L044.xml (I am assuming this is the new format for xml files; the MSCI handbook and Cycrow's tutorials reference a nn####.xml format). Here are its contents:
Can anyone see something that stands out as being wrong? I cannot get MY_FIRST_MENU to show up. Is the number 8829 reserved for something (seems pretty improbable)? I thought that 7000-9000 for the text file id were ok.
Thanks for the help!
The file name is 8829-L044.xml (I am assuming this is the new format for xml files; the MSCI handbook and Cycrow's tutorials reference a nn####.xml format). Here are its contents:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<language id="44">
<page id="2008" title="Script Object Commands" descr="">
<t id="1309">MY_FIRST_MENU</t>
</page>
<page id="2010" title="Script Cmd Names" descr="">
<t id="1309">My First Menu</t>
</page>
<page id="2011" title="Script Cmd Shorts" descr="">
<t id="1309">MFM</t>
</page>
<page descr='' id='8829' title='MyFirstMenu'>
<t id="1">This is the main menu Header</t>
<t id="2">Hello, hopefully this is the sub-header</t>
<t id="3">Menu Option 1</t>
<t id="4">Hello World</t>
</page>
</language>
Thanks for the help!
You have to name the T file like '8829-L044.xml'.tank29 wrote:Ok, well things are working when I label the xml file 448829.xml. Can someone explain why LV's file nomenclature works for his, but not mine?
The first part is the page number.
The L044 if for the language type.
Also I saw in the post before:
Code: Select all
<page descr='' id='8829' title='MyFirstMenu'>
Code: Select all
<page id='8829' title='MyFirstMenu' descr="">
XDrake
-------------------------------------------------------
NECORE Inc.
-------------------------------------------------------
NECORE Inc.
upload your work
8829 is not used that i know of but i did request that 8800-50 were left to cater for my imperial needs, that said i have not used 8829 yet so you can run with it
8829 is not used that i know of but i did request that 8800-50 were left to cater for my imperial needs, that said i have not used 8829 yet so you can run with it
LV's TC Scripts
Readme's For All My Scripts
I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced
si tacuisses, philosophus mansisses
Readme's For All My Scripts
I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced
si tacuisses, philosophus mansisses
MY_FIRST_MENU will be the new of the command within the script editor, i assume thats where you are looking for it ?tank29 wrote:I have a quick question about the xml file. I have been trying to create my own simple version of LV's menu to start off with, but it seems that the game won't recognize the xml file. I'm basing this on the fact that I cannot see the command in the list of commands when I'm working on my setup script.
The file name is 8829-L044.xml (I am assuming this is the new format for xml files; the MSCI handbook and Cycrow's tutorials reference a nn####.xml format). Here are its contents:Can anyone see something that stands out as being wrong? I cannot get MY_FIRST_MENU to show up. Is the number 8829 reserved for something (seems pretty improbable)? I thought that 7000-9000 for the text file id were ok.Code: Select all
<?xml version="1.0" encoding="UTF-8" ?> <language id="44"> <page id="2008" title="Script Object Commands" descr=""> <t id="1309">MY_FIRST_MENU</t> </page> <page id="2010" title="Script Cmd Names" descr=""> <t id="1309">My First Menu</t> </page> <page id="2011" title="Script Cmd Shorts" descr=""> <t id="1309">MFM</t> </page> <page descr='' id='8829' title='MyFirstMenu'> <t id="1">This is the main menu Header</t> <t id="2">Hello, hopefully this is the sub-header</t> <t id="3">Menu Option 1</t> <t id="4">Hello World</t> </page> </language>
Thanks for the help!
what do you have in the commands list, do you have any readtexts or anything ?
it could be serveral things, you might not have registered the command correctly, or not loaded the text file correctly. Without seeing the rest of the scripts it would be impossible to tell where your problem lies
Ok here is the setup script (setup.menu.test):
Here is the main script (a.menu.test.main)
I'll work on getting the actual files uploaded in a bit
Code: Select all
load text: id=8829
add ship custom command: id=1309
set script command upgrade: command= MY_FIRST_MENU upgrade=[TRUE]
global script map: set: key= MY_FIRST_MENU, class= Moveable Ship, race= Player, script= a.menu.test.main, prio=0
return null
Code: Select all
$text = sprintf: pageid= 8829 textid= 2, null, nulll, null, null, null
$menu = create custom menu array: heading= $text
$text = sprintf: pageid= 8829 textid= 3, null, nulll, null, null, null
add custom menu item to array $menu : text= $text returnvalue= $input1
$text = sprintf: pageid= 8829 textid= 4, null, nulll, null, null, null
add custom menu item to array $menu : text= $text returnvalue= $input2
$text = sprintf: pageid= 8829 textid= 1, null, nulll, null, null, null
$return = open custom menu: title= $menu description= $text option array= $menu
What I can see is that you are using the spritnf. This is used to format the text that is read.tank29 wrote:Ok here is the setup script (setup.menu.test):
Code: Select all
$text = sprintf: pageid= 8829 textid= 2, null, nulll, null, null, null $menu = create custom menu array: heading= $text $text = sprintf: pageid= 8829 textid= 3, null, nulll, null, null, null add custom menu item to array $menu : text= $text returnvalue= $input1 $text = sprintf: pageid= 8829 textid= 4, null, nulll, null, null, null add custom menu item to array $menu : text= $text returnvalue= $input2 $text = sprintf: pageid= 8829 textid= 1, null, nulll, null, null, null $return = open custom menu: title= $menu description= $text option array= $menu
You may want to try using:
Code: Select all
$text = read text: page 8829 id=#
This links may help some on what you can do.
http://forum.egosoft.com/viewtopic.php? ... &start=105
http://www.cplusplus.com/reference/clib ... rintf.html
XDrake
-------------------------------------------------------
NECORE Inc.
-------------------------------------------------------
NECORE Inc.
sprintf and read text is actually no different at all. They both do the same formating. The only difference between the 2 commands, is that sprintf will replace the 5 arguments in your text, the first 5 %s that it reads, with the 5 values given in the command.
if you text doesn't have any %s or you set it all the null, then the 2 commands are identical
althou, the simple read text one is usually easier to read
u say MY_FIRST_MENU didn't show up, what exactly did u mean by that, where doesn't it show it ?
its obviously been added, and the text is working, as you have selected it in your setup script
if you text doesn't have any %s or you set it all the null, then the 2 commands are identical
althou, the simple read text one is usually easier to read
u say MY_FIRST_MENU didn't show up, what exactly did u mean by that, where doesn't it show it ?
its obviously been added, and the text is working, as you have selected it in your setup script
Well, I'm not sure what the issue was earlier, but I started completely from scratch and things are working now. Thanks everyone for the help. I'm guessing there was just some sort of syntax error somewhere (this is my first time working with xml).
For the curious, the problem I was having earlier is that when I was trying to select the command MY_FIRST_MENU in the set script command upgrade it wasn't listed. I was pretty wiped out from work yesterday when I transcribed the text of the scripts to the forums, so MY_FIRST_MENU being in those two commands was likely wishful thinking.
Now that that's fixed, I am wondering if there is an explanation somewhere of the menu scripting commands:
Example of #2:
Section 1 Heading (non-selectable)
Menu Option 1 (selectable)
Menu Option 2 (selectable)
(empty line)
Section 2 Heading (non-selectable)
Menu Option 3 (selectable)
For the curious, the problem I was having earlier is that when I was trying to select the command MY_FIRST_MENU in the set script command upgrade it wasn't listed. I was pretty wiped out from work yesterday when I transcribed the text of the scripts to the forums, so MY_FIRST_MENU being in those two commands was likely wishful thinking.
Now that that's fixed, I am wondering if there is an explanation somewhere of the menu scripting commands:
- add custom menu item to array
add custom menu heading to array
add custom menu info line to array
create custom menu array
create custom menu array: heading =
create custom menu array, info lines=
Example of #2:
Section 1 Heading (non-selectable)
Menu Option 1 (selectable)
Menu Option 2 (selectable)
(empty line)
Section 2 Heading (non-selectable)
Menu Option 3 (selectable)
the problem was most likly that u never ran the script first. You see, before the command appears, you need to run the command to add it.
so the next time you tryed from scratch, you most likly had it run first, ie from the previous attempt, so it was for you to use.
as for the menu commands, they do pretty much what they say. Menus are basically arrays of all the entries. The 3 add commands add the items into the menu array.
The create commands create the initial menu array. the create array: heading, is the same as doing, create menu, followed by add heading, same with the infoline.
for what you want, you need to add headings.
you cant really add an empty line
so the next time you tryed from scratch, you most likly had it run first, ie from the previous attempt, so it was for you to use.
as for the menu commands, they do pretty much what they say. Menus are basically arrays of all the entries. The 3 add commands add the items into the menu array.
The create commands create the initial menu array. the create array: heading, is the same as doing, create menu, followed by add heading, same with the infoline.
for what you want, you need to add headings.
Code: Select all
$menu = create custom menu array: heading = "section 1 heading"
add custom menu item to array: $menu, "Menu Option 1"
add custom menu item to array: $menu, "Menu Option 2"
add custom menu heading to arrya: $menu, "Section 2 heading"
add custom menu item to array: $menu, "Menu Option 3"
Ahh, thanks for the clarification on the menu. I had read many people say that a menu is just an array, but it didn't really click until just now. The add menu heading command is just a different type of data value in the array, as opposed to the command that creates a selectable option (again, just a different type of data in the array).
Thanks for the help!
One last question: When I select either my custom menu or LV's, autopilot tries to start (both from a mouse click selection of the menu or enter key). Has anyone come across this before?
Thanks for the help!
One last question: When I select either my custom menu or LV's, autopilot tries to start (both from a mouse click selection of the menu or enter key). Has anyone come across this before?
where are you running the menu from, i assume from the command console ?
if you set the command on the ship, then when the script is run, it will enable the autopilot. If all your doing is running a menu, there are several things you can do.
the first is to not set the command name for the script then just display the menu.
or you can set up a preload. The preload can then display the menu, then you simply dont return anything, and the command console will never actually be run. Allowing you to have a menu do what ever you want without preventing existing commands on the ship
if you set the command on the ship, then when the script is run, it will enable the autopilot. If all your doing is running a menu, there are several things you can do.
the first is to not set the command name for the script then just display the menu.
or you can set up a preload. The preload can then display the menu, then you simply dont return anything, and the command console will never actually be run. Allowing you to have a menu do what ever you want without preventing existing commands on the ship
Hey dudes!
What would you recommend for a menu that is designed only to show information? For example, say you have a main menu with a bunch of options. Clicking on one of those options pops up another menu that's really only supposed to display information until you hit esc. What would you dudes do for this?
- Infolines aren't long enough for a lot of data (and scrolling only works with the mouse)
- A list of menu items are selectable, and the info isn't really supposed to be.
Any ideas?
What would you recommend for a menu that is designed only to show information? For example, say you have a main menu with a bunch of options. Clicking on one of those options pops up another menu that's really only supposed to display information until you hit esc. What would you dudes do for this?
- Infolines aren't long enough for a lot of data (and scrolling only works with the mouse)
- A list of menu items are selectable, and the info isn't really supposed to be.
Any ideas?
set the hotkey
remove the hotkey
I'm calling the hotkey text from a tfile here but you can just type if in if you want.
Code: Select all
019 |$key = get global variable: name='lv.dai.hk'
020 |if $key == null
021 ||$txt = sprintf: pageid=8840 textid=1, null, null, null, null, null
022 ||$id = register hotkey $txt to call script 'plugin.lv.drone.ai.interface'
023 ||set global variable: name='lv.dai.hk' value=$id
024 |end
Code: Select all
008 |$key = get global variable: name='lv.dai.hk'
009 |if $key != null
010 ||unregister hotkey $key
011 ||set global variable: name='lv.dai.hk' value=null
012 |end
LV's TC Scripts
Readme's For All My Scripts
I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced
si tacuisses, philosophus mansisses
Readme's For All My Scripts
I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced
si tacuisses, philosophus mansisses
hey guys. i keep getting a readtext2010-558 as my menu title in special commands. as far as i can tell everything is correct but i guess i must be missing something. first attempt at a menu here so um yeah... also. after the script is run to open the menu the first time it just pops up on me when im not even in the area to select the menu option. or even out of nowhere every few seconds when i have no menus open. anything you guys can think imm messin up here. i installed the tutorial scripts and pretty much just made a copy of them and am editing them and removing the unwanted menu options although i havent gotten that far yet so ptretty much its almost a ful copy of the tutorial scripts under different names except for some minor editing to get them to run for testing.