• Some code i'm having problems with.

    From Joseph Larsen@1:2320/100 to All on Sat Feb 13 00:58:02 2016
    Here's some code. The problem is that I have to press the down arrow key
    twice before it executes the "bot_bar" procedure. If anyone could help, or
    take a look at it, i'd appreciate it.

    --//--snip-------------------------

    procedure oneliners;

    var Twriters : array[1..10] of string;
    var Toneliner : array[1..10] of string;
    var S : string;
    var Foneline : string;
    var Ch1 : char;
    var Ch2 : char;
    var Ch3 : char;
    var Count : byte;
    var Count2 : byte;



    Procedure show;

    var Count : byte;

    Begin

    printf('oneh.ans');
    For Count := 1 To 10 Do Begin;
    write('^[[1;37m+ ^[[0;37m');
    write(Twriters[Count]);
    write('^[[1;30m: ^[[0;37m');
    WriteLn(Toneliner[Count]);
    End;
    End; // show

    Procedure init;

    Var f1 : textfile;
    var Count : byte;

    Begin
    fOneLine := ('/home/imp/imp/data/oneliner.lst');
    If Not fileExists(fOneLine) Then Begin
    Assign(f1, fOneLine);
    ReWrite(f1);
    For Count := 1 To 10 Do Begin
    WriteLn(f1,'Ia! Cthulhu!');
    WriteLn(f1,'IGNATIUS');
    End;
    Close(f1);
    End;

    Assign(f1, fOneLine);
    Reset(f1);
    If IoResult = 0 Then Begin
    For Count := 1 To 10 Do Begin
    ReadLn(f1, Toneliner[Count]);
    ReadLn(f1, Twriters[Count]);
    End;
    Close(f1);
    End;
    End; // Init

    Procedure bot_bar;
    Begin
    printf('onen.ans');
    Ch2 := ReadKey;
    If Ch2 = #13 then Begin
    exit;
    End;
    show;
    End; // bot_bar

    Procedure top_bar;

    Var f1 : textfile;
    var Count : byte;
    var ch3 : char;


    Begin
    printf('oney.ans');
    Ch3 := ReadKey;
    If Ch3 = #13 then Begin
    printf('oneline.asc');
    Write('^[[3;3H');
    inputl(s,70);
    If s = '' then Begin
    WriteLn('^[[1;30maborted^[[0;37m');
    show;
    Exit;
    End;
    For Count := 1 To 9 Do Begin
    Count2 := Count + 1;
    Toneliner[Count] := Toneliner[Count2];
    Twriters[Count] := Twriters[Count2];
    End;

    tWriters[10]:=thisuser.name;
    tOneliner[10] := s;

    Assign(f1, fOneLine);
    ReWrite(f1);
    For Count := 1 To 10 do Begin
    WriteLn(f1,tOneliner[Count]);
    WriteLn(f1,tWriters[Count]);
    End;
    Close(f1);
    End;
    show;
    End; // top_bar

    Procedure position;

    Begin
    show;
    Repeat
    printf('onen.ans');
    ch1:=ReadKey;
    case ch1 of
    #0 : begin
    ch1:=ReadKey;
    case ch1 of
    #80 : bot_bar;
    #72 : top_bar;
    end;
    end;
    end;
    until ch1=#13
    end;

    Begin
    init;
    Position;
    End;

    --//--snip------------------------

    Thanks,

    |09ignatius |07[|15cia|07]

    --- Mystic BBS v1.11 (Linux)
    # Origin: catch22bbs.com >>> >> > (1:340/800)
    # Origin: LiveWire BBS -=*=- telnet://livewirebbs.com (1:2320/100)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)
  • From Mark Lewis@1:2320/100 to Joseph Larsen on Sat Feb 13 10:50:02 2016
    13 Feb 16 00:50, you wrote to All:

    Here's some code. The problem is that I have to press the down arrow key twice before it executes the "bot_bar" procedure. If anyone could help, or take a look at it, i'd appreciate it.

    some parts are missing for others to really be able to compile and test it... what you should do is to simplify it into a standalone program and then work it
    out using general items to replace things like the ans files and thisuer.name and such... the following seems to work fine for me after attempting to trace your logic flow...

    ==== Begin "readkey_test.pas" ====
    Program readkey_test;

    Uses crt;

    Var
    ch1 : char;
    ch2 : char;

    Procedure show;
    Begin
    writeln(' in show');
    End;

    Procedure bot_bar;
    Begin
    writeln(' in bot_bar - display show? enter=no');
    ch2:=readkey;
    if ch2=#13 then begin
    writeln(' readkey=enter - exiting bot_bar');
    exit;
    end;
    show;
    End;

    Procedure top_bar;
    Begin
    writeln(' in top_bar');
    End;


    Begin
    writeln('press uparr, dnarr or enter');
    Repeat
    writeln('in repeat block waiting on readkey');
    ch1:=ReadKey;
    case ch1 of
    #0 : begin
    writeln('readkey=nul - reading next key');
    ch1:=ReadKey;
    case ch1 of
    #72 : begin
    writeln(' readkey=uparr');
    top_bar;
    end;
    #80 : begin
    writeln(' readkey=dnarr');
    bot_bar;
    end;
    end; //case readkey
    end; //begin #0
    end; //case readkey
    until ch1=#13;
    writeln('readkey=enter - exiting program');
    end.
    ==== End "readkey_test.pas" ====

    remember to keep it simple and straightforward...

    )\/(ark

    Always Mount a Scratch Monkey

    ... If it's any good at all they will soon discontinue it.
    ---
    # Origin: (1:3634/12.73)
    # Origin: LiveWire BBS -=*=- telnet://livewirebbs.com (1:2320/100)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)
  • From Joseph Larsen@1:2320/100 to Mark Lewis on Sat Feb 13 16:06:02 2016
    |01 ######[### ## #|CR## quoting |09mark lewis |01on |0902/13/16 |07

    some parts are missing for others to really be able to compile and test it... what you should do is to simplify it into a standalone program and then work it out using general items to replace things like the ans
    files and thisuer.name and such... the following seems to work fine for
    me after attempting to trace your logic flow...


    Could you possibly edit it for me? Should I e-mail the source to you?

    Thanks, man,

    |09ignatius |07[|15cia|07]

    --- Mystic BBS v1.11 (Linux)
    # Origin: catch22bbs.com >>> >> > (1:340/800)
    # Origin: LiveWire BBS -=*=- telnet://livewirebbs.com (1:2320/100)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)
  • From Joseph Larsen@1:2320/100 to Mark Lewis on Sat Feb 13 18:25:02 2016
    |01 ######[### ## #|CR## quoting |09mark lewis |01on |0902/13/16 |07

    did you try the code i sent back?


    No, I haven't. But I will try it out here in a few.

    Thanks,

    |09ignatius |07[|15cia|07]

    --- Mystic BBS v1.12 A2 (Linux)
    # Origin: catch22bbs.com >>> >> > (1:340/800)
    # Origin: LiveWire BBS -=*=- telnet://livewirebbs.com (1:2320/100)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)
  • From Joseph Larsen@1:2320/100 to Joseph Larsen on Sat Feb 13 18:28:02 2016
    |01 ######[### ## #|CR## quoting |09joseph larsen |01on |0902/13/16 |07
    No, I haven't. But I will try it out here in a few.


    Ok. I compiled it, and it works. Wee.

    Thanks,

    |09ignatius |07[|15cia|07]

    --- Mystic BBS v1.12 A2 (Linux)
    # Origin: catch22bbs.com >>> >> > (1:340/800)
    # Origin: LiveWire BBS -=*=- telnet://livewirebbs.com (1:2320/100)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)
  • From Joseph Larsen@1:2320/100 to Joseph Larsen on Sat Feb 13 18:36:02 2016
    |01 ######[### ## #|CR## quoting |09joseph larsen |01on |0902/13/16 |07
    Ok. I compiled it, and it works. Wee.


    Ok. I applied the relevant parts of the code you submitted to the source, and now it takes two key presses to go either up or down. :/

    |09ignatius |07[|15cia|07]

    --- Mystic BBS v1.12 A2 (Linux)
    # Origin: catch22bbs.com >>> >> > (1:340/800)
    # Origin: LiveWire BBS -=*=- telnet://livewirebbs.com (1:2320/100)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)
  • From Mark Lewis@1:2320/100 to Joseph Larsen on Sat Feb 13 20:26:02 2016
    13 Feb 16 15:58, you wrote to me:

    some parts are missing for others to really be able to compile and
    test it... what you should do is to simplify it into a standalone
    program and then work it out using general items to replace things
    like the ans files and thisuer.name and such... the following seems
    to work fine for me after attempting to trace your logic flow...

    Could you possibly edit it for me?

    hehehe... i kinda did to come up with that that i posted... even figuring out that the CRT unit still needed to be used ;)

    Should I e-mail the source to you?

    you may if you like... i don't know if it will work without a working IMP installation, though... that was the idea... reduce it to the barest minimum and have it still work... then convert that to a procedure or whatever in the final code once the proper logic was worked out...

    did you try the code i sent back?

    Thanks, man,

    you're welcome... i do just barely have FPC working... my lazarus stuff is still broken all over the place :(

    )\/(ark

    Always Mount a Scratch Monkey

    ... We who are about to die are taking some of you with us.
    ---
    # Origin: (1:3634/12.73)
    # Origin: LiveWire BBS -=*=- telnet://livewirebbs.com (1:2320/100)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)
  • From Mark Lewis@1:2320/100 to Joseph Larsen on Mon Feb 15 11:57:02 2016
    13 Feb 16 18:28, you wrote to you:

    Ok. I compiled it, and it works. Wee.


    Ok. I applied the relevant parts of the code you submitted to the source, and now it takes two key presses to go either up or down. :/

    then it must be something in what you are doing in those two routines that the keypresses are jumping to... that's why i added the debug writeln statements so
    as to be able to trace the flow properly... the one for top i didn't do anything to, though...

    i understand what you are trying to do but i don't understand your logic flow... i'll try to do something with it later today... not sure, though... depends on how this headache goes... it has had me wrapped up for the last two or three days... i didn't even get out of bed yesterday except for the essential needs :(

    )\/(ark

    Always Mount a Scratch Monkey

    ... I am in touch with my macho grunting drunken hangover college side.
    ---
    # Origin: (1:3634/12.73)
    # Origin: LiveWire BBS -=*=- telnet://livewirebbs.com (1:2320/100)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)