Text lines for AI command states

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

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

solntcev
Posts: 357
Joined: Thu, 27. Jun 13, 18:33
x4

Text lines for AI command states

Post by solntcev »

Hello,

I am writing set of scripts for parsing save file and analyzing economy and ship statuses. As part of this I want to know where I can find which action represented by which line in text resources.

for example I think "commandaction.docking" is displayed in ship info as "Docking"
<page id="1011" title="AI Commands" descr="0" voice="no">
<t id="1008">Docking</t>

Where can I find all commands mapping to text?
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

shouldnt they be referenced in the {Text-Id,PageID} format, like for your example {1011,1008} ?
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
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13489
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Text lines for AI command states

Post by euclid »

Hi solntcev :-)
solntcev wrote: ........
Where can I find all commands mapping to text?
The pid 1011 covers all those commands. I'm not sure what else you are looking for.

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
solntcev
Posts: 357
Joined: Thu, 27. Jun 13, 18:33
x4

Re: Text lines for AI command states

Post by solntcev »

UniTrader wrote:shouldnt they be referenced in the {Text-Id,PageID} format, like for your example {1011,1008} ?
I have not found references to 1011 lines in this format in game XML files.
But somewhere they listed, because in game UI, they are translated.
euclid wrote: The pid 1011 covers all those commands. I'm not sure what else you are looking for.
Yes, it covers, but I want fo find mapping table for "command" -> "1011 text line". I don't want to make it manually, in case new commands will appear in future updates.
But I suspect it may be hardcoded in game exe file :(
lubatomy
Posts: 236
Joined: Mon, 29. Dec 03, 15:22
x4

Post by lubatomy »

the mapping is the t-file.

if new ones get added, they show up in the t file

game engine only knows that if it sees "{xxxx,yyyy}" that it must go to t-file and find page-id xxxx and look for t-id yyyy under that and display the relevant text.
solntcev
Posts: 357
Joined: Thu, 27. Jun 13, 18:33
x4

Post by solntcev »

Yes, but where exactly can I find, that "command.explore" action is displayed as {1011,27} in UI?

Where I can find list of ALL actions and their text lines?
User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg »

Commands are set using:

Code: Select all

<set_command command="command.freetrade" />
<set_command_action commandaction="commandaction.searchingtrades" />
As far as I know the t file interpretations are used exclusively in the UI as only the UI can display text that is meaningful to the player. The command status of a ship relates to its controlling npc and operates as a stack, so you will find code in the UI Lua files (now available as source in 3.50 b1) such as:

Code: Select all

-- Get userdata values for command stack from npc		
local aicommandstack, aicommand, aicommandparam, aicommandaction, aicommandactionparam = GetComponentData(npc_id, "aicommandstack", "aicommand", "aicommandparam", "aicommandaction", "aicommandactionparam")
local numaicommands = #aicommandstack
	if 0 < numaicommands then
		aicommand = aicommandstack[1].command
		aicommandparam = aicommandstack[1].param
	end
updatetext = tostring(updatetext .. "" .. ReadText(1001, 78) .. 
							ReadText(1001, 120) .. " " ..  
							string.format(aicommand, (IsComponentClass(aicommandparam, "component") and GetComponentData(aicommandparam, "name")) or nil))
if 1 < numaicommands then
	aicommandaction = aicommandstack[numaicommands].command
	aicommandactionparam = aicommandstack[numaicommands].param
end

if aicommandaction ~= "" then
	updatetext = tostring(updatetext .. " - " .. string.format(aicommandaction, (IsComponentClass(aicommandactionparam, "component") and GetComponentData(aicommandactionparam, "name")) or nil))
end
as an example of how to parse the command data and format it into a variable called "updatetext".
You can then write the variable into a cell in the UI or to the log book/debug log.

If you just want to set the command or know what the ship is doing in an AI script then the set_command, set_command_action functions and the command.action lookup properties for each npc commander are what you need - you can find all of these documented in /libraries/aiscripts.xsd. and scriptproperties.html in the root game folder.

Keep in mind also that you cannot display anything in the UI directly from AI scripts unless you write a UI (Lua) script that parses the data and writes it to a widget in the UI. The exception to this is that you can write directly to the logbook and also place help messages on the centre of the screen.

Hope this helps
Wysi :)
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

solntcev wrote:Yes, but where exactly can I find, that "command.explore" action is displayed as {1011,27} in UI?

Where I can find list of ALL actions and their text lines?
Look in libraries/aiscripts.xsd for

Code: Select all

<xs:simpleType name="commandlookup">
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

Return to “X Rebirth - Scripts and Modding”