Giter Site home page Giter Site logo

Skip more prompt delay about jimud HOT 1 CLOSED

icewolfz avatar icewolfz commented on August 24, 2024
Skip more prompt delay

from jimud.

Comments (1)

icewolfz avatar icewolfz commented on August 24, 2024

Another version:

//Pattern: ^--More--.*$
//Style: script
//Trigger type: regular expression
//Trigger on prompt enabled
//Trigger on newline disabled
//Value:
//use a once fire event on next time any text is sent from the client meaning any valid command was sent to the mud, with data argument for more advanced testing if desired
//store event so it can be manually removed for cleanup
window.moreprompt_event = data => {
    clearTimeout(window.moreprompt || 0);
    window.moreprompt = 0;
    window.moreprompt_event = 0;
}
client.once('parse-command',window.moreprompt_event);
if(!window.moreprompt) // check if already triggerd
    window.moreprompt = setTimeout(()=>{
        client.sendCommand('\n');
        window.moreprompt = 0; //clear here just in case the 2nd trigger fails to fire
        client.removeListener('parse-command', window.moreprompt_event); //clear event to prevent clearing early
        window.moreprompt_event = 0;
    }, 6000);
//store the timeout id to let it be cleared in case manually did a prompt command

from jimud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.