include("save_state.inc"); var current_state = saveState("preTestPause"); var color = "#aa0000"; LabelMgr.deleteAllLabels(); core.goHome(); core.setTimeRate(1); core.setObserverLocation(-2.5879, 51.45523, 5, 2, 0, "Bristol", "Earth"); // show the label bristolLabel = LabelMgr.labelScreen(("Location: Bristol, UK, Earth. (This label will stay until you press the k key to resume script.)"), 20, 20, false, 30, color); LabelMgr.setLabelShow(bristolLabel, true); // will pause until user hits the shift-L key for the timeRate to realitme // NOTE: k key does not receive input once a setTimeRate() is issued - perhaps it is a bug? pauseByUserKey('L'); // when pause hack is over the label will hide LabelMgr.setLabelShow(bristolLabel, false); // send the system back to the home setting core.goHome(); core.wait(5); // return state to previous restoreState("preTestPause"); // pause/resume function hack function pauseByUserKey(key) { var timerate = core.getTimeRate(); core.output('starting time rate in pause is: '+timerate); core.output('setting time to very slow. effectively pausing script. tap capital L key to continue.'); core.setTimeRate(0.05); i = 0; do { core.wait(1); core.output(i+' seconds. Checking time setting. Will resume script when time is realtime again.'); core.output('current time rate is: '+core.getTimeRate()); i++; } while( core.getTimeRate() < 0.1 ); core.output('time reset to realtime. continuing script'); core.setTimeRate(timerate); }