+ pick_selectable: function(task_name) {
+ const i = parseInt(this.inputEl.value);
+ if (isNaN(this.inputEl.value) || i < 0 || i >= this.selectables.length) {
+ tui.log_msg('? invalid index, aborted');
+ } else {
+ server.send(['TASK:' + task_name, tui.selectables[i]]);
+ }
+ this.inputEl.value = "";
+ this.switch_mode('play');
+ },
+ enter_ascii_art: function(command, height, width, with_pw=false) {
+ if (this.inputEl.value.length > width) {
+ this.log_msg('? wrong input length, must be max ' + width + '; try again');
+ return;
+ } else if (this.inputEl.value.length < width) {
+ while (this.inputEl.value.length < width) {
+ this.inputEl.value += ' ';
+ }
+ }
+ this.log_msg(' ' + this.inputEl.value);
+ this.full_ascii_draw += this.inputEl.value;
+ this.ascii_draw_stage += 1;
+ if (this.ascii_draw_stage < height) {
+ this.restore_input_values();
+ } else {
+ if (with_pw) {
+ server.send([command, this.full_ascii_draw, this.password]);
+ } else {
+ server.send([command, this.full_ascii_draw]);
+ }
+ this.full_ascii_draw = '';
+ this.ascii_draw_stage = 0;
+ this.inputEl.value = '';
+ this.switch_mode('edit');
+ }
+ },