Loading external variables

My original problem. or so I thought was using variables outside the function that called them

Mt current problem the script progresses even though the external variables have not yet loaded and thus I get multiple undefined.

If I try and envelope the whole script into the onload. some aspect of the script don’t work

So… How do I load some simple text from a text file and then use the variables in the rest of the script?