A spell recall function?

So one of the characters in my game is very much a "Yes I read that entire book in 6 hours. No I don't remember much." type of mage. What I want to do is give her an ability like Tellah's recall function in Final Fantasy IV where she has a random chance to cast any spell for X amount of MP but it's randomized. Is there a way to script that or is there a plugin out there that does something similar?
SRD has a plugin for replicating Pokemon's Metronome that you could probably use
Oh my goooood! Thank you this will work perfectly!
Maybe you could have done it with a switch, then a lotta variables...though the script is probably a better option. Though it would "refer" a common event. Though if it's a random spell then....script...

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/a-spell-recall-function.179660/