Jump to content


Photo

Chat bot engine


  • Please log in to reply
5 replies to this topic

#1 LazicfulLazi

LazicfulLazi

    GMC Member

  • GMC Member
  • 103 posts
  • Version:GM8

Posted 20 July 2012 - 04:28 PM

Alright, so I'm making a minigame where you can speak to NPC's by typing sentences (like Facade).

I tried to use a script like this:


if (keyboard_string="Hello.")
{
show_message("WELP HERROW!")
}


However, this was proven to be almost impossible to code, as there are infinite sentences to be said etc.

So, I was thinking of an engine, again like Facade, that was able to recognize what words were in a sentence, for instance...

If "kill" and "Peter" were in the same sentence, the game would display a message saying "Why should I kill Peter?" and so on...

Does anyone have a clue on how to do this?

Edited by LazicfulLazi, 20 July 2012 - 04:39 PM.

  • 0

#2 faissialoo

faissialoo

    I get high on orange

  • GMC Member
  • 1025 posts
  • Version:GM8

Posted 20 July 2012 - 04:56 PM

My AI engine contains one but it is a work in progress:
http://gmc.yoyogames...l=&fromsearch=1
  • 0

#3 LazicfulLazi

LazicfulLazi

    GMC Member

  • GMC Member
  • 103 posts
  • Version:GM8

Posted 20 July 2012 - 05:17 PM

My AI engine contains one but it is a work in progress:
http://gmc.yoyogames.com/index.php?showtopic=546897&view=findpost&p=4023232&hl=&fromsearch=1


I haven't got 8.1...

And I'm not asking for your engine, I'm just asking for how to make such an engine. What functions did you use etc...
  • 0

#4 ramses12

ramses12

    6

  • GMC Member
  • 5769 posts
  • Version:GM8.1

Posted 20 July 2012 - 06:40 PM

You can use string_pos() to find if a given substring is present in a string. Therefore, you can make a series of string_pos() checks to test which of the known keywords exist in the database. If you want to go advanced, use string_pos() to find out which of the keywords is used first, etc.
  • 0

#5 LazicfulLazi

LazicfulLazi

    GMC Member

  • GMC Member
  • 103 posts
  • Version:GM8

Posted 22 July 2012 - 02:09 PM

You can use string_pos() to find if a given substring is present in a string. Therefore, you can make a series of string_pos() checks to test which of the known keywords exist in the database. If you want to go advanced, use string_pos() to find out which of the keywords is used first, etc.


I need a little more help....

In my game, there is an object called ANSWER that draws the responses like this:

text=draw_text_ext(x+16,y+32,response,14,290)

And the typing object creates updates the variable called global.sentence every time enter is pressed.

How do I make ANSWER check if some word (like pie) is included in the global.sentence?
  • 0

#6 ramses12

ramses12

    6

  • GMC Member
  • 5769 posts
  • Version:GM8.1

Posted 26 July 2012 - 07:37 AM

Just use that string_pos() function:
if(string_pos("pizza",global.sentence)){
response="I.. NEED... PIZZA.";
};

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users