MV Input Boxes on Screen?

So I was designing a game where you have to use a search engine to get clues to finish the game. I was thinking it would look and work like Google etc where you click on the search box and just type and enter away, and you get your results.
I initially thought of using a picture as the search box and the player clicks it, then it starts the name input event (or call a string input plugin like biud436 Keyboard Input) but then it'd be difficult to provide each picture with the word that the player searched (also it would be a hassle if the player uses lowercase and uppercase letters differently).

I imagine it would be like the Edit Box component in Delphi 7 (or any similar development program)

Is it possible to have this feature as a plugin in RPG Maker MV? I would be very delighted if my idea can become a reality :"D

(attachment is for how it looks like in Delphi 7)
yes and no,

no, not on global unless you have JS knowledge and API to do such things.

yes, you can using 2 plugins probably and pull it off with eventing.

if search is "something"
you can do what you want.
else
no search found
end

this is only a very basic concept, but its goes much deeper than that.
as you can best make a JS switch/case setup through game variable.
and show the result based on it.

(this setup is relative easy to make!)
but the rest should be kinda evented on what the search might be.

I like your concept though and isn't to hard if you know what to look for.
so only pre-defined search results counts = easier than global search using API.
yes, you can using 2 plugins probably and pull it off with eventing.

if search is "something"
you can do what you want.
else
no search found
end

this is only a very basic concept, but its goes much deeper than that.
as you can best make a JS switch/case setup through game variable.
and show the result based on it.
Yeah, I was thinking this as well, where whatever's typed on the box is saved into a variable and used in conditional branches to show the results, although I don't know how to implement(?) this to JS because I don't know how to code with it

I like your concept though and isn't to hard if you know what to look for.
so only pre-defined search results counts = easier than global search using API.
Thank you, I did plan it to use custom pre-defined search results and limits it to maybe 4.. or 6

