enter_data.c

phantasmal_dgd_v1/mud/usr/common/obj/ustate/enter_data.c · 626 B

From the archive phantasmal_dgd_v1.tar.gz

Download the archive   « Back to the archive contents

#include <kernel/user.h>
#include <phantasmal/lpc_names.h>

inherit USER_STATE;

private string full_block;

static void create(varargs int clone) {
  ::create();
  if(clone) {
  }
}

int from_user(string input) {
  if(input == "~" || input == "~\n") {
    pass_data(full_block ? full_block : "");
    full_block = nil;

    pop_state();
    return MODE_ECHO;
  }

  if(!full_block) full_block = "";

  full_block += input + "\n";
  send_string(" > ");

  return MODE_ECHO;
}

void switch_to(int pushp) {
  send_string("Enter text at the prompt.  Enter ~ on a line by itself to " +
	      "end.\r\n");
  send_string(" > ");
}

Site Stats

Snippets: 1791
Codebases: 571