{DDPLUSPI.PAS

This file is not meant to compile - just to provide you with the info
needed to call procedures and functions from DDPLUSPI.TPU

The routines here are from the DDPLUS team and from Seth Robinson's game
TEOS.   Some routines were modified by Seth, such as Displayfile.  (it
was changed to recognize ` codes also)

Many of these routines IGM authors will never use - so some are not
fully documented, or documented well.  If you have more Q's just ask.

}
 procedure seth(sayit: string);
 procedure sethln(sayit: string);
{
 Use these instead of swrite and swriteln.  They can understand ` codes.

  What are ` codes?  Sometimes called SANSI, (Seth ansi, woo!) these codes
  have grown popular in LORD - they allow users (and programmers) to
  quickly change the color of the curser and background.

  New ones:  `k will activate a [MORE] prompt
             `\ will do a carriage return
             `s will spin the curser once
             `* changes foreground to black
}

procedure load_player(num1: integer);
{loads a player into pl^ by #, can be from 1 to max_accounts}
{Max_accounts is set whenever you do a build_index}

procedure save_player(num1: integer);
{usually called like this:  save_player(play)}

procedure broadcast(br: string);
{sends this string to everyone else currently online.  Cool!}

procedure send_note(note: string; who: integer);
{great way to send little notes to people - wont do 'Reply?'. Example:

send_note('  `r1`%REPORT`r0 `8: '+quick_date+' `!'+pl^.names
+' `9launches `!'+lmon(gn)+' `9fighters at you.',cur_enemy);
}

procedure send_note_a(note: string; who: integer);
{Same as above, but will also mail every member of his Cartel if he is
in one.  (good fir any kind of info that the whole cartel would want to
know, like someone attacked their planet..)}


procedure load_enemy(num1: integer);
{like load_player but puts it into en^}

procedure save_enemy(num1: integer);
{like save_player but saves from en^}

procedure load_setup;
procedure save_setup;
{these save and load the setup info.  Some of it you can look at and
change, check STRUCTS.PAS for more info}

procedure build_index;
{REALLY IMPORANT!!  Use this before you do anything.  It creates the
array of for the player index.  Use this everytime you want to update it
also, its quick.  It checks the entire trader.dat file.}

procedure build_world;
{like above but builds planet index.  Your IGM may have nothing to do
with moving to other planets ect, but if you do..}

