AI is designed to be nonscripted. AI had its beginnings in the 1950s and 1960s in being able to artificially replicate the neural pathways that the human brain has. Like human beings (or any animal in general), it takes information and is "trained" before basing its entire existence on that. The only difference is that the data it gets "trained" on is much, much less complex than data that animal brains train themselves on.