Subj : Re: MPL
To : IGNATIUS
From : GRYPHON
Date : Thu Jan 31 2019 07:20 pm
On 08/31/14, ignatius said the following...
ig> So, i'm trying to write an MPL. The following script compiles, but
ig> doesn't run. It displays "Ia! Cthulhu!" about a dozen times, then locks
ig> up. If anyone out there can tell me what's wrong with this script,
ig> please let me know. Thanks for any and all help.
ig>
ig>
ig>
ig> #### begin
ig> ##################################################################
ig>
ig> uses
ig> cfg,
ig> user;
ig>
ig> var Twriters : array[1..10] of string;
ig> var Toneliner: array[1..10] of string;
ig> var S : string;
ig> var foneline : string;
ig> var Ch : char;
ig> var Ch2 : char;
ig> var Count : byte;
ig> var Count2 : byte;
ig> var f : file;
ig>
ig> // begin show procedure ######################################
ig>
ig> // Foneline := cfgDataPath + 'oneliner.lst'
ig>
ig> Procedure show()
ig> Begin
ig> clrscr
ig> dispFile('oneh.ans');
ig> For Count := 1 To 10 do
ig> Begin
ig> write('þ ');
ig> write(padRT(Toneliner[count], 64, ' '));
ig> write(' : ');
ig> writeln(padRT(Twriters[count], 10, ' '));
ig> End
ig> End
ig>
ig> // end bot_bar procedure ######################################
ig> // begin top_bar procedure ####################################
ig>
ig> Procedure top_bar();
ig> Begin
ig> dispfile('oney.ans');
ig> Ch2 := ReadKey;
ig> If Ch2 = #13 then
ig> Begin
ig> dispFile('oneline.asc');
ig> Write(': ');
ig> S := stripmci(Input(70, 70, 11, ''));
ig> If S = '' then
ig> WriteLn('aborted');
ig> Halt
ig> End
ig>
ig> For Count := 1 To 9 do
ig> Begin
ig> Count2 := Count + 1;
ig> Toneliner[count] := Toneliner[count2];
ig> Twriters[count] := Twriters[count2];
ig> End
ig>
ig> tWriters[10] := userAlias;
ig> tOneliner[10] := S;
ig>
ig> fassign(f, foneline, 66);
ig> freset(f);
ig> For Count := 1 To 10 do
ig> Begin
ig> fWriteLn(f, tOneliner[count]);
ig> fWriteLn(f, tWriters[count]);
ig> End
ig> fClose(f);
ig>
ig> show();
ig> End
ig>
ig> // end top_bar procedure ######################################
ig> // begin position procedure ###################################
ig>
ig> Procedure position();
ig> begin
ig> Repeat
ig> DispFile('onen.ans');
ig>
ig> Ch := ReadKey;
ig> If IsArrow and Ch = #80 then
ig> Begin
ig> dispfile('onen.ans');
ig> top_bar();
ig> End
ig> Else if IsArrow and Ch = #72 then
ig> top_bar();
ig>
ig> Until Ch = #13;
ig> End
ig>
ig> Procedure bot_bar();
ig> begin
ig> dispFile('onen.ans');
ig> Ch2 := ReadKey
ig> If Ch2 = #13 then
ig> MenuCmd('go', 'main');
ig> Halt;
ig> End
ig>
ig> // end position procedure ##########################################
ig>
ig> // This starts the main program here.
ig> Begin
ig>
ig> If Not fileExist(foneline) Then
ig> Begin
ig> fassign(f, foneline, 66);
ig> fReWrite(f);
ig> For count := 1 To 10 do
ig> begin
ig> fWriteLn(f, 'Ia! Cthulhu!');
ig> fWriteLn(f, 'ignatius');
ig> End
ig> fClose(f);
ig> End
ig>
ig> Foneline := cfgDataPath + 'oneliner.lst'
You have defined Foneline AFTER you tried to use it above in the fassign
function.
ig>
ig> fassign(f, foneline, 66);
ig> freset(f);
ig> For Count := 1 To 10 do;
ig> Begin
ig> fReadLn(f, Toneliner[count]);
ig> fReadLn(f, Twriters[count]);
ig> End
ig> fClose(f);
ig>
ig> show();
ig>
ig> // end show procedure #########################################
ig> // begin bot_bar procedure ####################################
ig>
ig> End
ig>
ig> Done
ig>
ig> ## end
ig> ######################################################################
ig>
ig> TIA,
ig>
ig> |09ignatius |07(|15cia|07/|15scrollz|07)
ig>
ig> --- Mystic BBS v1.10 A51 (Linux)
ig> * Origin: catch22bbs.com (46:1/124)
"No matter where you go, there you are!" - B. Bonzai