• (Free) Pascal Oneliners

    From ignatius@46:1/116 to All on Tue Jun 16 17:33:40 2015

    Hi, all,

    First of all, I hope this is the right base for this. I have some problematic code. It has to do with the arrow keys (specifically, up and down arrows). When I press the right arrow key (scancode #77), it executes the "bot_bar" procedure fine. However, when I press the down arrow key (scancode #80) it does not. In fact, the program dies and I am left at the console. It _should_ execute it fine. I absolutely cannot figure out why it doesn't. I've tried different "readkey" procedures, and none of them seem to work. I'm
    hoping someone out there might know what i'm doing wrong. Any and all help is greatly appreciated. Thanks.

    --snip--

    Procedure position;

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

    --snip--

    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');
    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

    --snip--

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

    --snip--

    TIA,
    -ig

    --- Mystic BBS v1.10 (Linux)
    * Origin: Cyberia BBS | Cyberia.Darktech.Org | Kingwood, TX (46:1/116)