Move the script cache code out of RGBScript