Dynamic script generation