*/
Got something to write about? Check out our Article Builder.
*/

View \EDITTEST.PAS

DoorDriver v4.00

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


{$V-}
uses doordriv,cfgeditr,crt,ddscott; {Uses unit CFGEDITR for the template procedures}


var
 name,alias,secret_word,quest,alive,weapon,armour,shield:string;
 money,hits:word;

            { ^^^^^ The data for our sample player }


{$F+}           {Far call is now being turned on for the Alt Key Enablement}
procedure Config_editor;
const
 UserEditScreen: templatedef =
                  (Header: 'Demo of the Configurable Editor';
                   Headercolor: green;
                   Titles: (('Name','Alias','Secret Word',
                             'Hits','Money','Quest',
                             '','','',
                             '','','',
                             '','','',
                             '','','',
                             '',''),
                            ('Alive','Weapon','Armour',
                             'Shield','','',
                             '','','',
                             '','','',
                             '', '','','','','','',''));
                   DataLength: ((27,27,27,254,254,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                                (1,15,15,15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
                   Data: (('','','','','','','','','','','','','','','','','','','',''),
                          ('','','','','','','','','','','','','','','','','','','',''));
                   Databyte:    ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                                 (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
                   Dataint:     ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                                 (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
                   Datalongint: ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                                 (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
                   Dataword:    ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                                 (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
                   Startx: 1;
                   Starty: 3;
                   Normalfore: 4; Inversefore: 15; Inverseback: 2; Titlefore: cyan);

procedure dataToTemplate(var template: templatedef);
begin;
 with Template do begin;                  {This is where you transfer     }
  data[1,1]:=name;                        {the users data to the template.}
  data[1,2]:=alias;
  data[1,3]:=secret_word;
  dataword[1,4]:=hits;
  dataword[1,5]:=money;
  data[1,6]:=quest;
  data[2,1]:=alive;
  data[2,2]:=weapon;
  data[2,3]:=armour;
  data[2,4]:=shield;
 end;
end;

procedure TemplateToData(var template: templatedef);
begin;
 with Template do begin;                  {This is where you transfer    }
  name:=data[1,1];                        {New, and changed data from the}
  alias:=data[1,2];                       {Template to the user data     }
  secret_Word:=data[1,3];
  hits:=dataword[1,4];
  money:=dataword[1,5];
  quest:=data[1,6];
  alive:=data[2,1];
  weapon:=data[2,2];
  armour:=data[2,3];
  shield:=data[2,4];
 end;
end;

var
 s,s2: string;
 a,b: integer;
 moresave: boolean;
 blah: word;
 chainout: char;
begin;
 repeat;
  DataToTemplate(UserEditScreen);              {Transfering data to template}


  DoEntry(UserEditScreen,chainout);      {Allows you to modify the current}
                                         {Data in the template}

  TemplateTodata(UserEditScreen);        {Transfering template to data}
 until (chainout=#45);                   {Repeat until ALT-X is encountered}
end;
{$F-}                                    {Far Call is now being turned off}

procedure MakeSampleData;                {Things would be kind of boring}
begin;                                   {without our sample user}
 name:='Derrick Parkhurst';
 alias:='Sir Lancalot';
 secret_word:='BRAVE';
 Hits:=150;
 money:=1000;
 quest:='To Find The Holy Grail';
 Alive:='Y';
 weapon:='Excalibor';
 armour:='Enchanted Mail';
 shield:='Enchanted Shield';
end;

var
 s : string;
begin;
 INITDOORDRIVER('doordriv.ctl');          {DoorDriver must be initialized}


 Proc_Ptr_ar[5]:=@Config_editor;          {Telling DoorDriver where the}
                                          {procedure is and that the }
                                          {the alt key you want is the 5th }
                                          {letter in the alphabet "E"}


                                          {Go on with our normal door business}
 MakeSampleData;
 swriteln('Right now, assume this program is a normal door. The following');
 swriteln('prompt would represent the normal main menu of your door. Pressing');
 swriteln('ALT-E (on the sysop side only) will pop up the configurable editor');
 swriteln('for this door. (again, on the sysop side only). The user will be');
 swriteln('paused while the sysop is editing');
 repeat;
  set_foreground(green);
  swriteln('');
  swrite('Command (?=Help,Q=Quit) ? ');
  set_foreground(white);
  sread(s);
  set_foreground(default_fore);
  s:=stu(s);
  if s='?' then begin;
   set_foreground(cyan);
   swriteln('Since this is a test only, we have no help!');
   swriteln('just press ALT-E to bring up the sysop side configurable editor');
   set_foreground(default_fore);
  end;
 until s='Q';
end.

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.