The idea is to make a somewhat bad search engine of some sort.
A user would type a word in the search bar and it would bring up some buttons to click. For instance:
A user typed in something like “Ad Blocker”
The script would search through the TextLabels, buttons, etc. on all pages, trying to find whatever player typed in, it would do so by checking every single word on it
If it found at least one match on the page, it lists the page in the results, else just brings up “Nothing found”
And I don’t even know where to start, string.find? string.match???
This sounds like string matching could be used here. However for your case you only need to do word checking.
local Input = "hello and hello again" -- what user types
local Words = Input:split(" ") -- split the string every time there is a space
for i, Word if ipairs(Words) do -- literate over all the words in the input
if Word == "target word" then
-- do whatever here
end
end
It can’t be a specific word as it then destroys the point of it being a search engine.
Can that “target word” be basically all words on all pages, so it checks which one has the most matches, and lists the page?
local Ranker = 0
local Search = "Info on weather, of weather!"
local Words = string.split(Search:gsub("%p", ""), " ")
for i, Word in ipairs(Words) do
if Word == "weather" then -- PROBLEM I need it to check EVERY word on EVERY webpage, and increases the ranker (I will make it so every page has it's own one later).
Ranker += 1 --For testing it's like this
end
end
if Ranker > 0 then
warn("Results found!")
-- I will also script it so it lists the pages with most matches later
else
warn("No Results...")
end
This would be the ground for it, but it’s not efficient without resolving the problem.