Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

crossword!!

13

Comments

  • juice88juice88 Member Posts: 23
    : : : : : : i have some questions about crossword ~
    : : : : : : Please help me!
    : : : : : :
    : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : :
    : : : : : : 2) I want to know does pascal has this function??
    : : : : : : if i input the right answer in the game
    : : : : : : then the colour of text will change to another colour~~
    : : : : : : How can do this??
    : : : : : :
    : : : : : : Suggest the simplest way to me~
    : : : : : : THZ~
    : : : : : :
    : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : :
    : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : :
    : : : : THX~
    : : : : BUT I Have a error200 when i set the text colour.
    : : : :
    : : : :
    : : : :
    : : : :
    : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : :
    : : OK!The problem has been solved.
    : :
    : : 2)I think this method is not suitable in my idea.
    : : My idea is like that:
    : : I had set a display with many letters for the player to choose them.
    : : If they choose a right letter, it will change colour.
    : :
    : : Any other method??
    : :
    : : 3)How to set a timer that count down 30 minutes.
    : :
    : :
    : Here is a little function I write for you to handle the key presses:
    : [code]
    : function ReadText(var UserInput: string; const X, Y: integer): boolean;
    : { This is a non-blocking user entry function
    : Handles the following key-strokes:
    : - Backspace: removes last character
    : - Enter: Sets the result to true
    : - ASCII Code 32 (space) and upwards are valid characters
    : - Removes extended (multi-byte) keypresses
    : Other features:
    : - Reduces flickering by first checking if the user actually pressed a key
    : - positions the input field at X, Y relative to top-left of the screen
    : }
    : begin
    : ReadText := false; { Assume a non-enter key }
    : if KeyPressed then { Check for key-press }
    : begin
    : ch := ReadKey; { Get the ASCII key code }
    : case ch of
    : #0..#7: ;
    : #8: Delete(UserInput, Length(UserInput), 1);
    : #9..#12: ;
    : #13: ReadText := true;
    : #14..#31: ;
    : else UserInput := UserInput + ch;
    : end;
    : while KeyPressed do ReadKey; { Remove extended }
    : GotoXY(X, Y); { Show the result at X, Y }
    : write(UserInput);
    : end;
    : end;
    : [/code]
    : It is untested, but should work.
    :
    I have followed your function but why it can't work ??
    [code]
    function ReadText(var UserInput: string; const X, Y: integer): boolean;
    begin
    ReadText := false; { Assume a non-enter key }
    if KeyPressed then { Check for key-press }
    begin
    GotoXY(X,Y);
    ch := ReadKey; { Get the ASCII key code }
    case ch of
    #0..#7: ;
    #8: Delete(UserInput, Length(UserInput), 1);
    #9 :write('Answer is CLOCK TOWER. (Press ESC to exit)');
    #10..#12: ;
    #13: ReadText := true;
    #14..#26: ;
    #27 :exit; [press ESC then exit]
    #28..#31: ;
    else UserInput := UserInput + ch;
    end;
    while KeyPressed do ReadKey; { Remove extended }
    GotoXY(X, Y); { Show the result at X, Y }
    write(UserInput);
    end;
    end;

    begin
    ClrScr;
    Display;
    GameStartTime := TimeInMin;
    Answer:='LOCKTOWE';
    UserInput:= '';


    for i:=1 to Length(Answer) do
    begin
    repeat
    GotoXY(8,34);
    write(3-(TimeInMin-GameStartTime));

    if i=1 then
    ReadText(UserInput,12,21);

    if i=2 then
    ReadText(UserInput,18,21);

    if i=3 then
    ReadText(UserInput,24,21);

    if i=4 then
    ReadText(UserInput,30,21);

    if i=5 then
    ReadText(UserInput,6,25);

    if i=6 then
    ReadText(UserInput,12,25);

    if i=7 then
    ReadText(UserInput,18,25);

    if i=8 then
    ReadText(UserInput,24,25);


    until (UserInput[i]=Answer[i]) or (TimeInMin > GameStartTime+3);

    if TimeInMin=GameStartTime+3 then
    GotoXY(37,23);
    write('Time Up ! You are loss!');
    exitt(K);
    if K='k' then exit;

    end;

    if ReadText(UserInput,X,Y) then
    begin
    if UserInput[i] <> Answer[i] then
    Get_hint(hint);
    if hint=4 then exitt(K);
    if K='k' then exit;

    if UserInput[1]=Answer[1] then
    textcolor(14);
    GotoXY(11,13);
    write('L') ; {if the letter is right, then the same letter in the Display change color}


    if UserInput[2]=Answer[2] then
    textcolor(14);
    GotoXY(11,15);
    write('O');


    if UserInput[3]=Answer[3] then
    textcolor(14);
    GotoXY(17,15);
    write('C');


    if UserInput[4]=Answer[4] then
    textcolor(14);
    GotoXY(17,17);
    write('K');


    if UserInput[5]=Answer[5] then
    textcolor(14);
    GotoXY(17,9);
    write('T');


    if UserInput[6]=Answer[6] then
    textcolor(14);
    GotoXY(23,9);
    write('O');


    if UserInput[7]=Answer[7] then
    textcolor(14);
    GotoXY(23,11);
    write('W');


    if UserInput[8]=Answer[8] then
    textcolor(14);
    GotoXY(29,11);
    write('E');


    if UserInput=Answer then
    GotoXY(37,22);
    writeln('You are Win!!');
    exitt(K);
    if K='k' then exit;

    end;



    end.
    [/code]








  • juice88juice88 Member Posts: 23
    : : : : : : i have some questions about crossword ~
    : : : : : : Please help me!
    : : : : : :
    : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : :
    : : : : : : 2) I want to know does pascal has this function??
    : : : : : : if i input the right answer in the game
    : : : : : : then the colour of text will change to another colour~~
    : : : : : : How can do this??
    : : : : : :
    : : : : : : Suggest the simplest way to me~
    : : : : : : THZ~
    : : : : : :
    : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : :
    : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : :
    : : : : THX~
    : : : : BUT I Have a error200 when i set the text colour.
    : : : :
    : : : :
    : : : :
    : : : :
    : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : :
    : : OK!The problem has been solved.
    : :
    : : 2)I think this method is not suitable in my idea.
    : : My idea is like that:
    : : I had set a display with many letters for the player to choose them.
    : : If they choose a right letter, it will change colour.
    : :
    : : Any other method??
    : :
    : : 3)How to set a timer that count down 30 minutes.
    : :
    : :
    : Here is a little function I write for you to handle the key presses:
    : [code]
    : function ReadText(var UserInput: string; const X, Y: integer): boolean;
    : { This is a non-blocking user entry function
    : Handles the following key-strokes:
    : - Backspace: removes last character
    : - Enter: Sets the result to true
    : - ASCII Code 32 (space) and upwards are valid characters
    : - Removes extended (multi-byte) keypresses
    : Other features:
    : - Reduces flickering by first checking if the user actually pressed a key
    : - positions the input field at X, Y relative to top-left of the screen
    : }
    : begin
    : ReadText := false; { Assume a non-enter key }
    : if KeyPressed then { Check for key-press }
    : begin
    : ch := ReadKey; { Get the ASCII key code }
    : case ch of
    : #0..#7: ;
    : #8: Delete(UserInput, Length(UserInput), 1);
    : #9..#12: ;
    : #13: ReadText := true;
    : #14..#31: ;
    : else UserInput := UserInput + ch;
    : end;
    : while KeyPressed do ReadKey; { Remove extended }
    : GotoXY(X, Y); { Show the result at X, Y }
    : write(UserInput);
    : end;
    : end;
    : [/code]
    : It is untested, but should work.
    :
    Yes.I have found something not understand.
    This function is a boolean ,how can it write UserInput??
    It juct consider whether the function is true or false~
    What different between using function and procedure??

    How can I contact you expect in this forum ??

  • zibadianzibadian Member Posts: 6,349
    : : : : : : : i have some questions about crossword ~
    : : : : : : : Please help me!
    : : : : : : :
    : : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : : :
    : : : : : : : 2) I want to know does pascal has this function??
    : : : : : : : if i input the right answer in the game
    : : : : : : : then the colour of text will change to another colour~~
    : : : : : : : How can do this??
    : : : : : : :
    : : : : : : : Suggest the simplest way to me~
    : : : : : : : THZ~
    : : : : : : :
    : : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : : :
    : : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : : :
    : : : : : THX~
    : : : : : BUT I Have a error200 when i set the text colour.
    : : : : :
    : : : : :
    : : : : :
    : : : : :
    : : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : : :
    : : : OK!The problem has been solved.
    : : :
    : : : 2)I think this method is not suitable in my idea.
    : : : My idea is like that:
    : : : I had set a display with many letters for the player to choose them.
    : : : If they choose a right letter, it will change colour.
    : : :
    : : : Any other method??
    : : :
    : : : 3)How to set a timer that count down 30 minutes.
    : : :
    : : :
    : : Here is a little function I write for you to handle the key presses:
    : : [code]
    : : function ReadText(var UserInput: string; const X, Y: integer): boolean;
    : : { This is a non-blocking user entry function
    : : Handles the following key-strokes:
    : : - Backspace: removes last character
    : : - Enter: Sets the result to true
    : : - ASCII Code 32 (space) and upwards are valid characters
    : : - Removes extended (multi-byte) keypresses
    : : Other features:
    : : - Reduces flickering by first checking if the user actually pressed a key
    : : - positions the input field at X, Y relative to top-left of the screen
    : : }
    : : begin
    : : ReadText := false; { Assume a non-enter key }
    : : if KeyPressed then { Check for key-press }
    : : begin
    : : ch := ReadKey; { Get the ASCII key code }
    : : case ch of
    : : #0..#7: ;
    : : #8: Delete(UserInput, Length(UserInput), 1);
    : : #9..#12: ;
    : : #13: ReadText := true;
    : : #14..#31: ;
    : : else UserInput := UserInput + ch;
    : : end;
    : : while KeyPressed do ReadKey; { Remove extended }
    : : GotoXY(X, Y); { Show the result at X, Y }
    : : write(UserInput);
    : : end;
    : : end;
    : : [/code]
    : : It is untested, but should work.
    : :
    : Yes.I have found something not understand.
    : This function is a boolean ,how can it write UserInput??
    : It juct consider whether the function is true or false~
    : What different between using function and procedure??
    :
    : How can I contact you expect in this forum ??
    :
    :
    The function also exports the UserInput parameter (it's a var parameter). The function returns true if the user presses ENTER. You can use this function like a readln if you place it in a repeat-until loop. Inside that loop, you can then perform other code, such as checking for time. Here is an example:
    [code]
    repeat
    until (ReadText(UserInput, 10, 10)) or (Now = EndTime);
    [/code]
    The difference between a function and a procedure is that a function returns a result, while a procedure doesn't. This allows functions to become a part of a larger statement, while procedures are single statements. KeyPressed() is also examples of a function. If KeyPressed was a procedure, I would have had to code the part of the ReadText() function as follows:
    [code]
    begin
    ReadText := false; { Assume a non-enter key }
    KeyPressed(SomeBool);
    if SomeBool then { Check for key-press }
    begin
    [/code]
    and add another temporary variable.
    The ways to contact me are on My Page here at this site.
  • juice88juice88 Member Posts: 23
    : : : : : : : : i have some questions about crossword ~
    : : : : : : : : Please help me!
    : : : : : : : :
    : : : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : : : :
    : : : : : : : : 2) I want to know does pascal has this function??
    : : : : : : : : if i input the right answer in the game
    : : : : : : : : then the colour of text will change to another colour~~
    : : : : : : : : How can do this??
    : : : : : : : :
    : : : : : : : : Suggest the simplest way to me~
    : : : : : : : : THZ~
    : : : : : : : :
    : : : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : : : :
    : : : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : : : :
    : : : : : : THX~
    : : : : : : BUT I Have a error200 when i set the text colour.
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : : : :
    : : : : OK!The problem has been solved.
    : : : :
    : : : : 2)I think this method is not suitable in my idea.
    : : : : My idea is like that:
    : : : : I had set a display with many letters for the player to choose them.
    : : : : If they choose a right letter, it will change colour.
    : : : :
    : : : : Any other method??
    : : : :
    : : : : 3)How to set a timer that count down 30 minutes.
    : : : :
    : : : :
    : : : Here is a little function I write for you to handle the key presses:
    : : : [code]
    : : : function ReadText(var UserInput: string; const X, Y: integer): boolean;
    : : : { This is a non-blocking user entry function
    : : : Handles the following key-strokes:
    : : : - Backspace: removes last character
    : : : - Enter: Sets the result to true
    : : : - ASCII Code 32 (space) and upwards are valid characters
    : : : - Removes extended (multi-byte) keypresses
    : : : Other features:
    : : : - Reduces flickering by first checking if the user actually pressed a key
    : : : - positions the input field at X, Y relative to top-left of the screen
    : : : }
    : : : begin
    : : : ReadText := false; { Assume a non-enter key }
    : : : if KeyPressed then { Check for key-press }
    : : : begin
    : : : ch := ReadKey; { Get the ASCII key code }
    : : : case ch of
    : : : #0..#7: ;
    : : : #8: Delete(UserInput, Length(UserInput), 1);
    : : : #9..#12: ;
    : : : #13: ReadText := true;
    : : : #14..#31: ;
    : : : else UserInput := UserInput + ch;
    : : : end;
    : : : while KeyPressed do ReadKey; { Remove extended }
    : : : GotoXY(X, Y); { Show the result at X, Y }
    : : : write(UserInput);
    : : : end;
    : : : end;
    : : : [/code]
    : : : It is untested, but should work.
    : : :

    : The function also exports the UserInput parameter (it's a var parameter). The function returns true if the user presses ENTER. You can use this function like a readln if you place it in a repeat-until loop. Inside that loop, you can then perform other code, such as checking for time. Here is an example:
    : [code]
    : repeat
    : until (ReadText(UserInput, 10, 10)) or (Now = EndTime);
    : [/code]

    But when I do it like this??
    [code]
    repeat
    ReadText(UserInput,10,10);
    until (ReadText(UserInput, 10, 10))

    if (ReadText(UserInput, 10, 10)) then
    begin
    if UserInput<> Answer then <--##
    writeln('Loss');
    else
    writeln('Win');
    end;
    end.
    [/code]

    the program just do the repeat loop.
    I think that it is because the UserInput can not be export
    ,so it can't check the answer.

  • zibadianzibadian Member Posts: 6,349
    : : : : : : : : : i have some questions about crossword ~
    : : : : : : : : : Please help me!
    : : : : : : : : :
    : : : : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : : : : :
    : : : : : : : : : 2) I want to know does pascal has this function??
    : : : : : : : : : if i input the right answer in the game
    : : : : : : : : : then the colour of text will change to another colour~~
    : : : : : : : : : How can do this??
    : : : : : : : : :
    : : : : : : : : : Suggest the simplest way to me~
    : : : : : : : : : THZ~
    : : : : : : : : :
    : : : : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : : : : :
    : : : : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : : : : :
    : : : : : : : THX~
    : : : : : : : BUT I Have a error200 when i set the text colour.
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : : : : :
    : : : : : OK!The problem has been solved.
    : : : : :
    : : : : : 2)I think this method is not suitable in my idea.
    : : : : : My idea is like that:
    : : : : : I had set a display with many letters for the player to choose them.
    : : : : : If they choose a right letter, it will change colour.
    : : : : :
    : : : : : Any other method??
    : : : : :
    : : : : : 3)How to set a timer that count down 30 minutes.
    : : : : :
    : : : : :
    : : : : Here is a little function I write for you to handle the key presses:
    : : : : [code]
    : : : : function ReadText(var UserInput: string; const X, Y: integer): boolean;
    : : : : { This is a non-blocking user entry function
    : : : : Handles the following key-strokes:
    : : : : - Backspace: removes last character
    : : : : - Enter: Sets the result to true
    : : : : - ASCII Code 32 (space) and upwards are valid characters
    : : : : - Removes extended (multi-byte) keypresses
    : : : : Other features:
    : : : : - Reduces flickering by first checking if the user actually pressed a key
    : : : : - positions the input field at X, Y relative to top-left of the screen
    : : : : }
    : : : : begin
    : : : : ReadText := false; { Assume a non-enter key }
    : : : : if KeyPressed then { Check for key-press }
    : : : : begin
    : : : : ch := ReadKey; { Get the ASCII key code }
    : : : : case ch of
    : : : : #0..#7: ;
    : : : : #8: Delete(UserInput, Length(UserInput), 1);
    : : : : #9..#12: ;
    : : : : #13: ReadText := true;
    : : : : #14..#31: ;
    : : : : else UserInput := UserInput + ch;
    : : : : end;
    : : : : while KeyPressed do ReadKey; { Remove extended }
    : : : : GotoXY(X, Y); { Show the result at X, Y }
    : : : : write(UserInput);
    : : : : end;
    : : : : end;
    : : : : [/code]
    : : : : It is untested, but should work.
    : : : :
    :
    : : The function also exports the UserInput parameter (it's a var parameter). The function returns true if the user presses ENTER. You can use this function like a readln if you place it in a repeat-until loop. Inside that loop, you can then perform other code, such as checking for time. Here is an example:
    : : [code]
    : : repeat
    : : until (ReadText(UserInput, 10, 10)) or (Now = EndTime);
    : : [/code]
    :
    : But when I do it like this??
    : [code]
    : repeat
    : ReadText(UserInput,10,10);
    : until (ReadText(UserInput, 10, 10))
    :
    : if (ReadText(UserInput, 10, 10)) then
    : begin
    : if UserInput<> Answer then <--##
    : writeln('Loss');
    : else
    : writeln('Win');
    : end;
    : end.
    : [/code]
    :
    : the program just do the repeat loop.
    : I think that it is because the UserInput can not be export
    : ,so it can't check the answer.
    :
    :
    UserInput is being exported, that's what the var before UserInput is for.
    The repeat until loop you created will not work, because it has a ReadText() inside it. This way the user might press enter for the inner ReadText() and still remain inside the loop. You can however show the time remaining in the loop, like this:
    [code]
    repeat
    GotoXY(1,1);
    Writeln(i);
    inc(i);
    until ReadText(UsderInput, 10, 10);
    if UserInput = Answer then
    Writeln('You win')
    else
    Writeln('You lose');
    [/code]
    You don't need to call ReadText() in the if-then, because the user doesn't have to enter his answer again. In fact your code will check the answer only if the user presses the enter again within a few milliseconds after the first time.
    Run this last code and you'll see what I mean.
  • juice88juice88 Member Posts: 23
    : : : : : : : : : : i have some questions about crossword ~
    : : : : : : : : : : Please help me!
    : : : : : : : : : :
    : : : : : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : : : : : :
    : : : : : : : : : : 2) I want to know does pascal has this function??
    : : : : : : : : : : if i input the right answer in the game
    : : : : : : : : : : then the colour of text will change to another colour~~
    : : : : : : : : : : How can do this??
    : : : : : : : : : :
    : : : : : : : : : : Suggest the simplest way to me~
    : : : : : : : : : : THZ~
    : : : : : : : : : :
    : : : : : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : : : : : :
    : : : : : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : : : : : :
    : : : : : : : : THX~
    : : : : : : : : BUT I Have a error200 when i set the text colour.
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : : : : : :
    : : : : : : OK!The problem has been solved.
    : : : : : :
    : : : : : : 2)I think this method is not suitable in my idea.
    : : : : : : My idea is like that:
    : : : : : : I had set a display with many letters for the player to choose them.
    : : : : : : If they choose a right letter, it will change colour.
    : : : : : :
    : : : : : : Any other method??
    : : : : : :
    : : : : : : 3)How to set a timer that count down 30 minutes.
    : : : : : :
    : : : : : :
    : : : : : Here is a little function I write for you to handle the key presses:
    : : : : : [code]
    : : : : : function ReadText(var UserInput: string; const X, Y: integer): boolean;
    : : : : : { This is a non-blocking user entry function
    : : : : : Handles the following key-strokes:
    : : : : : - Backspace: removes last character
    : : : : : - Enter: Sets the result to true
    : : : : : - ASCII Code 32 (space) and upwards are valid characters
    : : : : : - Removes extended (multi-byte) keypresses
    : : : : : Other features:
    : : : : : - Reduces flickering by first checking if the user actually pressed a key
    : : : : : - positions the input field at X, Y relative to top-left of the screen
    : : : : : }
    : : : : : begin
    : : : : : ReadText := false; { Assume a non-enter key }
    : : : : : if KeyPressed then { Check for key-press }
    : : : : : begin
    : : : : : ch := ReadKey; { Get the ASCII key code }
    : : : : : case ch of
    : : : : : #0..#7: ;
    : : : : : #8: Delete(UserInput, Length(UserInput), 1);
    : : : : : #9..#12: ;
    : : : : : #13: ReadText := true;
    : : : : : #14..#31: ;
    : : : : : else UserInput := UserInput + ch;
    : : : : : end;
    : : : : : while KeyPressed do ReadKey; { Remove extended }
    : : : : : GotoXY(X, Y); { Show the result at X, Y }
    : : : : : write(UserInput);
    : : : : : end;
    : : : : : end;
    : : : : : [/code]
    : : : : : It is untested, but should work.
    : : : : :
    : :
    : : : The function also exports the UserInput parameter (it's a var parameter). The function returns true if the user presses ENTER. You can use this function like a readln if you place it in a repeat-until loop. Inside that loop, you can then perform other code, such as checking for time. Here is an example:
    : : : [code]
    : : : repeat
    : : : until (ReadText(UserInput, 10, 10)) or (Now = EndTime);
    : : : [/code]
    : :
    : : But when I do it like this??
    : : [code]
    : : repeat
    : : ReadText(UserInput,10,10);
    : : until (ReadText(UserInput, 10, 10))
    : :
    : : if (ReadText(UserInput, 10, 10)) then
    : : begin
    : : if UserInput<> Answer then <--##
    : : writeln('Loss');
    : : else
    : : writeln('Win');
    : : end;
    : : end.
    : : [/code]
    : :
    : : the program just do the repeat loop.
    : : I think that it is because the UserInput can not be export
    : : ,so it can't check the answer.
    : :
    : :
    : UserInput is being exported, that's what the var before UserInput is for.
    : The repeat until loop you created will not work, because it has a ReadText() inside it. This way the user might press enter for the inner ReadText() and still remain inside the loop. You can however show the time remaining in the loop, like this:
    : [code]
    : repeat
    : GotoXY(1,1);
    : Writeln(i);
    : inc(i);
    : until ReadText(UsderInput, 10, 10);
    : if UserInput = Answer then
    : Writeln('You win')
    : else
    : Writeln('You lose');
    : [/code]
    : You don't need to call ReadText() in the if-then, because the user doesn't have to enter his answer again. In fact your code will check the answer only if the user presses the enter again within a few milliseconds after the first time.
    : Run this last code and you'll see what I mean.
    :

    Oh ~I see.
    Is it like this:
    [code]
    repeat
    : GotoXY(1,1);
    : Writeln(3-(TimeInMin-GameStartTime));
    : inc(3-(TimeInMin-GameStartTime)); <---what is inc??
    : until ReadText(UsderInput, 10, 10) <---But how to move to next question??
    : if UserInput[i] <> Answer[i] then
    begin
    Get_hint
    if hint>4 then
    Writeln('You lose')
    : else
    : Writeln('You lose');
    end;
    end.

  • zibadianzibadian Member Posts: 6,349
    : : : : : i have some questions about crossword ~
    : : : : : Please help me!
    : : : : :
    : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : :
    : : : : : 2) I want to know does pascal has this function??
    : : : : : if i input the right answer in the game
    : : : : : then the colour of text will change to another colour~~
    : : : : : How can do this??
    : : : : :
    : : : : : Suggest the simplest way to me~
    : : : : : THZ~
    : : : : :
    : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : :
    : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : :
    : : : THX~
    : : : BUT I Have a error200 when i set the text colour.
    : : :
    : : :
    : : :
    : : :
    : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : :
    : OK!The problem has been solved.
    :
    : 2)I think this method is not suitable in my idea.
    : My idea is like that:
    : I had set a display with many letters for the player to choose them.
    : If they choose a right letter, it will change colour.
    :
    : Any other method??
    :
    : 3)How to set a timer that count down 30 minutes.
    :
    :
    Inc is short for increase, which should be explained in the help files.
    ReadText() is designed to get the whole answer in 1 loop, then you can check it and ask the user the next question.
  • juice88juice88 Member Posts: 23
    [b][red]This message was edited by juice88 at 2005-1-6 7:45:47[/red][/b][hr]
    [b][red]This message was edited by juice88 at 2005-1-6 7:45:7[/red][/b][hr]
    : : : : : : i have some questions about crossword ~
    : : : : : : Please help me!
    : : : : : :
    : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : :
    : : : : : : 2) I want to know does pascal has this function??
    : : : : : : if i input the right answer in the game
    : : : : : : then the colour of text will change to another colour~~
    : : : : : : How can do this??
    : : : : : :
    : : : : : : Suggest the simplest way to me~
    : : : : : : THZ~
    : : : : : :
    : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : :
    : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : :
    : : : : THX~
    : : : : BUT I Have a error200 when i set the text colour.
    : : : :
    : : : :
    : : : :
    : : : :
    : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : :
    : : OK!The problem has been solved.
    : :
    : : 2)I think this method is not suitable in my idea.
    : : My idea is like that:
    : : I had set a display with many letters for the player to choose them.
    : : If they choose a right letter, it will change colour.
    : :
    : : Any other method??
    : :
    : : 3)How to set a timer that count down 30 minutes.
    : :
    : :
    : Inc is short for increase, which should be explained in the help files.
    : ReadText() is designed to get the whole answer in 1 loop, then you can check it and ask the user the next question.


    But how the program know when should it increase??
    What is the use of this inc() comment in the crossword??

    NO~ I want to get each of the letter in loop,then i can check it one by one and move to next letter if the user entered is right.

    layout
    [code]
    ###########################################
    # # # # # # #
    # # # # # # #
    ###########################################
    [/code]
    There are 6 boxes, the user need to enter the first letter in the first box and press enter and then check it .If the letter is right ,then (GotoXY) move to next box and enter the second letter......Therefore the coordinateXY of each boxes are different .

    So how can the function work in this way??

    :





  • Xaser-3Xaser-3 Member Posts: 9
    : i have some questions about crossword ~
    : Please help me!
    :
    : 1) How to set the background colour and text colour in pascal??
    :
    : 2) I want to know does pascal has this function??
    : if i input the right answer in the game
    : then the colour of text will change to another colour~~
    : How can do this??
    :
    : Suggest the simplest way to me~
    : THZ~
    :

    To set the background colour in Pascal use this: textbackground(colour); {colour is where you have to put your colour which you want } and for text colour use this: textcolor(colour);

    Yes no.2 can be done in Pascal but I don't know how.

    Xaser-3



  • zibadianzibadian Member Posts: 6,349
    : : i have some questions about crossword ~
    : : Please help me!
    : :
    : : 1) How to set the background colour and text colour in pascal??
    : :
    : : 2) I want to know does pascal has this function??
    : : if i input the right answer in the game
    : : then the colour of text will change to another colour~~
    : : How can do this??
    : :
    : : Suggest the simplest way to me~
    : : THZ~
    : :
    :
    : To set the background colour in Pascal use this: textbackground(colour); {colour is where you have to put your colour which you want } and for text colour use this: textcolor(colour);
    :
    : Yes no.2 can be done in Pascal but I don't know how.
    :
    : Xaser-3
    :
    Have you read this post http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=16&MsgID=281521&Setting=A0001F2002 ? It is basically the same answer you gave here.
Sign In or Register to comment.