Script To Client Command

How do I send a command to the game via a Java Script script in the nexus client settings?

Comments

  • send_command('Kick Thiev");
  • Chubbs said:
    send_command('Kick Thiev");
    thx, xD and that is for JS right?
  • Chubbs said:
    send_command('Kick Thiev");
    wow Chubbs, didn't even match your apostrophes. :tongue:
    "All we have to decide is what to do with the time that is given to us."

  • Holy shit. I didn't notice. I'm a scrub.
  • so i found a good resource ( https://nexus.ironrealms.com/Functions ) and it's showing stuff for things scripts already do, some useful like the interacting with the actual client. Do I have to use these funny ways of declaring variables and incrementing/decrementing stuff?
  • You don't have to use any of the variable functions, no. Only really need to set/get them if you want to save the state of something between play sessions. Don't have to use the rest of the mathematical operation ones at all.
  • Ok thanks, setting up some defence reflexes and stuff to force me to run. I tend to lose sight of my health and die. This way I will move away and be like: WTF?! than realize my health is low lol
  • //Enter the function here
    send_command('say It feels good to be back!');

    let toBeLoaded = [
        {'syntax': 'conjure cloak', 'cooldown': 3500},
        {'syntax': 'hide', 'cooldown': 4000},
        {'syntax': 'scales', 'cooldown': 3000},
        {'syntax': 'conjure ghost', 'cooldown': 3500}
    ];

    function loader(item){
        send_command(toBeLoaded[item].syntax);
        if (item >= toBeLoaded.length){
            return;
        } else {
            setTimeout(function(){loader(item++)}, toBeLoaded[item].cooldown);
        }
    }

    loader(0);


    this keeps looping the cloak part, I've adjusted stuff to try to get it but it ain't working very well xD
  • I can't help with coding, but just wanted you to know that there is an in game curing system that can also be set up to handle defences. Have you tried looking into that? 

  • edited August 2020
    yes, I understand there is a in system curing thing but this is far more fun to setup


    edit: I found my issue, it seems to be resetting the item variable each time it is called, it should not be doing that though
  • I can help with coding. You need to understand what item++ is actually doing, because it isn't just incrementing the value of item by 1. It returns a value before the increment happens, so item++ will return 0 (which gets passed to the loader function when the timeout fires), and then uselessly increments its value by 1, storing that in the item variable.

    Just use item + 1 if you want the current value plus one.
  • ah thank you lol, the small things always mess me up and I spend hours scanning the my code. Some of them small things are quite painful to find
  • edited August 2020
    Yep, that worked. It seems to be running out of sync with the server maybe, because they all work fine except the one that apparently has a longer cooldown than on the website? Or that's a milisecond difference

    edit: NVM, seems to only happen if my wifi glitches. Might have to get a bit more complicated and go based on the ping
Sign In or Register to comment.