[MOD] Tactical Map

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

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

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Thu, 4. Jan 18, 16:21

Great mod!
You should upload it on Steam, so more people benefit from your work.

I also foind lots of these in my log

Code: Select all

[=ERROR=] 96573.35 Widget system error. Dimensions for button are too small. Button elements will overlap eachother. Dimensions are: width(91 px) height(21 px) - minimum dimensions for this button is 23 px
Coudl they be from your mod?

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Sat, 6. Jan 18, 13:55

Hi again - sorry for the period of absence. I don't plan on any big features in the near future, but I should definitely be making sure this still works!

The mod now has a Github repository you can use to browse the code or make comments!
MakerLinux wrote:
lostboron wrote:This looks like a great mod, but sadly it doesn't work on Linux. To make it work, you would need to change all the file names to lowercase (a bug in XR prevents mods from working if any file uses an uppercase character). But even after changing all the file names, I still had some issues:
- when I click on "details" for a ship and I go back, the map does not reappear and I can't issue any command, so I have to quit
- buttons on the lower row of commands (patrol, transfer, attack object) do not do anything (they don't have an orange background, but they don't seem disabled)
I hope these issues can be fixed eventually, but I don't know how you could debug them without using Linux...

There is also an issue with French: the button texts are too long, so button texts overlap - if they can't be trunctated automatically, I guess we would have to provide abbreviated translations.
Thaaanks, man! I also use Linux and I didn't know why it would not work! Now I understand. Do you think this mod is worth it in Linux in its current state or it is fruitless because of the map not reappearing?

One big flaw I see on X Rebirth's regular maps is that it does not show coordinates. Roguey's X Rebirth maps have coordinates in them, how could I use them if I can't access this information? That would save me a lot of wandering around in Toride/Koroni. I even tried to get it via mod but the variable player.primaryship.position has coordinates relatives to zone, whilst roguey's are relative to the whole sector.

Update: one way to help debugging them - Linux or not - is right-clicking on X Rebirth in steam, clicking properties, launch options and adding -debug all -logfile debug.log (I also add -skipintro but that's me). Then you can check the file ~/.config/EgoSoft/X Rebirth/96679891/debug.log for messages saying what's wrong (but they are not very useful in my experience, being generic xml error messages).

update 2: thanks to your first attempt, I think I got it working. Instead of just renaming every file to lowercase, I soft-linked every file which had capital letters on it to lowercase, e.g.

Code: Select all

ln -s 0001-L049.xml 0001-l049.xml
and

Code: Select all

ln -s MEJ_TacticalMap_Menu.xml mej_tacticalmap_menu.xml
. I tested selecting a lot of objects, asking for details and getting back, and the map reappeared in every case. However, I could not get my units to attack enemies by using the attack button, I am not sure if I did not understand how I am supposed to do it, or it it's a bug. Anyway, apart from that the mod seems to be behaving perfectly, the orange buttons perform their actions.
Thanks for reporting - I didn't test for Linux compatibility at all up to this point. I remember there was a handy guide for modders on the forum, but I can't seem to find it yet. Is it just those two files you had to make the symbolic links for? That idea's very clever, by the way, and it sounds like a good candidate for a Python script to do it automatically.

Any situation where a menu was supposed to open (including from another menu) but instead there's no menu and the controls are disabled, this is when the menu's code had an error and failed to open, but the game is still in a kind of menu mode. If you have the debug console bound, you can do a "RELOADUI" as a workaround.

I do see your point about the coordinates, and I'll try to fit them in over the holomap - the caveat is you can query the coordinates under the cursor (relative to the current space) but it's always something on the ecliptic plane, ie the y-coordinate is always zero.

About the attack command, the workflow generally is to select one or more friendly ships, and left click on the grid button, when the text should turn orange. Then you right-click the target ship in the holomap to issue the order. If that's what you're doing, see if you can spot any debug output or cases where it does/doesn't work, and I'll look into it.
oliverjanda wrote:Great mod!
You should upload it on Steam, so more people benefit from your work.

I also foind lots of these in my log

Code: Select all

[=ERROR=] 96573.35 Widget system error. Dimensions for button are too small. Button elements will overlap eachother. Dimensions are: width(91 px) height(21 px) - minimum dimensions for this button is 23 px
Coudl they be from your mod?
Thanks! I want to do that soonish - preferably once it's known to work on Linux out of the box, and nothing else is broken.

The debug output is almost certainly from this, as it happens to me when I switch to small HUD menus. It doesn't seem to break anything, but I think when using small HUD menus the buttons are just too small, and the UI system complains about it. I might try to do a special display mode for small HUD menu setting

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Mon, 8. Jan 18, 10:11

Thanks! I might just use the large HUD until then because I try to keep track of any errors in my log and this is causing many. :)

