hidden ffi.C functions?

The place to discuss scripting and game modifications for X4: Foundations.

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

h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

hidden ffi.C functions?

Post by h2o.Ava »

anyone know what the hidden ffi.C functions do?

for example, what does ffi.C.SellPlayerShip do?

some assume that it recycles the ship and gives all the resources to the buying faction. but nothing in the code actually suggests that.

would love to see all the code for these hidden functions
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13480
Joined: Sun, 15. Feb 04, 20:12
x4

Re: hidden ffi.C functions?

Post by euclid »

It's not really "hidden" if you check the UI folder where it's used frequently. I'm not that much into UI modding but think it's a Foreign function interface between the lua and C.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Re: hidden ffi.C functions?

Post by h2o.Ava »

some are. for example:

ui\addons\ego_detailmonitor\menu_map.lua:
C.SellPlayerShip(data[1], menu.contextMenuData.shipyard)

the function C.SellPlayerShip isn't defined in the publicly available lua files. it's imported from ffi.C which i believe is hidden within the .exe's lua files.


wait, there are c files? imma go find them if so.

edit: tried extracting all files *.*c* but couldn't find any cpp or .c files
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13480
Joined: Sun, 15. Feb 04, 20:12
x4

Re: hidden ffi.C functions?

Post by euclid »

If you're using something like AstroGrep then search for lua files which contain ffi. That provides many examples on how to use it.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Re: hidden ffi.C functions?

Post by h2o.Ava »

Thanks ^^
yeah, i use notepad++ to find all instances of things i'm curious about within all files within a parent and its children directories.

i did find out that c.sellplayership adds the command.recycle to ships, i'm not sure if it is actually using the recycle aiscript tho.

would love to see the definitions of ffi.C.functions

would the devs be willing to release those/add them to the lua section of the wiki?

Return to “X4: Foundations - Scripts and Modding”