• simple sheme for paragraph game in c

    From fir@profesor.fir@gmail.com to comp.lang.c on Sun Aug 10 00:05:33 2025
    From Newsgroup: comp.lang.c



    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
    draw_current_screen(); //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
    last_key=key;
    current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
    text("youre in the middle of the woods, chose what to do:");
    text("1) go north");
    text("2) go south");
    }

    start_()
    {
    key('1', go_north, go_north_); //this function just set callbacks to
    new state
    key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it? note i could replace function key
    by some makro to write KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
    text("youre in the middle of the woods, chose what to do:");
    text("1) go north"); KEY(1, go_north);
    text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big paragraph game) it would simplyfy a hours of typing

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mikko@mikko.levanto@iki.fi to comp.lang.c on Sun Aug 10 13:12:34 2025
    From Newsgroup: comp.lang.c

    On 2025-08-09 22:05:33 +0000, fir said:

    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
    draw_current_screen(); //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
    last_key=key;
    current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
    text("youre in the middle of the woods, chose what to do:");
    text("1) go north");
    text("2) go south");
    }

    start_()
    {
    key('1', go_north, go_north_); //this function just set callbacks to
    new state
    key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it? note i could replace function key
    by some makro to write KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
    text("youre in the middle of the woods, chose what to do:");
    text("1) go north"); KEY(1, go_north);
    text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big paragraph game) it would simplyfy a hours of typing

    You have a set of situations. Each situation involves a place and possibly
    some state information. For each place you need a paragraph of text that
    you need to write. You also need a (hopefully short) paragraph of text
    for each possible value of each state variable.

    The program is simple. The function start does not write anything.
    It just initializes the situation variables and calls the function
    that displays texts as required by the situation variables. On key
    input update situation variables according to the key and call the
    same function as start does.
    --
    Mikko

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Sun Aug 10 15:22:17 2025
    From Newsgroup: comp.lang.c

    Mikko pisze:
    On 2025-08-09 22:05:33 +0000, fir said:

    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
       draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
      last_key=key;
      current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north");
       text("2) go south");
    }

    start_()
    {
       key('1', go_north, go_north_); //this function just set callbacks
    to new state
       key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north"); KEY(1, go_north);
       text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big
    paragraph game) it would simplyfy a hours of typing

    You have a set of situations. Each situation involves a place and possibly some state information. For each place you need a paragraph of text that
    you need to write. You also need a (hopefully short) paragraph of text
    for each possible value of each state variable.

    The program is simple. The function start does not write anything.
    It just initializes the situation variables and calls the function
    that displays texts as required by the situation variables. On key
    input update situation variables according to the key and call the
    same function as start does.

    its not an answer to the question..question it hovever maybe not easy as
    it needs some back focus i think

    the problem is i got 2 entries one is a tree for key kals and secont
    separate is a handler for drawings

    i think to make it simple i should only write the keys based tree,
    but then o cannot draw text from there and would need probebly
    set some pointers form text lines where drawing part wopuld just use


    im not sure if it is worth but probably
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Richard Damon@Richard@Damon-Family.org to comp.lang.c on Sun Aug 10 14:25:45 2025
    From Newsgroup: comp.lang.c

    On 8/9/25 6:05 PM, fir wrote:


    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
      draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
     last_key=key;
     current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
      text("youre in the middle of the woods, chose what to do:");
      text("1) go north");
      text("2) go south");
    }

    start_()
    {
      key('1', go_north, go_north_); //this function just set callbacks to
    new state
      key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
      text("youre in the middle of the woods, chose what to do:");
      text("1) go north"); KEY(1, go_north);
      text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big paragraph game) it would simplyfy a hours of typing


    This sounds very much like would be solved with the Adventure
    Construction Set. That wasn't in C, but should be able to be translated
    to it. Note, the "map" wasn't done in code, but data.

    https://en.wikipedia.org/wiki/Adventure_Construction_Set
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Sun Aug 10 20:42:11 2025
    From Newsgroup: comp.lang.c

    Richard Damon pisze:
    On 8/9/25 6:05 PM, fir wrote:


    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
       draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
      last_key=key;
      current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north");
       text("2) go south");
    }

    start_()
    {
       key('1', go_north, go_north_); //this function just set callbacks
    to new state
       key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north"); KEY(1, go_north);
       text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big
    paragraph game) it would simplyfy a hours of typing


    This sounds very much like would be solved with the Adventure
    Construction Set. That wasn't in C, but should be able to be translated
    to it. Note, the "map" wasn't done in code, but data.

    https://en.wikipedia.org/wiki/Adventure_Construction_Set

    it doesnt seem to be answer to my question ..what i say thet paragraph
    game (paragraph game is just a set os paragraphs/screens of text where
    below yu got options to chose (like 2 or 5) and you jump to another
    paragraphs

    in dos c it could be done like this


    start()
    {
    clear_screen*(;
    text("youre near river and see the boat");
    text("1. go inside the boat");
    text("2. go to the forest");

    k =getch();
    if(k=='1') boat()
    if(k=='2') forest()

    }


    boat()
    {
    clear_screen*(;
    text("you sit in boat you swim 1. down the river 2. up the river");

    k =getch();
    if(k=='1') swim_down_river()
    if(k=='2') swim_up_river()

    }

    forest()
    {
    clear_screen*(;
    text("youre in the forest 1. walk north 2. walk east");
    }


    but in windowsc you got two roots - event handlers and you need to draw
    text in one and take keys in another


    notabene it seem maybe that DOS way witch GETCH() is woser this getch
    just could ba generalized to pop any event that occurs
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Richard Damon@Richard@Damon-Family.org to comp.lang.c on Sun Aug 10 15:41:06 2025
    From Newsgroup: comp.lang.c

    On 8/10/25 2:42 PM, fir wrote:
    Richard Damon pisze:
    On 8/9/25 6:05 PM, fir wrote:


    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
       draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
      last_key=key;
      current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north");
       text("2) go south");
    }

    start_()
    {
       key('1', go_north, go_north_); //this function just set callbacks
    to new state
       key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north"); KEY(1, go_north);
       text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big
    paragraph game) it would simplyfy a hours of typing


    This sounds very much like would be solved with the Adventure
    Construction Set. That wasn't in C, but should be able to be
    translated to it. Note, the "map" wasn't done in code, but data.

    https://en.wikipedia.org/wiki/Adventure_Construction_Set

    it doesnt seem to be answer to my question ..what i say thet paragraph
    game (paragraph game is just a set os paragraphs/screens of text where
    below yu got options to chose (like 2 or 5) and you jump to another paragraphs

    Which is exactly what ACS did.

    Only it didn't create a lot of code for each of the screens, but built a fairly simple datastructure for the game.

    As I remember, it created an array of node of a size gotten from the
    begining of the file.

    Each node had a pointer to the string that was printed when you reached
    that node, and a list of keys you could press, and what state those took
    you to.

    I seem to remember it having a way to mark some options conditional on having/not having a given object that you might find on the way.


    in dos c it could be done like this


    start()
    {
      clear_screen*(;
      text("youre near river and see the boat");
      text("1. go inside the boat");
      text("2. go to the forest");

     k =getch();
    if(k=='1') boat()
    if(k=='2') forest()

    }


    boat()
    {
      clear_screen*(;
      text("you sit in boat you swim 1. down the river 2. up the river");

     k =getch();
    if(k=='1') swim_down_river()
    if(k=='2') swim_up_river()

    }

    forest()
    {
      clear_screen*(;
     text("youre in the forest 1. walk north 2. walk east");
    }


    but in windowsc you got two roots - event handlers and you need to draw
    text in one and take keys in another


    notabene it seem maybe that DOS way witch GETCH() is woser this getch
    just could ba generalized to pop any event that occurs

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mikko@mikko.levanto@iki.fi to comp.lang.c on Mon Aug 11 10:12:41 2025
    From Newsgroup: comp.lang.c

    On 2025-08-10 13:22:17 +0000, fir said:

    Mikko pisze:
    On 2025-08-09 22:05:33 +0000, fir said:

    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
       draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
      last_key=key;
      current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north");
       text("2) go south");
    }

    start_()
    {
       key('1', go_north, go_north_); //this function just set callbacks to >>> new state
       key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north"); KEY(1, go_north);
       text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big
    paragraph game) it would simplyfy a hours of typing

    You have a set of situations. Each situation involves a place and possibly >> some state information. For each place you need a paragraph of text that
    you need to write. You also need a (hopefully short) paragraph of text
    for each possible value of each state variable.

    The program is simple. The function start does not write anything.
    It just initializes the situation variables and calls the function
    that displays texts as required by the situation variables. On key
    input update situation variables according to the key and call the
    same function as start does.

    its not an answer to the question..question it hovever maybe not easy
    as it needs some back focus i think

    Sometimes it is easier to not answer a qesstion but to do something else
    that does not need the answer.
    --
    Mikko

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mikko@mikko.levanto@iki.fi to comp.lang.c on Mon Aug 11 10:16:05 2025
    From Newsgroup: comp.lang.c

    On 2025-08-10 18:25:45 +0000, Richard Damon said:

    On 8/9/25 6:05 PM, fir wrote:


    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
      draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
     last_key=key;
     current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
      text("youre in the middle of the woods, chose what to do:");
      text("1) go north");
      text("2) go south");
    }

    start_()
    {
      key('1', go_north, go_north_); //this function just set callbacks to
    new state
      key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
      text("youre in the middle of the woods, chose what to do:");
      text("1) go north"); KEY(1, go_north);
      text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big
    paragraph game) it would simplyfy a hours of typing


    This sounds very much like would be solved with the Adventure
    Construction Set. That wasn't in C, but should be able to be translated
    to it. Note, the "map" wasn't done in code, but data.

    https://en.wikipedia.org/wiki/Adventure_Construction_Set

    For a text only game making one's own engine is as easy as to find
    a good enough one (unless one already has one).
    --
    Mikko

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Tue Aug 12 13:27:04 2025
    From Newsgroup: comp.lang.c

    Mikko pisze:
    On 2025-08-10 13:22:17 +0000, fir said:

    Mikko pisze:
    On 2025-08-09 22:05:33 +0000, fir said:

    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
       draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
      last_key=key;
      current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north");
       text("2) go south");
    }

    start_()
    {
       key('1', go_north, go_north_); //this function just set callbacks >>>> to new state
       key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north"); KEY(1, go_north);
       text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big >>>> paragraph game) it would simplyfy a hours of typing

    You have a set of situations. Each situation involves a place and
    possibly
    some state information. For each place you need a paragraph of text that >>> you need to write. You also need a (hopefully short) paragraph of text
    for each possible value of each state variable.

    The program is simple. The function start does not write anything.
    It just initializes the situation variables and calls the function
    that displays texts as required by the situation variables. On key
    input update situation variables according to the key and call the
    same function as start does.

    its not an answer to the question..question it hovever maybe not easy
    as it needs some back focus i think

    Sometimes it is easier to not answer a qesstion but to do something else
    that does not need the answer.

    i answered to myself..it seems the best to write whoel game mechanic in OnKeyDown keyboard handler
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Mikko@mikko.levanto@iki.fi to comp.lang.c on Wed Aug 13 11:45:33 2025
    From Newsgroup: comp.lang.c

    On 2025-08-12 11:27:04 +0000, fir said:

    Mikko pisze:
    On 2025-08-10 13:22:17 +0000, fir said:

    Mikko pisze:
    On 2025-08-09 22:05:33 +0000, fir said:

    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
       draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
      last_key=key;
      current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north");
       text("2) go south");
    }

    start_()
    {
       key('1', go_north, go_north_); //this function just set callbacks >>>>> to new state
       key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will >>>>> make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
       text("youre in the middle of the woods, chose what to do:");
       text("1) go north"); KEY(1, go_north);
       text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big >>>>> paragraph game) it would simplyfy a hours of typing

    You have a set of situations. Each situation involves a place and possibly >>>> some state information. For each place you need a paragraph of text that >>>> you need to write. You also need a (hopefully short) paragraph of text >>>> for each possible value of each state variable.

    The program is simple. The function start does not write anything.
    It just initializes the situation variables and calls the function
    that displays texts as required by the situation variables. On key
    input update situation variables according to the key and call the
    same function as start does.

    its not an answer to the question..question it hovever maybe not easy
    as it needs some back focus i think

    Sometimes it is easier to not answer a qesstion but to do something else
    that does not need the answer.

    i answered to myself..it seems the best to write whoel game mechanic in OnKeyDown keyboard handler

    Yes, if you don't need any other input.
    But you have to choose whether you first branch by the input character
    and then check the situation to determine what to do with htat character
    or brach by the situation and then check the character to determine
    what to do with the situation.
    --
    Mikko

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Richard Damon@Richard@Damon-Family.org to comp.lang.c on Fri Aug 15 14:53:45 2025
    From Newsgroup: comp.lang.c

    On 8/11/25 3:16 AM, Mikko wrote:
    On 2025-08-10 18:25:45 +0000, Richard Damon said:

    On 8/9/25 6:05 PM, fir wrote:


    i might already asked that question (but then i abandoned this
    and today get back to it)

    i need extremally simple schem for coding paragraphs

    in main game part i got two callbacks one is in

    OnDraw()
    {
      draw_current_screen();  //<-- its callback pointer
    }

    OnKeyPressed(int key)
    {
     last_key=key;
     current_key_handler(); //<-- thios is callback for keys
    }

    so in game i need to provide a lot of routines for drawing text
    and a lot for handling keypresses

    it currently look like that


    start()
    {
      text("youre in the middle of the woods, chose what to do:");
      text("1) go north");
      text("2) go south");
    }

    start_()
    {
      key('1', go_north, go_north_); //this function just set callbacks
    to new state
      key('2', go_south, go_south_);
    }

    and so on i could produce hundred paragraphs of this way and it will
    make a net of connected parragraphs


    But it somewhat annoys me as it still seem to moe to be
    to complicated and i needed to be as simple as its possible


    how i could sipmplify it?  note i could replace function key
    by some makro to write  KEY(1, go_north) probbaly
    (i write probably as i dont use macros in c at all and even dont
    remember how to define them, but still its maybe annoying to have 2
    routines for each paragraph

    isnt it possible to write this something like


    start()
    {
      text("youre in the middle of the woods, chose what to do:");
      text("1) go north"); KEY(1, go_north);
      text("2) go south"); KEY(2, go_south);
    }

    ????

    as i could writhe a tons of this paragraphs (thinking about writing big
    paragraph game) it would simplyfy a hours of typing


    This sounds very much like would be solved with the Adventure
    Construction Set. That wasn't in C, but should be able to be
    translated to it. Note, the "map" wasn't done in code, but data.

    https://en.wikipedia.org/wiki/Adventure_Construction_Set

    For a text only game making one's own engine is as easy as to find
    a good enough one (unless one already has one).


    The point is that rather that writting a lot of code for all the
    routines, and repeating yourself over and over with boiler plate.

    You write one simple engine, and "program" the game with data-structure.

    My understanding is that the ACS wasn't written in his prefered
    language, and so he might want to recode it. but its program structure
    solves the problem he was having of need a lot of code which does
    basically the same thing.
    --- Synchronet 3.21a-Linux NewsLink 1.2