!
! Default adventurer script..
!
! (c) DC Software, 1992
!

!------------------------------------------------------------------------!
:@TALK ! Talk to the character !
!------------------------------------------------------------------------!

  if player.hp = 0 then
    writeln( player.name, " is dead!" );
    STOP;
  endif;

  if npc.picture >= 0 then
    viewpcx(npc);
  endif;

! First, say hello.. !
  if NPC.V0 > 0 then
    writeln( "Hello ", player.name, ". What brings you back?" );
  else
    writeln( "Hello. I am ", npc.name, ". How may I help you?" );
  endif;

! Now, set some variables..
  NPC.V0 = 1; ! From know on, remember we've been here

:CHAT
  L3 = getstr("Name","Job","Join","Bye");
  if L3 = -1 goto CSTOP; 

! Handle JOIN differently..
  if L3 = 2 then 
    if npc.level > player.level + 4 then
      writeln( "You are much to inexperienced. Ask me again later!" );
      goto CHAT;
    endif;
    if npc.level < player.level - 6 then
      writeln( "I am much to inexperienced to join you.." );
      goto CHAT;
    endif;
    if group.size = 6 then
      writeln( "Your party is full!" );
      goto CHAT;
    endif;
    if NOT dotext( S0 ) then
      writeln( "Let's get busy!" );
    endif;
    JOIN;
    goto XSTOP;
  endif;

! First, see if the keyword typed is in the character's writeln block !
  if dotext( S0 ) then
    if L3 = 3 goto XSTOP;
    goto CHAT;
  endif;

! It didn't, so try the predefined ones..
  on L3 goto CNAME, CJOB, CHAT, CSTOP;

! Nope, try a 'DEFAULT' line
  if not dotext( "DEFAULT" ) then
    writeln( "I don't know anything about that!" );
  endif;
  goto CHAT;

:CNAME
  writeln( "My name is ", NPC.name, "." );
  GOTO CHAT;

:CJOB
  writeln( "I am a ", npc.type );
  GOTO CHAT;

:CSTOP
  writeln( "Nice talking to you.." );
  goto XSTOP;

! Feel free to expand on this list.. !

!-----------------------------------------------------------------!
! All STOPs now lead here so the screen can be restored if needed !
!-----------------------------------------------------------------!
:XSTOP
  if npc.picture >= 0 then
    paint(window); ! Assumes the picture fits in the window !
  endif;
  STOP;
