ID:271664
 
How do i start a server AI. Something that will once in a while will say like "Server AI: Hope you guys enjoy your stay" also if someone says something to AI he'll respond with a message i put in? Can someone please help me, Ill greatly appreciate it.
Blagh Nabbit wrote:
How do i start a server AI.
Please clarify.
In response to Shlaklava
Almost like a world Repop system. It repops, but also says Hello. Also i want it to be if someone says AI: [msg] it responds with a message i have stored. Something like that.
In response to Blagh Nabbit
Blagh Nabbit wrote:
Almost like a world Repop system. It repops, but also says Hello. Also i want it to be if someone says AI: [msg] it responds with a message i have stored. Something like that.

Write a proc that uses Repop and then says hello.

Parse said text from the player and see if they say AI: or just use a different verb.
Well, to write such an AI you'd have to detect when the server calls certain procs, something which would be both intensive and inefficient. Most BYOND projects don't use an AI, but rather use modify the procedures the AI was supposed to detect being called.

E.g.
server_robot
proc
ServerMessage(message as text)
world << "<font color=gray>\[Server] [message]</font>"
return 0

var/server_robot
serverrobot // the reference to your "AI"

world/New() // create the server_robot reference
..()
serverrobot = new


And then in another part of your code...
world/OpenPort(port)  // (don't remember the exact procedure)
serverrobot.ServerMessage("The server has opened a new port: [port].")


And that's all there is to it.