Is it possible to post a short example on how to add a command to the map?

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Mon, 8. Jan 18, 22:45

I found out the issue not between large and small menu but between sidemenu and hud menu

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Thu, 18. Jan 18, 17:10

What's your screen resolution? I think maybe screen resolution and UI settings both have an impact on whether you end up with this error.

For the short example, good idea, I've written something up on the Github :) hopefully it's short enough, but it's all stuff I thought worth explaining.

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Fri, 19. Jan 18, 11:10

I think its 1680 × 1050 (I'm not at home right now)

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Mon, 22. Jan 18, 09:26

And would it be possible to bind Galaxy map to ; and System map to : ?

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Tue, 23. Jan 18, 21:05

On now I found an annoying bug :(
You cant skip the 10 min cooldown after a jump (by using jumpdrive coolant) because the "jump" button is greyed out.

Fixed it by:

Code: Select all

        if hasJumpdrive then
            if nextJumpTime > GetCurTime() then
                text = menu.text.jump
                enabled = not onPlatform

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Fri, 26. Jan 18, 18:43

Thanks, sorry about that, I never got round to implementing jumpdrive coolant support. I've made a simple change, similar to yours, which hopefully will fix it.

As for the hotkeys, I see you got responses from the real modding gurus ;) but I too sorely wish there was hotkey support in XR.

I've been testing a low-res mode that gets rid of the debug log spam on my end. The text is just a tad smaller in low-res mode than in the vanilla map. But using small HUD menus previously I had to squint at the text, and it's easier on the eyes now.

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Fri, 26. Jan 18, 19:35

That's great news! I hope you publish it soon.

I'm working on adding some commands but didnt have much success with "follow me (again)"

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Sat, 3. Feb 18, 12:41

tried it but the details windows doesnt show up anymore :(

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Sun, 4. Feb 18, 02:14

Feel free to post the code you're using for your command, in case I can help!

I'm happy to see you're checking the Git repo ;) but it's not strictly meant to be used yet. It should work fine if you go to menu.objectDetails, uncomment the line with "gMain_object_closeup", and comment out the one with "MeJ_OpenObjectMenu".

oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda » Sun, 4. Feb 18, 11:11

I rolled back to my version. I'll wait until you put it on nexus then.

I mangaged to get my command working as a sidebar command.
I wouldn'T mid having it in the map too. as well leave/join squad and such

ns88ns
Posts: 90
Joined: Sun, 11. Sep 11, 22:00
x4

Post by ns88ns » Thu, 22. Mar 18, 00:53

Is this mod compatible with XR v4.30? It seems it doesn't work properly with 4.30. Could you please let me know?

Thank you.

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Fri, 23. Mar 18, 07:28

Hi, sorry for the long hiatus - I've hit a snag with getting initially selected rows+columns to work, but everything else is fine. If you don't rely on gamepad, or arrow keys on the keyboard, to navigate, you won't notice any difference besides occasional debug output. I'll upload it anyway so you can use the low-res mode.

I agree about the new commands, will add them quickly to the vanilla commands. The only caveat is add/leave squad won't have instant feedback - it'll show when the menu next refreshes.
ns88ns wrote:Is this mod compatible with XR v4.30? It seems it doesn't work properly with 4.30. Could you please let me know?

Thank you.
I'm on 4.30 myself, and on my end it works OK. Could you post what happens when you try to open the menu, and share any debug output that might be relevant?

ns88ns
Posts: 90
Joined: Sun, 11. Sep 11, 22:00
x4

Post by ns88ns » Sun, 25. Mar 18, 06:54

It is OK. I have found the issue.

Your mod conflicts with an other mod named "Jump to XYZ" (link to Steam). Or vice versa :-)

