Author Topic: KeyboardSearch module  (Read 60311 times)

Arcadefan1

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: KeyboardSearch module
« Reply #30 on: December 11, 2017, 05:15:52 AM »
Hi guys!
I've figured it out. When I add a line of code, the search result will update the shown artwork on the fly, every time you change the search term. Before the change it seems that it is only done when the "fe.list.search_rule" is set with content for the first time. After that the artwork won't refresh. So what I did was clear the search_rule before adding another letter to the search term...

Look at the code snippet...
Code: [Select]
//update the current search rule
    function update_rule()
    {
        try
        {
            local rule = "Title contains " + _massage(text)
            print( "Rule: " + rule )
            switch ( config.mode )
            {
                case "next_match":
                    print("jumping to: " + text)
                    if ( text.len() == 0 ) return
                    local s = fe.filters[fe.list.filter_index].size
                    for ( local i = 1; i < s; i++ )
                    {
                        local name = fe.game_info( Info.Title, i ).tolower()
                        if ( regexp( text ).capture(name) ) {
                            fe.list.index = (fe.list.index+i)%s
                            break
                        }
                    }
                    break
                case "show_results":
                default:
                    print("results for: " + text)
                    //fe.list.search_rule = "Title contains mario"

 // the following line does the trick
    fe.list.search_rule = ""
// -------------------------------------------------

                    fe.list.search_rule = ( text.len() > 0 ) ? rule : ""
                    break
            }
        } catch ( err ) { print( "Unable to apply filter: " + err ); }
    }


I run attract mode on my vertical CRT cab. Have a look at how I have integrated the search module...
http://sendvid.com/thyu2zdh
Probably not the best video hoster, but I have no idea how to show you guys a video here

Edit:

Ok! Just skip the video if you don't have an add blocker... it just showed me an ass. ;) ok, the ass was not bad, but who knows what comes along with it..????
« Last Edit: December 11, 2017, 09:51:45 AM by Arcadefan1 »

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: KeyboardSearch module
« Reply #31 on: December 11, 2017, 10:24:34 AM »
I'll check this out tonight. I was able to get typing working for the most part.. still have to figure out some things, like if your search key is a letter, you obviously can't use it to toggle search for instance.

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: KeyboardSearch module
« Reply #32 on: December 11, 2017, 03:48:22 PM »
Oh, great, I see what you mean now - next_match already selects the next match in the results, but show_results doesn't. Might take me a day or two to work out some of the bugs and add a few features I want, but should have an update pretty soon  :D

As for where to put videos (yes, ublock origin saved me):
https://gfycat.com (converts to gifs, which you can then include in your post with the img tag)
https://www.dropbox.com (create a share link, it will auto-embed videos to play)
https://youtube.com (self explanatory) :)
https://vimeo.com (alternate option)

Bbuschke

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: KeyboardSearch module
« Reply #33 on: April 19, 2018, 09:08:50 AM »
i cant get this working. Does the .nut file go in the plugins folder? Thats where I have it. when i view plugins in attractmode it allows me to turn it on but not select what triggers it to work.

Marcoqwerty

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: KeyboardSearch module
« Reply #34 on: July 15, 2018, 06:52:10 AM »
Hi...

I have some trouble to istalling this module, actually i have:

- placed the /modules/objects/keyboard-search/ in the same folder
- copy the code in my module (all showed in the wiki)
- assigned the custom1 key

Nothing happens at the pression of the key, its the fist time i try to install a module....if someone can help me a bit.  ;D

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 125
    • View Profile
Re: KeyboardSearch module
« Reply #35 on: August 13, 2018, 07:01:19 PM »
my search screen is in the upper left corner, my question is, and how do I get it to the center of the screen?

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: KeyboardSearch module
« Reply #36 on: August 14, 2018, 02:19:54 AM »
my search screen is in the upper left corner, my question is, and how do I get it to the center of the screen?

This is what i do:
Code: [Select]

// Search
local search_surface = fe.add_surface(flw*0.375, flh*0.4)
KeyboardSearch(search_surface)
    .search_key(my_config["search_key"])
    .mode(my_config["search_method"])
    .text_color(255,255,255,125)
    .keys_color(255,255,255,125)
    .keys_selected_color(255,0,0,125)
    .init()
