Ideas on how to save and quit after a time without activity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lea2501
    Apprentice
    • Dec 2019
    • 61

    Ideas on how to save and quit after a time without activity

    This is maybe a weird question, but i wanted to ask for ideas about how i can save and quit the game after, lets say, some minutes of inactivity.

    I sync the savegame across two of my computers, at two different places (place A and place B) where i usually stay, the thing is that if i left by accident the game opened without exiting in place A, when i arrive to place B, i don't have my savegame updated (for better or for worse sometimes) so i don't play until i return to place A and continue the game there, remembering to exit so it saves and syncs to place B.

    So i was wondering, its maybe an easy way to bash script or something like that, some sort of timeout so if i don't enter any command or touch the keyboard, it sends the exit command to the game so that it saves where i left? for when i arribe to place B, the timeout period finished and the game exited and saved wihout my interaction, and i can continue to play at place B?

    I know that maybe its better to ssh to one of the computers or something like that, but i don't have the two connected 24/7 every time, and i like to sync them when both are up and running and don't depend on having the one in the other place available when i need.

    Lol, thanks in advance!
  • Pete Mack
    Prophet
    • Apr 2007
    • 6883

    #2
    You'd need a code change.

    There are two ways to do it. The first way requires replacing the blocking read with a timeout read for input. Set the timeout to whatever interval you want, and do a save game followed by exit when it is reached.

    The second is to make the code multi-threaded, so there is a thread that wakes up every X seconds to check for activity. It'd do the same thing, while the main thread updates a clock every time there is activity.

    Comment

    • lea2501
      Apprentice
      • Dec 2019
      • 61

      #3
      Originally posted by Pete Mack
      You'd need a code change.

      There are two ways to do it. The first way requires replacing the blocking read with a timeout read for input. Set the timeout to whatever interval you want, and do a save game followed by exit when it is reached.

      The second is to make the code multi-threaded, so there is a thread that wakes up every X seconds to check for activity. It'd do the same thing, while the main thread updates a clock every time there is activity.
      Thanks for answering... I was thinking something more like a bash script that launch the game and also check for inactivity, or force quit the game if the timeout takes place, i remember some time ago, i force quitted the terminal where the game was running and i didn't lost the progress, so i think that maybe its possible to have a "timeout" command that sends the kill signal to the game.

      Comment

      Working...
      😀
      😂
      🥰
      😘
      🤢
      😎
      😞
      😡
      👍
      👎