Page 1 of 1

chatbot?

Posted: Tue Jan 24, 2012 9:05 pm
by cu3e
Hello, I want to programme a ARG Game. For that I need a chatbot system. I simply "fake" chat box where the user can type in messages. If a message contains a "trigger word" the chat should give out a information. Example below.

User: Hello, anybody here?
User: Nobody ??
User: I have information about Cortexiphan

(Cortexiphan is the trigger word)

Fakeuser: Hello, ok what do you know about Cortexiphan



Can anybody code me a short example how to create something or is it not possible in LC? Thank you very much.

Re: chatbot?

Posted: Tue Jan 24, 2012 9:26 pm
by mwieder
Do you need an actual chatbox system (multiuser, server/client, internet-enabled, etc)? or just a self-contained system on a computer where the user types something in and your program generates a reply locally?

If it's the latter, then you can check a list of trigger words easily with something like

(code in the script of the chat field)

Code: Select all

constant triggerWords = "Cortexiphan, bebop, the prime directive, sleep apnea"
on returnInField
  repeat for each item trigger in triggerWords
    if trigger is in me then
      -- do something here
      put "Hello, ok what do you know about" && trigger & cr after field "chat"
    end if
  end repeat
end returnInField

Re: chatbot?

Posted: Tue Jan 24, 2012 9:28 pm
by cu3e
Thank you very much I will try that it. Is a real chat system possible with LC? That would add more realism to the game if other ppl are aswell in the chatroom :D

Re: chatbot?

Posted: Tue Jan 24, 2012 9:29 pm
by cu3e
Oh and it is possible that the Text from the chat is not visible 100% directly . It should be look like someone type it .. letter for letter in a slow order.

Re: chatbot?

Posted: Tue Jan 24, 2012 9:44 pm
by mwieder
Is a real chat system possible with LC?
Yes, but it's much more involved. Bjornke has a full client/server chat system up that we use for real-time interactions. But the coding (especially the internet socket handling) is not for the faint of heart. Don't rule it out yet, but think of it as something to build towards. I'd say get the local system working first and then think about expanding it.

http://www.bjoernke.com/index.irev?target=chatrev

Re: chatbot?

Posted: Tue Jan 24, 2012 9:48 pm
by mwieder
letter for letter in a slow order.
Instead of the line I typed earlier

Code: Select all

put "Hello, ok what do you know about" && trigger & cr after field "chat"
try something like

Code: Select all

  repeat for each char tchar in ("Hello, ok what do you know about" && trigger)
    put tchar after field "chat"
    wait random(1000) milliseconds
  end repeat
  put cr after field "chat"