Download it here https://github.com/vpelss/StarTrek-Classic
Try it here https://www.emogic.com/games/StarTrek_Classic/
I love finding projects I am passionate about. A friend was showing off all his Star Trek games which reminded me of one of the very first computer Star Trek games. I remember playing it on the PET computer. It was written in BASIC.
I heard a voice in my head say, ‘Thou shalt do this’.
To simulate / mimic the BASIC INPUT command, we end our code in JS just before the BASIC input code while also setting a ‘nextLine’ variable. var ‘nextLine’ indicates where the code should resume after a user input event nextLine = 1270; return; (or equivalent) accomplishes this A user input event will store the user input in a variable ‘globalComandStorage’. Then we call the function switch_board() which looks at nextLine and then calls function Line’nextLine'() Code runs again until we require user input
The BASIC GOTO command is a menace. It makes it easy to write poorly structured code. In some cases, I just restructured the code, in others, I did not. GOTO can be simulated with something similar to GOTO6543(); return; Eventually we will come to an INPUT command. As stated before, to simulate INPUT, we return from and stop all JS code. If there is a big call stack, because of our many GOTOXXXX calls, all the return; commands placed after our GOTOXXXX calls will clean the call stack