Jump to content

How to quickly locate code for menu/unit from within the game?


Recommended Posts

Unfortunately no, as far as I know.

It would be great to have an "Inspect" functionality, like the one present on most browsers. Maybe it is worth to considered it as a long-term addition to the game. This would make the game more attractive to modders and facilitate the development of mods/features/patches.

@Stan` what do you think?

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 12/02/2023 at 11:38 AM, Ceres said:

Hello!

Is it possible to get a link/path to the code that is responsible for an item (menu, unit) clicked on, e.g. in the console?

Thus, one could find the right place in the code quicker if interested in e.g. a menu structure.

No but you can use the somewhat updated doc on https://docs.wildfiregames.com/javascript/gui/

19 minutes ago, Mentula said:

It would be great to have an "Inspect" functionality, like the one present on most browsers. Maybe it is worth to considered it as a long-term addition to the game. This would make the game more attractive to modders and facilitate the development of mods/features/patches.

@Stan` what do you think?

It would be nice indeed, but that's very low priority, if it's even possible.

  • Thanks 1
Link to comment
Share on other sites

@Stan`

Is there a debugging function showing in the console the (local) player's interaction with the user interface? If yes, then maybe that information would already help non-experts to find the right area for the code. I could try and check but don't know how to properly enable a debugging mode.

Link to comment
Share on other sites

  • 3 months later...

What I might do is look at some text in the GUI that appears over the item, then run a recursive grep for that text in the source tree that I have checked out from svn. I find the following bash function useful.

function codegrep () {     
    find ${2:-.} -regex '.*\.cpp\|.*\.h\|.*\.hpp\|.*\.js' -exec grep "${1}" '{}' +
}

You can also look in xml files for menus and stuff (just add |.*\.xml to the regex), though that will take a lot longer. And if you know the ancestor directory, such as source/ for cpp or binaries/data/mods/public for javascript and xml, that will also speed it up a lot.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...