Scripting is a prepared response in a conversation.
It can be a useful workaround for those of us who can't easily encode pragmatics, such as implicatures and tone of voice, by simply borrowing a known-safe combination of words, inflections, and even gestures.
It can also help to avoid adding to all the chaos, by repeating a reassuringly familiar phrase. It may even serve as a stim, actively countering that chaos.
This may or may not be the same thing as delayed echolalia.
I pretty frequently quote films, TV shows, and occasionally audiobooks.
When talking to autists with a shared popular culture, expressing yourself via a quote can be a convenient and fun shorthand.
When talking to allists, I probably used to see it as a safer way of trying to get my point across. When forming my own sentences, I'll inevitably forget to intonate my voice. When quoting, in contrast, I'll simply quote verbatim (as much as my memory will allow), complete with the original inflections. I think I must have imagined this would be more likely to succeed, as pragmatics like tone of voice are generally pretty important to allists, perhaps moreso than the actual text itself.
However, it's probably worth bearing in mind that fiction is specifically designed to show us larger-than-life characters who are often antagonistic for the sake of drama, or mistaken for the sake of comedy. While audiences are entertained by what characters say in the context of fiction, this may not translate so well to a real conversation.
I've probably also been overlooking how context-specific pragmatics are, and how each conversation I have with someone in real life is likely a very different context to the original source of the phrase I'm quoting.
Memorising "correct" responses to allistic questions
Many of us often get into trouble for taking allists' questions at face value, and answering them accordingly.
A classic example is "Hi, how are you?" It turns out that when an allist asks this question as a sort of greeting, they do not sincerely want to know how you are, despite literally asking you that. There's a subtext at work that it's supposed to be interpreted as a sort of generic "Hello" instead.
They generally won't mind the response "Hi", even though it ignores the textual content of their question completely, but will mind you actually telling them how you are.
Often oblivious to this subtext, we eventually learn through trial and error, and observation, that the "correct" response to this question is something along the lines of "Fine thanks, yourself?" So we remember that this particular call has this particular response, and fight the urge to answer the actual question honestly and directly.
Planning and simulating upcoming conversations
It's pretty common for us to prepare for a phone call, meeting, appointment, or other upcoming conversation by planning out and simulating all the likely branches the conversation might take. That way, when the conversation actually happens, we already have a prepared response ready for many plausible nodes, although personally I never remember mine and inevitably end up ad libbing them anyway.
I'm not sure if this is related to rumination, monotropism, or most likely, warranted social anxiety. I do know that back when I naïvely tried to educate bigots online, I'd end up simulating such conversations in my head, an inner dialogue with various points and counterpoints, especially in the shower, without intending to.
I eventually, rather belatedly, realised that bigots don't want to be educated, and don't want you to answer their questions. They only ask them in order to imply an incorrect answer as subtext, not to learn the correct answer as text. I think my mental health vastly improved once I finally realised I didn't owe them my time, effort, or knowledge.