Author Topic: "Trigger = Transition.EndNavigation" does not change artwork  (Read 5212 times)

harpiufof

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
"Trigger = Transition.EndNavigation" does not change artwork
« on: April 19, 2017, 05:29:40 AM »
Hi. I'm developing a theme with horizontal list using conveyor. In order to navigate with the "left" and "right" keys use this command to change the functions of each key without having to reconfigure the buttons in the options:

Code: [Select]

function Navigation(sig)
{
local disable = false;
if (sig=="up")
{
disable = true;
fe.signal("prev_letter");
}
if (sig=="down")
{
disable = true;
fe.signal("next_letter");
}
if (sig=="left")
{
disable = true;
fe.signal("prev_game");
}
if (sig=="right")
{
disable = true;
fe.signal("next_game");
}

return disable;
}
fe.add_signal_handler( "Navigation" );


The problem is that when using this command, for some reason the artwork is not updated when changing games. This only happens when having the value of the property "trigger" in "Transition.EndNavigation".

I leave these images as an example.

When starting the layout:



When changing the games:





Anyone knows how to solve this?

Oomek

  • Administrator
  • Sr. Member
  • *****
  • Posts: 311
  • Radek Dutkiewicz
    • View Profile
    • github.com/oomek
Re: "Trigger = Transition.EndNavigation" does not change artwork
« Reply #1 on: April 23, 2017, 03:15:48 AM »
The variable sig does not specify the actual keyboard button, but the action that it's bound to, so for default mappings you would need to write it like this.

Code: [Select]
function Navigation(sig)
{
local disable = false;
if (sig=="prev_game")
{
disable = true;
fe.signal("prev_letter");
}
if (sig=="next_game")
{
disable = true;
fe.signal("next_letter");
}
if (sig=="prev_display")
{
disable = true;
fe.signal("prev_game");
}
if (sig=="next_display")
{
disable = true;
fe.signal("next_game");
}

return disable;
}
fe.add_signal_handler( "Navigation" );

With your code your left and right has still default mappings so nothing changes because you are still cycling through filters and I suppose you've got only one.

edit: I forgot my mappings weren't default, so I corrected it. It still though works for unchanged mappings, so If someone has changed default bindings it's still advisable to use the function below.

edit2: Read my explanation 2 posts below.
« Last Edit: April 23, 2017, 08:49:59 AM by Oomek »

Oomek

  • Administrator
  • Sr. Member
  • *****
  • Posts: 311
  • Radek Dutkiewicz
    • View Profile
    • github.com/oomek
Re: "Trigger = Transition.EndNavigation" does not change artwork
« Reply #2 on: April 23, 2017, 04:21:50 AM »
If you want to check for keys instead of signals you would need to use
fe.get_input_state()

Oomek

  • Administrator
  • Sr. Member
  • *****
  • Posts: 311
  • Radek Dutkiewicz
    • View Profile
    • github.com/oomek
Re: "Trigger = Transition.EndNavigation" does not change artwork
« Reply #3 on: April 23, 2017, 08:32:18 AM »
I've looked at the AM sourcecode and I know why this is happenig.

AM checks if the "default action" set for the navigation key classifies as repeatable, if it returns false feVM.on_end_navigation() is not triggered

By default up/down is shared with prev/next_game and left/right with prev/next_display.

If you change the default action of left and right to prev/next_letter your script will work.

The commands below are repeatable:
Code: [Select]
bool FeInputMap::is_repeatable_command( FeInputMap::Command c )
{
return (( c == PrevGame ) || ( c == NextGame )
|| ( c == PrevPage ) || ( c == NextPage )
|| ( c == NextLetter ) || ( c == PrevLetter )
|| ( c == NextFavourite ) || ( c == PrevFavourite ));
}

Maybe I will fix it if it won't require rewriting half of the input handling function.
« Last Edit: April 23, 2017, 08:52:13 AM by Oomek »

harpiufof

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
Re: "Trigger = Transition.EndNavigation" does not change artwork
« Reply #4 on: April 23, 2017, 12:17:41 PM »
Thanks for answering.

But then, what should I do? Because as I said before, my intention is not to change the settings through the options of controls, but from the same layout.

Do not use fe.get_input_state () because that only affects a particular key, when what I want is to affect any control (either joystick or keyboard) and only with the command mentioned above, I have achieved.

The only problem is that it does not change the artwork when it has the "trigger" in "Transition.EndNavigation". If it is in default, then it changes, but that causes lags in the wheel.

Oomek

  • Administrator
  • Sr. Member
  • *****
  • Posts: 311
  • Radek Dutkiewicz
    • View Profile
    • github.com/oomek
Re: "Trigger = Transition.EndNavigation" does not change artwork
« Reply #5 on: April 23, 2017, 01:24:20 PM »
As I said, change the default action of left and right to prev/next_letter. It's the only workaround I can think of for this moment.


bjose2345

  • Sr. Member
  • ****
  • Posts: 107
    • View Profile
Re: "Trigger = Transition.EndNavigation" does not change artwork
« Reply #6 on: April 23, 2017, 02:16:34 PM »
I think you need to set the index_offset of your snap to your actual selection, you are using the conveyor.nut module  i am right?
« Last Edit: April 23, 2017, 02:18:36 PM by bjose2345 »

harpiufof

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
Re: "Trigger = Transition.EndNavigation" does not change artwork
« Reply #7 on: April 23, 2017, 11:42:39 PM »
Quote
As I said, change the default action of left and right to prev/next_letter. It's the only workaround I can think of for this moment.

Aahh, ok.

Sorry, I had not finished understanding your explanation earlier. Thank you.

Quote
I think you need to set the index_offset of your snap to your actual selection, you are using the conveyor.nut module  i am right?

So is.

I tried to do that using ".index_offset = 0", "reset_index_offset" and "rawset_index_offset", both inside and outside the "Conveyor" or "ConveyorSlot" function, but it did not work.

Maybe I'm wrong on something, since I still have difficulty understanding certain functions.