Shigekims

Villager
Member
Joined
Dec 21, 2018
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
Any advice on how to implement a search field in a menu, which could return results in another menu window?

For example, if a player has a large inventory, and they are looking for a specific item, instead of scrolling down their list of items, instead they can filter the items that appear on the list by typing in the beginning of the item name?

Could this jive well with the built in item lists in RMMV, or would you have to create/populate/maintain a custom List to search and return results from in javascript?

I'm already familiar with the basic custom menu plugins from SmRndmDde and Yanfly.

Thank you!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,410
Reaction score
1,820
First Language
EN
Primarily Uses
RMMZ
The default item scene has three windows: item description, category select, and the item list itself. The contents of the item list window are determined by which category the user has selected: it just filters out items that don't match that category (cf Window_ItemList.prototype.includes). I'm reasonably certain your idea would require a custom plugin: I haven't much experience with SRD's stuff, but I'm pretty sure nothing in Yanfly's library lets you make edits of this scale to existing scenes.

At minimum, I think it would require something to handle user keypresses, store the input, and use that input to extend (or replace) the built-in item filter. May involve some layout edits too if you want the current search text displayed to the user (generally a good idea!). I've never really tried anything with custom input handling, though, so can't help with the specifics there. :kaoswt2:
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,130
First Language
English
Primarily Uses
RMMV
Filtering the list would be a piece of cake, basically a one-liner:
Code:
// this isn't the exact code but you get the idea
const newList = oldList.filter(item => item.name.includes(input));

Gathering the input (and the UI/UX with that) would be the tricky part.

It could be done with an <input> HTML element and an oninput event handler. The nice part is that it would handle the player's language automatically and theoretically work with touchscreens. The bad part is that it would be harder to make it look good (would probably need CSS) and potentially immersion-breaking if it clashes with the rest of the menu design.

I remember seeing a plugin on these forums that did this, but for inputting passwords or something in battle.

The other route is to create a custom onKeyUp event handler that detects what key was pressed and prints it to a window in the item scene. I did this for my Notepad plugin (link in signature) and it was... insane haha.

I don't have any more specifics than that but feel free to look at either example to see how they did it.
 

Shigekims

Villager
Member
Joined
Dec 21, 2018
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
Thank you for the input; I'm now at a point where I could see collecting all the items in a players inventory into an array stored in a variable, but stuck on how to then display all of these items into the menu panel without having many many individual statements.
 

Latest Threads

Latest Posts

Latest Profile Posts

Took our dogs on a walk and someone asked if our smallest one was a gueanie pig ((however it's spelt))
I decided to create reboots of my games on RPG Maker MV. I'm happy. :biggrin:
So, as i finish setting up my items for part 1 of my game, I realized I forgot to finalize an ENTIRE category of items. Know which ones? The Fallen Feathers....BTW my game is called "Fallen Feather"
and_remember_tomorrow_exploding_puzzle_logo.jpg

Made some new friends, and blew up a puzzle... Happens. :LZSwink:
A new RPG Maker music pack is coming out soon! Below is a demo of one of the compositions in the pack, Heroic Battle. More details coming soon!

Forum statistics

Threads
111,148
Messages
1,058,707
Members
144,374
Latest member
strawbies
Top