Author Topic: KeyboardSearch module  (Read 2467 times)

Arcadefan1

  • Jr. Member
  • **
  • Posts: 22
    • 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: Yesterday at 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