chatbot?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
cu3e
Posts: 46
Joined: Mon May 23, 2011 10:03 am

chatbot?

Post by cu3e » Tue Jan 24, 2012 9:05 pm

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: chatbot?

Post by mwieder » Tue Jan 24, 2012 9:26 pm

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

cu3e
Posts: 46
Joined: Mon May 23, 2011 10:03 am

Re: chatbot?

Post by cu3e » Tue Jan 24, 2012 9:28 pm

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

cu3e
Posts: 46
Joined: Mon May 23, 2011 10:03 am

Re: chatbot?

Post by cu3e » Tue Jan 24, 2012 9:29 pm

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: chatbot?

Post by mwieder » Tue Jan 24, 2012 9:44 pm

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

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: chatbot?

Post by mwieder » Tue Jan 24, 2012 9:48 pm

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"

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”