algorithm wrote:How to read console input? for ex to stop script processing and run it again after a while?
Reading input is harder in JS by it's design. Try readline npm. https://www.npmjs.com/package/readline
algorithm wrote:How to read console input? for ex to stop script processing and run it again after a while?
algorithm wrote:How to read console input? for ex to stop script processing and run it again after a while?
b0r3d0m wrote:algorithm wrote:How to read console input? for ex to stop script processing and run it again after a while?
For timed actions you can use setTimeout, setInterval and sleep functions defined in the example.
algorithm wrote:Cape awarded?
jorb wrote:Oh, for sure. Delivery 2022.
algorithm wrote:b0r3d0m wrote:algorithm wrote:How to read console input? for ex to stop script processing and run it again after a while?
For timed actions you can use setTimeout, setInterval and sleep functions defined in the example.
I mean, i want to stop, then just play like ordinary, then start script again by command.
Like: start client, then go to carrots field, enter command like harvestCarrotField - script reads input and start harvestCarrotField routine then stopped.
After that i will walk to barley field and start harvestBarleyField routine. In middle of which my mate asks me for little help - i prin like pause command and script pauses until i resume it.
var br = new java.io.BufferedReader(new java.io.InputStreamReader(java.lang.System.in));
var userInput = br.readLine();
b0r3d0m wrote:You can use Java standard library via `java` object for such purposes:
- Code: Select all
var br = new java.io.BufferedReader(new java.io.InputStreamReader(java.lang.System.in));
var userInput = br.readLine();
algorithm wrote:Cape awarded?
jorb wrote:Oh, for sure. Delivery 2022.
b0r3d0m wrote:You can use Java standard library via `java` object for such purposes:
- Code: Select all
var br = new java.io.BufferedReader(new java.io.InputStreamReader(java.lang.System.in));
var userInput = br.readLine();
var stdin = java.lang.System.in;
var br = new java.io.BufferedReader(new java.io.InputStreamReader(java.lang.System.in));
while(1) {
if(stdin.available() > 0) {
print(br.readLine());
} else {
//do stuff
}
}
algorithm wrote:Cape awarded?
jorb wrote:Oh, for sure. Delivery 2022.
algorithm wrote:Proposed APIs:
getAllMapObjects() - without giving name to get all GObs around with name and id;
algorithm wrote:It will be very useful to get list of possible actions after right click on some objects - to collect leaves/branches/etc from trees/bushes for ex.
algorithm wrote:Also it will be good to perform equip/unequip items to/from hands and picking items under cursor with right clicking next(to fill smelters with coal)
Users browsing this forum: Claude [Bot] and 60 guests