How do I create a browser search?

From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Ok I know what I am trying to do is a little crazy, but I really need it... Sry any grammatical error.

    So what I am trying to do:

    Basically the user will have a search bar where he/she will can search whatever want.

    //

    Search:

    //

    The user will search like:

    //

    Search: What is the color of the sky

    //

    The system will break each word:

    "What is the color of the sky"

    ==

    "What" "is" "the" "color" "of" "the" "sky"

    -----------

    With each word I will use as "tags" to found something that corresponds with what the user is searching.

    Someone have any idea? I tried a lot of things but they are not all dynamic... Like if I wrote and try to delete all the string:

    Ctrl+a + Delete

    Or even select some words and delete, the system will broke....

  • You mean you want to display all results that have each word in your sentence, right?

  • Basically yes, I am trying to do like... like right here right now! Construct.net have a system on the forum to add tags to your post ( Like I tagged "regex" and "browser" "search)"

    Here is something that I tryed, but is not working at all:

  • And the way to search will work with ajax...

    Ajax request -> RTDB(realtime database)

    Load all the sites tags and it's names:

    Json:

    Sites Tags:

    (Site name) : (site tags: "green;yellow;banana;apple;fruit")

    On Ajax > Dictionary load

    > Call function "load"

    On "load"

    > For each dictionary key

    > Find(dictionary.get(*current tag) x= -1

    >> Ajax request RTDB (site info "title, description, etc.")

    On ajax >> create (container)

    Container:

    1 Separated text for title

    1 Separated text for description

    1 Separated text for custom site url (custom url is fake, just to make it beautiful)

    1 for background

  • Try Repeat tokencount(text, " ")

    Find tokenat(Text, loopindex, " ") within the library => display results.

  • I am away from my PC right now, I will test it and give say what happened as fast as I can.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Try Repeat tokencount(text, " ")

    Find tokenat(Text, loopindex, " ") within the library => display results.

    You helpped my a lot! I figured out what i did wrong. But, well i think I miss something

    Look my output:

    Search » An Apple is Red

    Output » AnAplleisRedAnAppleisRedAnAppleisRedAnAppleisRedAnAppleisRed(Repeat)(Repeat)(Repeat)......

    what was expected:

    » AnAppleisRed

  • I Found the solution!

    Everything I have to do is to add an "Trigger once" event (Trigger Once event don't seen to work by the way)

    Can be like a function or something else:

    (event)► On Start Of Layout»

    (sub-event)►►tokencount(text," ") » Set Text: tokenat(text, loopindex, " ")

    Thank you sooooo much!! If some day some how my program become famous i don't will forget you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)