Posted 04 March 2012 - 07:06 AM
(Requires ModLoaderCC)
This mod adds a AI named bob. You can talk to him by saying his name, bob.
Code:
This mod adds a AI named bob. You can talk to him by saying his name, bob.
Code:
function ai()
local getName = "Bob's AI" --insert mods name into the quotes
getMod1 = "mod_" ..getName -- change 1 to your mods ID, it has to be from 1-5 (no 0 or past 5)
function commands()
write("> ")
getSentence = read()
if getSentence == "Hi" then
print("Bob: Hi")
commands()
end
if getSentence == "How old are you?" then
print("Bob: I don't know...")
commands()
end
if getSentence == "Are you real?" then
print("Bob: No")
commands()
end
if getSentence == "What are you?" then
print("Bob: Artificial Intelligence, or AI for short.")
commands()
end
if getSentence == "Goodbye" then
print("Bob: Bye.")
end
if getSentence == "Your stupid" then
print("Bob: Your stupid.")
commands()
end
if getSentence == "I'm deleting you" then
print("Bob: Too late, I already did.")
sleep(2)
os.shutdown()
end
end
if getSentence == "Bob" then
print("Bob: Hello")
commands()
end
modcount = modcount +1 -- this line is needed so modloader for computercraft can count your mods
end
ai()
Add more commands like this:
if getSentence == "What you need to say" then
print("Bob: What Bob says")
commands() --loops back
end