Ah sweet, yeah, using the "Script" button in the dialog tree window creates the function for you, that helps a lot with that sort of thing compared than creating them manually ;)