Andy_MB
Posts: 72
Joined: Fri, 24. Jul 15, 17:47
x4

Post by Andy_MB » Sun, 25. Mar 18, 12:01

The compatibility problem is that we use the same resource to make changes:

Code: Select all

<diff>
    <replace sel="//cue[@name='SectionHandler_Nav']/actions//open_conversation_menu[@menu='MapMenu']">
        <do_all>
            <do_if value="@event.param3 != null and (not event.param3.{1})">
                <set_value name="$hasMode" exact="@event.param3.{7} != null" />
            </do_if>
            <do_else>
                <set_value name="$hasMode" exact="@event.param2.{7} != null" />
            </do_else>
            <!-- <debug_text text="'Opening map - has mode = ' + $hasMode" filter="general" /> -->
            <do_if value="$hasMode">
                <open_conversation_menu menu="MapMenu" param="event.param2" param2="event.param3" />
            </do_if>
            <do_else>
                <open_conversation_menu menu="MeJ_TacticalMapMenu" param="event.param2" param2="event.param3" />
            </do_else>
        </do_all>
    </replace>
    
    <replace sel="//cue[@name='SectorMapStarted']/actions/do_if/open_conversation_menu[@menu='MapMenu']/@menu">MeJ_TacticalMapMenu</replace>
    <replace sel="//cue[@name='SectorMapStarted']/actions/do_else/do_if/open_conversation_menu[@menu='MapMenu']/@menu">MeJ_TacticalMapMenu</replace>
    <replace sel="//cue[@name='SectorMapStarted']/actions/do_else/do_else/open_conversation_menu[@menu='MapMenu']/@menu">MeJ_TacticalMapMenu</replace>
    
    <replace sel="//cue[@name='ZoneMapStarted']/actions/do_if/open_conversation_menu[@menu='MapMenu']/@menu">MeJ_TacticalMapMenu</replace>
    <replace sel="//cue[@name='ZoneMapStarted']/actions/do_else/do_if/open_conversation_menu[@menu='MapMenu']/@menu">MeJ_TacticalMapMenu</replace>
    <replace sel="//cue[@name='ZoneMapStarted']/actions/do_else/do_else/open_conversation_menu[@menu='MapMenu']/@menu">MeJ_TacticalMapMenu</replace>
</diff>
my changes is same:

Code: Select all

