Moding qwestion warehouse features / <interrupts> / hot keys
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
When i enabele debugchance and load the game
log is:
...the first time I see such errors
and no one message:
AI conditions check
But! in loogbook was appeared one string:
"abort transfer ship: Titurel /t"
but should be 15 pcs!
Some proress!
log is:
Code: Select all
[General] 18411.75 ======================================
[=ERROR=] 18411.75 [InputMapper::AddContextRequest] There is already a ContextRequest for Context INPUT_CONTEXT_COMM_ACTION, Requester INPUT_CONTEXT_REQUESTER_PLAYERCONTROLLER, priority 10
[General] 18411.75 ======================================
[General] 18411.75 ======================================
[=ERROR=] 18411.75 [InputMapper::AddContextRequest] There is already a ContextRequest for Context INPUT_CONTEXT_INFO_ACTION, Requester INPUT_CONTEXT_REQUESTER_PLAYERCONTROLLER, priority 10
[General] 18411.75 ======================================
...
General] 18404.63 ======================================
[=ERROR=] 18404.63 Error on AI director import: Script 'transfer.performplayertraderun' with temp ID 6190 is not compatible with caller context trade.findandexecutestationtrade on entity 0x62b2f
[General] 18404.63 ======================================
[General] 18404.63 ======================================
[=ERROR=] 18404.63 Error on AI director import: Invalid blocking action index 2 for context trade.findandexecutestationtrade on entity 0x62ae0
[General] 18404.63 ======================================
and no one message:
AI conditions check
But! in loogbook was appeared one string:
"abort transfer ship: Titurel /t"
but should be 15 pcs!
Code: Select all
<interrupts>
<handler ref="TargetInvalidHandler" />
<handler ref="AttackHandler" />
<handler ref="ScannedHandler" />
<handler>
<conditions>
<event_object_signalled object="this.ship" param="'updated'" />
<debug_text text="'AI conditions check'"/>
</conditions>
<actions>
<write_to_logbook category="squad" text="'abort transfer ship: %1'.[this.ship.name]" />
<abort_called_scripts resume="check existing warehouses" />
</actions>
</handler>
</interrupts>
_____________
i'm pretty sure you can also write_to_logbook in conditions if you're more comfortable with that.
[=ERROR=] 18404.63 Error on AI director import: Invalid blocking action index 2 for context trade.findandexecutestationtrade on entity 0x62ae0
could be bad depending on which actual blocking action is invalid and if the script further below that action can handle that action being invalid. (i'm not sure, but i think the blocking action isn't done at all in this case.)
If "AI conditions check" didn't appear in your log at all, then that means no one received your signal. If the corresponding lines for MD appeared in the log, then that means that the signal was sent. Interesting that the logbook line appeared in the logbook, though. Are you sure you don't have that particular logbook entry anywhere else?
Assuming that the signal sender and receiver are both dealing with the same object(s) and parameter(s) (which it looks like they are from your earlier snippet), it appears that your ship wasn't running the script that has the interrupt.
That guess could be supported by this error:
[=ERROR=] 18404.63 Error on AI director import: Script 'transfer.performplayertraderun' with temp ID 6190 is not compatible with caller context trade.findandexecutestationtrade on entity 0x62b2f
if the interrupt is in transfer.performplayertraderun. Think, in that case, that the pilot would go back to running the caller script.
[=ERROR=] 18404.63 Error on AI director import: Invalid blocking action index 2 for context trade.findandexecutestationtrade on entity 0x62ae0
could be bad depending on which actual blocking action is invalid and if the script further below that action can handle that action being invalid. (i'm not sure, but i think the blocking action isn't done at all in this case.)
If "AI conditions check" didn't appear in your log at all, then that means no one received your signal. If the corresponding lines for MD appeared in the log, then that means that the signal was sent. Interesting that the logbook line appeared in the logbook, though. Are you sure you don't have that particular logbook entry anywhere else?
Assuming that the signal sender and receiver are both dealing with the same object(s) and parameter(s) (which it looks like they are from your earlier snippet), it appears that your ship wasn't running the script that has the interrupt.
That guess could be supported by this error:
[=ERROR=] 18404.63 Error on AI director import: Script 'transfer.performplayertraderun' with temp ID 6190 is not compatible with caller context trade.findandexecutestationtrade on entity 0x62b2f
if the interrupt is in transfer.performplayertraderun. Think, in that case, that the pilot would go back to running the caller script.
Many thanks!
I understood a lot. But not all )
1. I checked the condition node for writing notes to the logbook.
does not work - produces an error message:
[=ERROR=] 13739.15 extensions\amb_storage_transfer\aiscripts\trade.findandexecutestationtrade.xml(18): Unknown condition node: 'write_to_logbook'
2.Looking at what these ships are doing, I can say that at the moment there is processing in the called script(transfer.performplayertraderun).
When they do work, all these ships respond to the call!
Do not pass the call only to those ships that are currently idle!
(ship.pilot.command.value = null and ship.pilot.commandaction.value = null or ship.command.value == null)
I assume that a fatal error occurs in the script(transfer.performplayertraderun), which leads to the blocking of the script. I noticed earlier that the ships are idle for an unknown reason. I thought that restarting the calling script can solve this problem.
I understood a lot. But not all )
1. I checked the condition node for writing notes to the logbook.
does not work - produces an error message:
[=ERROR=] 13739.15 extensions\amb_storage_transfer\aiscripts\trade.findandexecutestationtrade.xml(18): Unknown condition node: 'write_to_logbook'
2.Looking at what these ships are doing, I can say that at the moment there is processing in the called script(transfer.performplayertraderun).
When they do work, all these ships respond to the call!
Do not pass the call only to those ships that are currently idle!
(ship.pilot.command.value = null and ship.pilot.commandaction.value = null or ship.command.value == null)
I assume that a fatal error occurs in the script(transfer.performplayertraderun), which leads to the blocking of the script. I noticed earlier that the ships are idle for an unknown reason. I thought that restarting the calling script can solve this problem.
_____________
Ah, now i remember! A list of blocking actions, and (very important!) the order in which those blocking actions are written in each script is kept and, if the order has changed or a new blocking action is inserted, it throws that compatibility error.
Just to be clear: blocking actions are those actions that block the script from continuing past that point for a certain amount of time because the action itself needs some time before it can finish. These are actions such as move_to, wait, jump, etc. The order is important because, when you save a game, the index of the blocking action is saved. So, for example, you have a script with
<wait exact="1ms"/>
<move_to object="this.ship" destination="this.ship.position"/>
<wait exact="1ms"/>
and save the game while the entity is doing the move_to, the game remembers that it was doing that script, is in the second blocking action, and that that action is a move_to. If, upon loading a game, the second blocking action is no longer a move_to, the game plays it safe and throws the entity back to the calling script and lets you know that there was an error.
To maintain compatibility, you could increment the version of the script and add a sinceversion property to the inserted action. So, say for example, we wanted to insert a jump action between the wait and the move_to, the order would now be:
<wait exact="1ms"/>
<jump sinceversion="1"/>
<move_to object="this.ship" destination="this.ship.position"/>
<wait exact="1ms"/>
Upon loading the game would see that the second action changed but that this is a new version of the file so it would assume that you've handled the change.
Anyhow, yes, restarting the calling script should restart the whole thing.
And i apologize if you already know this stuff. i don't know what you know, and i think it's best to be thorough if unsure.
@Uni, where have you gone? You and i both know you know this stuff better than i do.
Just to be clear: blocking actions are those actions that block the script from continuing past that point for a certain amount of time because the action itself needs some time before it can finish. These are actions such as move_to, wait, jump, etc. The order is important because, when you save a game, the index of the blocking action is saved. So, for example, you have a script with
<wait exact="1ms"/>
<move_to object="this.ship" destination="this.ship.position"/>
<wait exact="1ms"/>
and save the game while the entity is doing the move_to, the game remembers that it was doing that script, is in the second blocking action, and that that action is a move_to. If, upon loading a game, the second blocking action is no longer a move_to, the game plays it safe and throws the entity back to the calling script and lets you know that there was an error.
To maintain compatibility, you could increment the version of the script and add a sinceversion property to the inserted action. So, say for example, we wanted to insert a jump action between the wait and the move_to, the order would now be:
<wait exact="1ms"/>
<jump sinceversion="1"/>
<move_to object="this.ship" destination="this.ship.position"/>
<wait exact="1ms"/>
Upon loading the game would see that the second action changed but that this is a new version of the file so it would assume that you've handled the change.
Anyhow, yes, restarting the calling script should restart the whole thing.
Sorry if anything is unclear. Please don't hesitate to ask. i sometimes trip over myself when i get excited.Andy_MB wrote:I understood a lot. But not all )
And i apologize if you already know this stuff. i don't know what you know, and i think it's best to be thorough if unsure.
@Uni, where have you gone? You and i both know you know this stuff better than i do.
Thank you! Now I understand much more! )
I'll go and try ...
ps:
And, @Uni just knows too much! )
2 years ago he said that he can catch pressing specific buttons bypassing gameoptions.lua In that time i tried to add a button to the gameoptions.ua , but nothing happened.
gameoptions.lua forbidden to change.
I wanted to catch the push of "Shift + J" for an emergency jump in my MOD.
I'll go and try ...
ps:
And, @Uni just knows too much! )
2 years ago he said that he can catch pressing specific buttons bypassing gameoptions.lua In that time i tried to add a button to the gameoptions.ua , but nothing happened.
gameoptions.lua forbidden to change.
I wanted to catch the push of "Shift + J" for an emergency jump in my MOD.
_____________
sorry, i was a bit tired after work the last few days, and i didnt bother to read up because i already saw a reply from j.harshaw ^^
regarding hotkeys: yep, experimented a lot with that, but sadly no satisfactory results... somehow something always bugged out or didnt work.. the only Keys i could semi-sucessfuly hijack in the end were the ones which are already handled via MD (Maps and a few other Menus)
gameoptions.lua (as any other lua file) can be freely changed, but you must put them into a subst_01.cat/dat in your Mod for a full file replacement, loose files or ext_01.cat/dat dont work for that.
regarding hotkeys: yep, experimented a lot with that, but sadly no satisfactory results... somehow something always bugged out or didnt work.. the only Keys i could semi-sucessfuly hijack in the end were the ones which are already handled via MD (Maps and a few other Menus)
gameoptions.lua (as any other lua file) can be freely changed, but you must put them into a subst_01.cat/dat in your Mod for a full file replacement, loose files or ext_01.cat/dat dont work for that.
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
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
Thanks, @Uni!
I'll try this!
2 years ago i tryed to do this:
1. put subst_01.cat/dat into the root (nothing happens)
2. fully repack 09.cat/dat w/ changed gameoptions.lua. (game loaded, but gameoptions menu is not appears)
Maybe I made a mistake in the file itself.
I must resume my efforts! )
I'll try this!
2 years ago i tryed to do this:
1. put subst_01.cat/dat into the root (nothing happens)
2. fully repack 09.cat/dat w/ changed gameoptions.lua. (game loaded, but gameoptions menu is not appears)
Maybe I made a mistake in the file itself.
I must resume my efforts! )
_____________
ah, you are trying it? then another hint: also include a copy of the lua file renamed to .xpl - no need to make a binary file from it, just a plain text version is enough.. Also its very easy to mess something up with the lua stiuff, and locating errors using the log output is nearly impossible because the log often points you not to the original mistake, but somewhere completely diffrent.... so best make small, incremental changes and then test... the "reloadui" command for the debug command line might be helpful for that - either for recovering from an crashed UI or for loading ui changes into an already running game..
PS disclaimer: its been a long time since i experimented with this stuff. i think i was successful with minor changes (like adding lines/buttons), but couldnt get the functionality i wanted to work in the end.. (hope i dont need to mentoin i prefer ai/md scrits over lua by far) but its too long ago for me to say for certain...
PS disclaimer: its been a long time since i experimented with this stuff. i think i was successful with minor changes (like adding lines/buttons), but couldnt get the functionality i wanted to work in the end.. (hope i dont need to mentoin i prefer ai/md scrits over lua by far) but its too long ago for me to say for certain...
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
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
I tried to start with this.
But I do not understand how to do it.
I think it is necessary to insert here:
I try to do this:
More text is needed:
Still need to describe the action (226), but I do not understand where and how !?
inputmap.xml ?
What do You think about this?
But I do not understand how to do it.
I think it is necessary to insert here:
Code: Select all
menu.controls["functions"] = {
[1] = {
["name"] = ReadText(1005, 16), -- "Menu back"
--["name"] = ReadText(1001, 2669), -- "Back"
["definingcontrol"] = {"actions", 16},
["actions"] = { 2, 14, 15, 16, 103, 134, 135, 138 },
["states"] = {},
["ranges"] = {},
["contexts"]= { 1, 2, 3, 4, 5 }
},
...
--AMB change
[14] = {
["name"] = ReadText(1005, 226),
["definingcontrol"] = {"actions", 226},
["actions"] = { 226 },
["states"] = {},
["ranges"] = {}
}
-- end of changes
}
and
...
if (context == "keyboard_space") or (context == "vrtouch_space") or (context == "vrvive_space") then
menu.controlsorder = {
[1] = {
["title"] = ReadText(1001, 4865), -- "Steering: Analog"
...
},
[8] = {
["title"] = ReadText(1001, 2664), --"Misc"
["mapable"] = true,
{ "functions", 10 },
{ "actions", 167 },
{ "actions", 168, nil, ReadText(1026, 2604) }, -- "Target Object" (near crosshair)
{ "actions", 169 },
{ "actions", 170 },
{ "actions", 213 },
{ "actions", 214 },
{ "actions", 275 },
{ "actions", 177, nil, ReadText(1026, 2608) },
{ "actions", 178, nil, ReadText(1026, 2609) },
{ "functions", 9 },
{ "actions", 225, nil, ReadText(1026, 2610) },
{ "actions", 223, nil, ReadText(1026, 2611) },
{ "actions", 117 },
{ "actions", 120 },
{ "actions", 219 },
{ "states", 80, nil, ReadText(1026, 2612) },
--AMB change
{ "functions", 14 }
--end of changes
Code: Select all
-- Addon for Ingame Options Main Menu 2017.10.23 (v. 4.30)
local menuAddon = {
entry = {
["name"] = ReadText(1005, 226),
["definingcontrol"] = {"actions", 226},
["actions"] = { 226},
["states"] = {},
["ranges"] = {}
}
}
local menuAddon2 = {
entry = { "functions", 14 }
}
local function createSetupAddButton(menu)
for _, subMenu in ipairs(menu.controls["functions"]) do
table.insert(subMenu.list, menuAddon.entry)
end
for _, subMenu in ipairs(menu.controlsorder) do
-- if subMenu.title == ReadText(1001, 2664) then --"Misc"
table.insert(subMenu[8], menuAddon2.entry)
-- end
end
end
local function createSetupWrapper()
menuAddon.origCreateSetup()
createSetupAddButton(menuAddon.menu)
end
local function init()
if Menus then
for _, menu in ipairs(Menus) do
if menu.name == "OptionsMenu" then
menuAddon.menu = menu
menuAddon.origCreateSetup = menu.createSetup
menu.createSetup = createSetupWrapper
break
end
end
end
end
Code: Select all
<language id="44">
<page id="1005" title="Input Action Texts" descr="0" voice="no">
<t id="226">Emergency Jump</t>
</page>
inputmap.xml ?
Code: Select all
<action id=226 source="INPUT_SOURCE_KEYBOARD" code="INPUT_KEYCODE_J_SHIFT"/>
_____________
Wishes for programmers!!!
Please make the event generation by pressing / releasing one key. Or in combination with alt / shift / ktl.
In xml it would be possible to track by:
<event_key_pressed> w/
<param = "INPUT_SOURCE_KEYBOARD">
<param2 = "INPUT_KEYCODE_J_SHIFT" comment = "Same Action Code from inputmap">
<param3 = "pressed / released">
I have no idea - how track key press. (
ps: maybe in X4 Foundation, in a future...
Thank You!
Please make the event generation by pressing / releasing one key. Or in combination with alt / shift / ktl.
In xml it would be possible to track by:
<event_key_pressed> w/
<param = "INPUT_SOURCE_KEYBOARD">
<param2 = "INPUT_KEYCODE_J_SHIFT" comment = "Same Action Code from inputmap">
<param3 = "pressed / released">
I have no idea - how track key press. (
ps: maybe in X4 Foundation, in a future...
Thank You!
_____________