(here's what I thought so far)
conceptengine.png

I kinda want to have a search box stay visible when showing the results with the last searched text shown so it can look like a legit search engine in-game (also as feedback to know what the player was searching before (and also would be cool in a horror game setting where the search box already has text in it before the player even type anything))
there are 2 ways for approaching it.

you can use image + input name part as for the input, I would check out
111_inputForm as it require the JS and css (111_inputForm.css) in order
to work.

image can be done by show picture, the search window of results
can be done best by SRD_HUDMaker as you can set things there.

to clean this out nicely, this takes some time to set up nicely.

you can also try to use SRD_HUDMaker entirely and use another plugin
to grab the the data for you based on the search info.

I can find create a small setup that you can extend if you use 1 of them or
both of them, as it will check the variable for input.

but while I'm a bit busy in this week, I can try to help you after unless
you figure it out as I use both of those plugins as well, so I know how
they work, but not in the way you want to yet, but it is doable.
it would be a hassle if the player uses lowercase and uppercase letters differently
Just use a basic string function to make them all upper- or lowercase, as you like.

For example, if you had the player input the name for actor ID 4, you could do:
Code:
$gameActors.actor(4).setName($gameActors.actor(4).name().toLowerCase())
I think a variable would be better, specially if you want to check
a string "what is jane doe favorite music" and check that string.

if actor name cannot allow more than x letters or compare words
that must included to have a search part, it would be harder 🙂
Thank you for the replies!
So I tried working around with the recommended plugins:
you can use image + input name part as for the input, I would check out
111_inputForm as it require the JS and css (111_inputForm.css) in order
to work.
Although this plugin didn't stay on the screen, it's very close to what I've imagined. Here's what it looks like when I trigger it:
prob2.png

(I will adjust the size, location etc later)
And I assigned the input to be kept in a variable.
image can be done by show picture, the search window of results
can be done best by SRD_HUDMaker as you can set things there.
And then I used SRD_HUDMaker to show the input with a HUD Text showing the variable that kept it (also using a shape HUD as the search box background):
prob3.png

This works well so far, and I guess I can make do with that for the time being.

But then I have another problem:
prob1.png

When I try to press ENTER without inputting anything, the variable displayed a '0' instead of being left blank (or preferably, no changes to the variable so it still displayed the last searched item)

I was thinking of making a conditional branch after the input to detect if the input box was left blank, no changes would be made, but I don't know how to do it
This is what I went with so far (Variable 1 is to keep the input, Switch 1 is to show the HUD)

prob4.png

Just use a basic string function to make them all upper- or lowercase, as you like.

For example, if you had the player input the name for actor ID 4, you could do:
Code:
$gameActors.actor(4).setName($gameActors.actor(4).name().toLowerCase())
I was thinking of using actor name as well, but imo it's better to use variables instead (thank you for the recommendation!)
Although....
Another thing is that I want so the HUD shows if Variable 1 has certain string value so I tried to make the condition in the HUD maker but I kept getting errors.
When I checked the console, I got these (I tried multiple stuff to get it right)

$gameVariables.value(1).toLowerCase() = "send help"
ReferenceError: Invalid left-hand side in assignment

$gameVariables.value(1) = "send help"
ReferenceError: Invalid left-hand side in assignment

$gameVariables.value(1) = send help
SyntaxError: Unexpected identifier 'help'
(third one is obvious because I don't use the... apostrophe/quotation mark thing???? (I forgot the term))

So this is because of my lack of knowledge about JS Script, and I appreciate if you can tell me what I did wrong and how to solve it

but while I'm a bit busy in this week, I can try to help you after unless
you figure it out as I use both of those plugins as well, so I know how
they work, but not in the way you want to yet, but it is doable.
Thank you for taking the time to help me out, I really appreciate it ;_;
$gameVariables.value(1).toLowerCase() = "send help"
ReferenceError: Invalid left-hand side in assignment

$gameVariables.value(1) = "send help"
ReferenceError: Invalid left-hand side in assignment
That's not the actual list of variables.

$gameVariables.value() is just a function that looks up the ACTUAL list of variables and then returns the value stored in one whose ID was given as the function's argument. You can see the code for it under rpg_objects.js (anything that begins with Game_xxx has its code in this file, variables starting with $gameXxx are how the developers named the ones containing Game_xxx objects, like Game_Party and Game_Switches):
Code:
Game_Variables.prototype.value = function(variableId) {
    return this._data[variableId] || 0;
};
The actual list of variables is $gameVariables._data[x].

There is a "$gameVariables.setValues()" function, but it's meant to filter out any input that isn't a number, so you won't be able to use that one to store text. My bad, taking another look, it doesn't filter out non-numbers, just makes sure any numbers are integers by cutting off the decimal. You can use it to set text.
you use " " instead of simple "" (double quotes) or '' (single quotes) as I use
double without a space on my side project without problem.

another thing is, using a scriptall with "=" WILL throw an error as it is checking
as a function, for scriptcall, you need to use "==" or strictly "===" as "==" should
work as output (at least on my end if you use the console log to check).

but if you make the OK. CANCEL also on the HUDMaker, it will look indentical,
and showing the variable with SRD is also the way I did go 🙂
That's not the actual list of variables.

$gameVariables.value() is just a function that looks up the ACTUAL list of variables and then returns the value stored in one whose ID was given as the function's argument.

The actual list of variables is $gameVariables._data[x].
Wait, so what is the difference between using $gameVariables.value() and $gameVariables._data[x]?
you use " " instead of simple "" (double quotes) or '' (single quotes) as I use
double without a space on my side project without problem.

another thing is, using a scriptall with "=" WILL throw an error as it is checking
as a function, for scriptcall, you need to use "==" or strictly "===" as "==" should
work as output (at least on my end if you use the console log to check).
Thank you for this, that seems to be what's causing it to not work. I changed the script call with your suggestion and I can use it for conditions now.

So.. update on what I've worked...
I tried to simulate searches using 2 keywords ('send help' and 'tester'), here's how it looks like in Common Event:
This is the common event to call the search engine.
up1.png

Since the input plugin will keep changing everytime the player inputs something, I decided to keep one variable (Var 1) to keep current input and Var 14 to keep previous input (so when players enter a blank input, there won't be any change). Var 14 is the one that is assigned to the search box text HUD.
Although, I still can't figure out how to prevent the search box from showing '0' when the player enters a blank input before searching something.
up2.png

(when the player has searched something and then inputs something blank, then nothing will happen, as intended.)

This is the Common Event I did to control what's shown when the player search the keyword:
up3.png

Result Variables are like the site's name or the link, while the ResDet Variables are the site's description.
I kinda want it to be like a paragraph (blocks of text), I wonder if it's possible to do so with wordwrapping and stuff

These are screenshots of the search engine in action
up4.png

up5.png

The numbers before the link is intended so if players want to visit the first search (no 1), they just press number 1 on the keyboard, etc etc (Might try using picture as the background to click it, but the fancy 'link changing colors when you've visited it' feature opted me to try some alternative routes).

Now I'm just stuck on how to make it so it doesn't detect letter cases (like lower and upper cases)
up6.png

I still don't understand how to use the toLowerCase() function (or anything that ignores letter cases and stuff).
I tried using $gameVariables.value(14).toLowerCase() but it didn't work.
Wait, so what is the difference between using $gameVariables.value() and $gameVariables._data[x]?

One is a function. It executes code. Functions in JavaScript are called by "someFunctionName(parameters)", you can tell something is a function if there is () parentheses at the end.

The other is a data structure (in this case, an array). It just holds data. It does not execute any code when called. When you have "_data[x]" being referenced, it gives you whatever data is in the xth position of the array named "_data".

You can't store data in a function, since a function is code. So trying to go "someFunction() = 123" will throw an error.

You can store data in a data structure, like an array. Using "_data[2] = 123" will store the number 123 in the second position of the array.
One is a function. It executes code. Functions in JavaScript are called by "someFunctionName(parameters)", you can tell something is a function if there is () parentheses at the end.

The other is a data structure (in this case, an array). It just holds data. It does not execute any code when called. When you have "_data[x]" being referenced, it gives you whatever data is in the xth position of the array named "_data".
Ohhh I get it
Thank you, I'll remember that when the time comes where I need to use arrays in my development....
(which.. might be in the near future..... :hswt:)
Wait, so what is the difference between using $gameVariables.value() and $gameVariables._data[x]?
value() and setValue() are what are called getter and setter functions. It is most correct to use these when possible because they have built-in functionality to help prevent you from accidentally breaking something.

However, in this specific case we needed to bypass some of that functionality in order to get the variable to accept the decimal value.

I still don't understand how to use the toLowerCase() function (or anything that ignores letter cases and stuff).
I tried using $gameVariables.value(14).toLowerCase() but it didn't work.
We don't know what "I tried using" means - please show the actual code in the event that you tried. Because the code I gave you works perfectly for me.

you could do:
Code:
$gameActors.actor(4).setName($gameActors.actor(4).name().toLowerCase())
Screenshot 2023-05-18 143707.pngScreenshot 2023-05-18 143725.png
We don't know what "I tried using" means - please show the actual code in the event that you tried. Because the code I gave you works perfectly for me.
My bad, I deleted the script call because it didn't give any effect and it doesn't give me an error, but here's what I initially did:
en2.png

I put the script call in the beginning before using the variable in conditions so the searched keyword is already on lower case when the player searches for it.
But when I tried it on the search engine,
en1.png

it doesn't give me any effect (even if I searched using any case but all lowercase (like in the condition)) it doesn't show the search results.

you could do:
Code:
$gameActors.actor(4).setName($gameActors.actor(4).name().toLowerCase())

So I tried this too by adjusting it to a variable instead of actor names:
en6.png


And when I tested, this is what I got:

en7.png


I thought it was because of value() in the middle so I changed the scriptcall again by deleting the value() after $gameVariables.value(14) in the setValue function

en3.png


And this is what I got

en4.png


I don't know what I did wrong (obvs because I don't know any JS) but I'm still confused as to why my first script call didn't give any errors but has no effect as well, I thought it was working or maybe the engine ignored my script call because it's invalid??

Using my first script call, I checked the variables and Var 14 is still the same as Var 1 (which was intended when calling the input scene, but the event with the script call is parallel and I assume should've override(?) the input scene event trigger because it's not a parallel process)

en9.png


en8.png
So I'm not demeaning your efforts, just saying how it is - you are at the level of JavaScript knowledge where trying to make stuff up is useless. 🙂

If you want something that's a bit different than we gave you, ask us how to do that thing also. You would've saved the thread, like, 4-6 posts and yourself 24 hours of work that way 😉

Or, of course, you can start doing some JavaScript tutorials to get an understanding of basic syntax and look things up in the pinned thread with MV/MZ script calls. But asking would've been faster than that, too.

To do what you want, the code is:
Code:
$gameVariables.setValue(14, $gameVariables.value(14).toLowerCase())
To do what you want, the code is:
Code:
$gameVariables.setValue(14, $gameVariables.value(14).toLowerCase())
Thank you so much, now I can really start on making the search engine for my game!

It's not like what I pictured but it's very close to my concept so I can make do with it, I guess it's up to me to make it look interesting :3

It would be nice to have a plugin for MV search engine though, where you can use notepads to make larger-scale(?) search with pre-defined search results and you can use mouse to click on links and stuff, and scroll down to check the results (like the game Welcome to The Game etc) but I assume it's gonna be very difficult to pull off...

Well, I'll start working on my project now, thank you everyone for the help! :elwink:

Original thread: https://forums.rpgmakerweb.com/threads/input-boxes-on-screen.157593/