<diff>
  <replace sel="/mdscript/cues/cue[@name='SectionHandler_Nav']/actions/do_elseif/open_conversation_menu[@menu='MapMenu']">
      <open_conversation_menu menu="MapMenu1" param="event.param2" param2="event.param3" />
  </replace>
 
    
  <replace sel="/mdscript/cues/cue[@name='SectorMapStarted']/actions/do_if/open_conversation_menu[@menu='MapMenu']">
      <open_conversation_menu menu="MapMenu1" param="event.param2" param2="event.param3" />
  </replace>
  <replace sel="/mdscript/cues/cue[@name='SectorMapStarted']/actions/do_else/do_if[@value='player.primaryship.sector.exists']/open_conversation_menu[@menu='MapMenu']">
    <open_conversation_menu menu="MapMenu1" param="[0, 0, 'sector', player.primaryship.sector, null, player.primaryship.zone]" />
  </replace>
  <replace sel="/mdscript/cues/cue[@name='SectorMapStarted']/actions/do_else/do_else/open_conversation_menu[@menu='MapMenu']">
    <open_conversation_menu menu="MapMenu1" param="[0, 0, 'cluster', player.primaryship.cluster]" />
  </replace>
  <replace sel="/mdscript/cues/cue[@name='ZoneMapStarted']/actions/do_if/open_conversation_menu[@menu='MapMenu']">
      <open_conversation_menu menu="MapMenu1" param="event.param2" param2="event.param3" />
  </replace>
  <replace sel="/mdscript/cues/cue[@name='ZoneMapStarted']/actions/do_else/do_if[@value='player.primaryship.sector.exists']/open_conversation_menu[@menu='MapMenu']">
    <open_conversation_menu menu="MapMenu1" param="[0, 0, 'zone', player.primaryship.zone]" />
  </replace>
  <replace sel="/mdscript/cues/cue[@name='ZoneMapStarted']/actions/do_else/do_else/open_conversation_menu[@menu='MapMenu']">
    <open_conversation_menu menu="MapMenu1" param="[0, 0, 'cluster', player.primaryship.cluster]" />
  </replace>

  <add sel="/mdscript/cues/cue[@name='SectionHandler_Nav']/actions/do_if" > <!--pos="after"-->
    <add_player_choice_sub text="{1005,227}" position="right" section="gAMB_JD_XYZ" choiceparam="[0, 0]" tooltip="{98981,6227}" comment="Вызвать cue name AMB_MainMenu_JD_Button"/>
  </add>  

</diff>
If you can refuse to use the hotkey, then you can solve the compatibility issue by adding a key to the main menu.
For example *.lua :

Code: Select all

local destination = "XYZ"
local menuAddon2 = {
    entry = {
        section = "gAMB_JD_XYZ", -- Your section
        icon = "mm_ic_navig_zonemap",
        name = ReadText(1001, 3218), -- Your text
        sectionparam = {
            0,
            0
        },
        info = string.format(ReadText(1015, 156), destination), -- Your text
    }
}

local function createSetupJD_XYZ(menu)  -- new function name = MeJ_TacticalMapMenu(menu)
   for _, subMenu in ipairs(menu.setup.top) do
        if subMenu.icon == "mm_ic_navig" then
            table.insert(subMenu.list, menuAddon2.entry)
        end
    end
end

local function createSetupWrapper()
    menuAddon2.origCreateSetup()
    createSetupJD_XYZ(menuAddon2.menu)
end

local function init()
	if Menus then
		for _, menu in ipairs(Menus) do
            if menu.name == "MainMenu" then
                menuAddon2.menu = menu
                menuAddon2.origCreateSetup = menu.createSetup
                menu.createSetup = createSetupWrapper
                break
            end
		end
	end
end

init()
_____________

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Mon, 26. Mar 18, 19:33

Ah, I see, thanks Andy for the detailed post :) I have the code for creating the jump button as its own method, so I might be able to offer another possible solution soon.

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Fri, 30. Mar 18, 17:48

To gauge interest - how many people like the search box on the vanilla map, and want it to return in the tactical map?

I have been experimenting with edit boxes, and I have an idea for a nifty feature that might make navigation easier. But I thought I'd ask before spending too much time on it.

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Sun, 8. Apr 18, 00:07

Sorry for the late reply - I personally don't use the vanilla search box.

Mainly because it only works on downwards (e.g. from a Sector map the search function won't find other Sectors in the same System, or anything in other Systems) and I'm often wanting to find an object somewhere else.

If that vanilla limitation was removed, the search function would probably be better. Unfortunately I cannot remember why the limitation was implemented. Maybe there's a good reason I can't think of.

Post Reply

Return to “X Rebirth - Scripts and Modding”