Loading custom file based on a dependant file that is also dependant on another file

Issue resolved. nothing wrong with the script i posted. turns out i was calling the wrong file in the first wp_register_script()