Issue using lua code to add menu entries

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Issue using lua code to add menu entries

Post by wysiwyg »

Hi folks - just a quick technical question related to using *.lua files to add and modify the sidebar and detailmonitor. I'm fairly new to modding so most of what I've tried so far has been copying what other modders have done.

So, I create a .lua file and place it in the .\ui\addons\mainmenu folder along with a .xml file that looks like:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <add sel="/addon[@name='mainmenu']/dependency" pos="before">
    <file name="mainmenu_mt_mymenu.lua" />
  </add>
</diff>
Now when I run the mod I'm getting debug output that says the file i/o can't find the 'mainmenu_mt_mymenu.lua' file.

However, when I add the lua file into a .cat file called subst_01.cat and the xml file into ext_01.cat (how mods are packaged for the workshop) everything works just fine.

Is there a way I can work on the mod without having to keep adding the updated files to a catalog?

Cheers
Wysi :)
Phipsz
Posts: 335
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz »

You only have to add the .lua to the catalog for testing, at least that worked for me so far :) but yeah, it's a bit annoying to have to put the lua into the catalog all the time, makes testing a really lengthy task...
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

you dont need t do that at all. For testing the lua can live in the same directory tree from the XR root dir. You only put it in subst_01 for releasing :)
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

alternatively put your test files directly into the XR root folder instead of your extension and add « -prefersinglefiles » to the startup parameters of XR ;) but i discourage using this method for release versions of Mods ^^
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg »

Nice one folks - thanks for the help

Wysi :)
bm01
Posts: 421
Joined: Wed, 22. Jul 09, 22:31
x4

Post by bm01 »

For my mod I did that:
<file name="../../../extensions/Automated_Emergency_Jump/ui/addons/mainmenu/Automated_Emergency_Jump.lua"/>
Seems to work even in the .cat file, nobody told me it doesn't :p

Return to “X Rebirth - Scripts and Modding”