procedure find_planet;
{ looks at pl^.planet and loads up that record, and creates
  a file called PNOW(player number, in play).TMP.  Using DISPLAYFILE on
  it works.  It uses a `k for the keypress in the middle, in case you
  can't figure out where that is coming from.}

procedure planet_save( nu: integer);
  {saves a planet.  Usually, before a save you load it, change the var,
   then save it.  This means multiple people can use and change stats
   on the same planet without crazy things happening.}


procedure ssfile(filen,databank: string;skip_en,pause:boolean);
{this will show a file inside a @# dat file, use this to show the Alliance
 headquarters for instance:

 ssfile('GHEAD',dir1+'PLANTXT.DAT', true, false);
}

procedure copy_ship_to_pl(copy_all: boolean);
{copies info from the ship record in memory to the players ship}

function get_access_easy(pla: integer): boolean;
{pla is a player #, it returns TRUE if he *or* someone in his cartel
owns the planet the CURRENT player is on}


procedure full_message(name,s1,s2,s3,s4,s5: string; who: integer);
{Use this to send a message to someone quick.  It can be up to five lines
, just use s2 := ''; ect if you don't need that many.  Who is the players
number this is going to be sent to.}

procedure write_mail;
{Asks the person who they want to write, then runs the below routine
 automatically}

procedure write_letter(fn: string; address: integer);
{Lets user write a letter, fn is the temp file it will use, (should
probably be TEMP<play>.TMP (play is the current users #, remember?)
Address is the player # to send it to when done.

If corp_special = TRUE then the letter will be sent to everyone on his
corp, and address won't matter.}

procedure send_mail(player: integer; file_name: string);
{sends mail to player # directly from a text file}


procedure load_ship(sh:integer);
{loads a ship type into shipd^}

procedure get_max_ship;
{gets max ship records, puts it into get_max_ships}

procedure key; {this is important.  Its not just a [MORE] prompt, but also
checks for mail.  It wil handle replying, ect also as needed.  Call this
often, so mail can pass freely through your IGM. }
procedure sread_seth(var ch: char; things: string);
{check testigm for more info, it is a quick way to read from a users
hotkey.  For a Y N question with a default of N, (hitting enter is N) you
would do this.

sread_seth(ch,'NY');

Because N is first it will make that the default.  It will not echo
incorrect keystrokes and will only continue once it gets a N or Y in this
case.  (could be up to 255 chars)
}
procedure get_max_cartel;
procedure load_cartel(sh:integer);
procedure save_cartel(sh:integer);
function add_Cartel: integer;

function cart_name(ii: integer) : string;
{send it a player #, and it returns their name, OR if they are on
a cartel it shows their cartel # and name INSTEAD - used to show who owns
things.  (like planets)  It adds M and A as needed}

procedure planet_touch(var oo: string; number1: integer);
{Send it a planet #, and it changes the string var sent
to a line of more info about the planet, including M and A, P if its
private (no beacon) and a cartel # if a cartel owns it.  Use it whenever
representing a planet.}


procedure key1;
{Same as KEY but doesn't check for mail.. Some places it might get in the
way, so use this one instead.}
procedure planet_load( nu: integer);
{load a planet by number}
procedure get_name(var nummy: longint);
{
** big time saver here **

prompts user a for a name, allows partial searches, ect, returns 0 if it
never found the one the user wanted, else the # of the person they
chose.  If it equals play, they chose themselves.}

function check_mail: boolean;
{checks for mail.  Used inside of key; - you could call this directly if
you didn't need a [more] keypress but wanted to check their mail.}

procedure say(x,y: shortint; line: string);
{this was used for the chatter when the ship is in mid flight.  It pauses
according to the string in time, or accepts a keypress to continue, then
deletes the line it made}

procedure load_npc(num1: integer); {load an NPC by #}

procedure add_log(j: string);
{Lets you add a string to the LOG file easily.  This one puts exactly
what you put.

This is how you could use it:

add_log(center('`r1  `r0 `!'+pl^.names+' `9has invaded `%'+p_rec^.name+'  `r1  `r0',78));

}

procedure add_l(j: string);
{Like above, but centers it and adds the colored bars so it matches the
rest of the log automatically.

add_l('`3No change in shield prices today `8- `3they remain at `%'+lmon(ss^.c[1].price)) else
}

procedure displayfile(filen: string;skip_en,pause:boolean);
{displays a text/ansi file, if skip_en then the user can skip it by
 hitting space while its being displayed.  If pause then it will pause
every 25 lines with a [more]}


{Mostly DDPLUS routines, check DDPLUS63.ZIP for more info on them}

Procedure DV_Aware_On;
Procedure DV_Pause;
procedure sendtext(s: string);
procedure sgoto_xy(x,y: integer);
Procedure Win_Pause;
procedure close_async_port;
procedure open_async_port;
function  skeypressed: boolean;
procedure sclrscr;
procedure sclreol;
procedure swrite(s: string);
procedure swritec(ch: char);
procedure swriteln(s: string);
procedure sread_char(var ch: char);
procedure sread_ch(var c: char);
procedure doobager(sayit: string);  {used by Seth and Sethln}
procedure done;
procedure sread(var s: string);    {reading strings}
procedure sread_up(var s: string); {reading strings, uppercase echo only}
procedure erase_backwords(wx: longint);
procedure sread_num(var n: integer);
procedure save_npc(num1: integer);
procedure sread_num_byte(var b: byte);
procedure sread_num_longint(var n: longint);
function  time_left: integer;
procedure set_foreground(f: byte);
procedure set_background(b: byte);
procedure set_color(f,b: byte);
procedure prompt(var s: string; le: integer; pc: boolean);
Procedure elapsed(time1_hour, time1_min, time1_sec, time2_hour, time2_min,
                  time2_sec: longint; var elap_hour, elap_min, elap_sec: word);
procedure get_stacked(var s: string);
procedure sread_char_filtered(var ch: char);
procedure display_status;
procedure InitDoorDriver;
function  Time_used: integer;