search_surface.set_pos(flx*0.215, fly*0.36, flw*0.375, flh*0.4);
« Last Edit: August 14, 2018, 02:27:33 AM by iOtero »
Nacer a los 15 años Una novela de iOtero

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: KeyboardSearch module
« Reply #37 on: September 11, 2018, 06:54:57 AM »
I'm going to request that you add the CAPS key to the keyboard-search.

I explain my need:

I have several consoles:

Sega Genesis
NES
SNES

If I use keyboard-search entering nes, it only returns Sega Genesis, when it should also return NES and SNES.

It does not, because the search is "Title contains [Nn]es", and I need "Title contains [Nn]es or NES". (Is only one example, sorry.)

So I would appreciate it if you enabled the CAPS key, or you could give me some solution to my problem.

Thanks you for your work.
Nacer a los 15 años Una novela de iOtero

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: KeyboardSearch module
« Reply #38 on: October 30, 2018, 07:29:56 AM »
Well, since I have not read anyone...

I solved it myself:

In the module keyboard-search.nut , just substitute this line of code:
Code: [Select]
             local rule = "Title contains" + _massage (text)
for this other:
Code: [Select]
             local rule = "Title contains" + _massage (text) + "|" + text.toupper ();

Thanks for nothing...  8)
Nacer a los 15 años Una novela de iOtero

Wenzon

  • Full Member
  • ***
  • Posts: 59
    • View Profile
Re: KeyboardSearch module
« Reply #39 on: June 17, 2019, 10:45:25 AM »
Hi...

I have some trouble to istalling this module, actually i have:

- placed the /modules/objects/keyboard-search/ in the same folder
- copy the code in my module (all showed in the wiki)
- assigned the custom1 key

Nothing happens at the pression of the key, its the fist time i try to install a module....if someone can help me a bit.  ;D


I have the same difficulty as Marcoqwerty. I did the same procedure with no results. I have worked for months on a custom theme for my bartop and to conclude it, I need to include this module to be perfect.

I'm putting the attached layout.nut to see if anyone helps me. I'm almost giving up.  :(


« Last Edit: June 17, 2019, 11:03:08 AM by Wenzon »

Wenzon

  • Full Member
  • ***
  • Posts: 59
    • View Profile
Re: KeyboardSearch module
« Reply #40 on: June 19, 2019, 08:32:06 AM »
I'm not sure but think something is missing in this line for the module to work on my theme.
Code: [Select]
local search_surface = fe.add_surface(fe.layout.width, fe.layout.height)

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: KeyboardSearch module
« Reply #41 on: June 22, 2019, 10:27:18 AM »
I'm not sure but think something is missing in this line for the module to work on my theme.
Code: [Select]
local search_surface = fe.add_surface(fe.layout.width, fe.layout.height)

Try:

Code: [Select]
local flwc = fe.layout.width;
local flhc = fe.layout.height;

local search_surface = fe.add_surface(flwc, flhc)
Nacer a los 15 años Una novela de iOtero

Wenzon

  • Full Member
  • ***
  • Posts: 59
    • View Profile
Re: KeyboardSearch module
« Reply #42 on: June 23, 2019, 07:12:01 AM »
I'm not sure but think something is missing in this line for the module to work on my theme.
Code: [Select]
local search_surface = fe.add_surface(fe.layout.width, fe.layout.height)

Try:

Code: [Select]
local flwc = fe.layout.width;
local flhc = fe.layout.height;

local search_surface = fe.add_surface(flwc, flhc)

nothing.  :'(

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: KeyboardSearch module
« Reply #43 on: June 23, 2019, 07:34:15 AM »
Run:
Code: [Select]
attract --loglevel debug

launch the keyboardsearch module and put here the last_run.log file.
« Last Edit: June 23, 2019, 07:35:58 AM by iOtero »
Nacer a los 15 años Una novela de iOtero

Wenzon

  • Full Member
  • ***
  • Posts: 59
    • View Profile
Re: KeyboardSearch module
« Reply #44 on: June 23, 2019, 08:44:50 AM »
Run:
Code: [Select]
attract --loglevel debug

launch the keyboardsearch module and put here the last_run.log file.

I'm putting 2 files. One log and the other layout. I put the module script in the last line of the layout file.