Nexus Miniscripts

13»

Comments

  • RocketCatRocketCat Member Posts: 179 ✭✭✭
    An actual MINIscript. Pretty simple vitals tracker, mainly being used for testing numbers for PvP. Should detect your class just fine.

    VIT <ON/OFF> - turns it on
    VIT TELL <PERSON/OFF> - tell the changes in your vitals to a friend who is probably beating you up.

    https://raw.githubusercontent.com/RocketCatIRE/Nexus/master/vit.nxs

    Hi, I'm Ata. Oh and maybe some other people, too. o:) Check out my various packages for Nexus: Vuu combat system, Global Pathfinder, Slicer Tools, Ship compass, JS from command line, Vitals Tracker, and Equipment Manager.
    tysandrPoetMatlkael
  • RocketCatRocketCat Member Posts: 179 ✭✭✭
    Another miniscript. I'm on a laptop without a numpad so piloting is a pain in the arse. This package provides SHIP functionality your Nexus compass. It will automatically convert the compass when you SHIP BOARD/SHIP DISEMBARK.

    The compass buttons:
    directions: SHIP TURN <dir>
    in - SHIP DOCK
    out - SHIP LAUNCH
    look - SHIP BEACON
    up - SHIP THRUST FULL
    down - SHIP  MAXSPEED 10

    Hi, I'm Ata. Oh and maybe some other people, too. o:) Check out my various packages for Nexus: Vuu combat system, Global Pathfinder, Slicer Tools, Ship compass, JS from command line, Vitals Tracker, and Equipment Manager.
    KestreltysandrPeiry
  • Opt1kalOpt1kal Member Posts: 7
    tysandr said:
    Opt1kal said:
    Hey @tysandr - Wondering if you could throw together a defup command by chance for Nanoseer. This is really my first time messing with Nexus, and the last time I had a defup command was about a year ago in Lusternia...lol
    Think you sorted this out on Discord, care to share your script for others? :)

    Yeah, I did...lol. I've been hooked into World of Tanks this past week or so...I need to hop back on and make sure it's all smooth. I know there's still some hiccupery going on that I'll need to iron out.
  • MigiMigi Member Posts: 18
    Opt1kal said:
    tysandr said:
    Opt1kal said:
    Hey @tysandr - Wondering if you could throw together a defup command by chance for Nanoseer. This is really my first time messing with Nexus, and the last time I had a defup command was about a year ago in Lusternia...lol
    Think you sorted this out on Discord, care to share your script for others? :)

    Yeah, I did...lol. I've been hooked into World of Tanks this past week or so...I need to hop back on and make sure it's all smooth. I know there's still some hiccupery going on that I'll need to iron out.
    Noooo... play War Thunder instead.
  • PoetPoet Member Posts: 107 ✭✭✭
    So if you are an old head like me, height expressed in centimetres doesn't mean very much. If you want to see it in feet and inches when you look at someone-

    Trigger regex:
    ^Height:\s+(\d+) cm$
    //Replace height script
    
    imperial=toFeet(args[1])
    replace_current_line("18", "6", ""+imperial, "#b3b3b3", "black");
    
    function toFeet(n) {
      var realFeet = ((n*0.393700) / 12);
      var feet = Math.floor(realFeet);
      var inches = Math.round((realFeet - feet) * 12);
      return feet + "&prime; " + inches + '&Prime;';
    }
    

    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
    tysandr
  • tysandrtysandr Member Posts: 90 ✭✭✭
    edited February 2019
    Pretty excited about this so wanna share it early, please write back with errors & things... v0.01 of simple HTML to Nexus' chunk writing:

    vparser = function(str) {
     var out = []; 
     var str = str || "<span id='e' class='xc-blue'>v</span><span class='xc-violet'>thing<span id='d' class='xc-red'>asdf</span>c</span>"; // sample line
     var RE = /(<span|<\/span>)/g; 
    
     var matches; 
     while (matches = RE.exec(str)) { out.push(matches.index) }; 
     // console.log(out); 
     var cap = str.length
     var g = []
     for (var i = out.length - 1; i > -1; i--) { 
      var n = out[i]
      g.unshift(str.substring(n, cap))
      cap = n
     }
     // console.log(str); console.log(g)
    
     var cm  = []
     var chunks = []
     for (var i = 0; i < g.length; i++) {
      var el = g[i]
      if (el.match(/\<\/span\>$/)) {
        cm.pop()
        var c = cm[cm.length - 1] || 'reset'
        chunks.push( client.linechunk_color(c) )
      } else if (el.match('</span>')) {
        cm.pop()
        var c = cm[cm.length - 1] || 'reset'
        chunks.push( client.linechunk_color(c) )
        var e = el.replace('</span>','')
        chunks.push( client.linechunk_text(e) )
      } else if (el.match('<span ')) {
        // console.log('new span ' + el)   
        var c = el.match(/\xc-(\w+)/)
        if (c) {
         cm.push(c[1])
         chunks.push( client.linechunk_color(c[1]) ) }
        var e = el.replace(/\<span.*?\>/,'')
        chunks.push( client.linechunk_text(e) )
      }
     }
     // console.log(chunks)
     return chunks
    }

    Used in a trigger:
      if (client.current_block) {
        var idx = client.current_block.indexOf(client.current_line) - 1
        if (idx < 0) { idx = 0 }
        
        // Step backwards until we find an ungagged line
        for (var i = idx; i > -1; i--) {
          if (typeof client.current_block[i] != 'undefined' && client.current_block[i].gag != true) {
            var m = vparser("<span class='xc-grey'>-<span class='xc-red'>" + value + "</span></span>")
            client.current_block[i].parsed_line.chunks = client.current_block[i].parsed_line.chunks.concat(m)
            break;
          }
        }
      }
    

    Use with <span class='xc-color'>message</span>.
    vote ∘ Explore Nexus mods for Starmourn & Achaeandb for Nexus

    Poet
  • RocketCatRocketCat Member Posts: 179 ✭✭✭
    Get those prompts to show up on your logs. Let's make a few tweaks to generate_text_block. Put this in onLoad:
    client.generate_text_block = function(lines) {
        var count = 0;
    
        var timestamp;
        if (client.show_timestamp_milliseconds === true)
            timestamp = client.getTimeMS();
        else
            timestamp = client.getTimeNoMS();
        var cl = "timestamp mono no_out";
        timestamp = "<span class=\"" + cl + "\">" + timestamp + "&nbsp;</span>";
    
        var res = '';
    
        var counter = 0;
        for (var i = 0; i < lines.length; ++i) {
            var txt = lines[i].parsed_line;
            var font = lines[i].monospace ? 'mono' : '';
            var line = "<div class=\"" + font + "\">" + timestamp + (txt ? txt.formatted() : '') + "</div>";
    
            // we want gagged lines to be logged, too
            if (logging && txt) append_to_log(line);
    
            if (lines[i].gag) continue;
            counter++;
    
            if (txt) {
                count++;
                res += line;
            }
            var pr = lines[i].parsed_prompt;
            if (pr && (count > 0)) {   // no prompt if we gagged everything
                var my_prompt = "<div class=\"" + font + "\">" + timestamp + pr.formatted() + "</div>";
                res += my_prompt
                if (logging) append_to_log(my_prompt);
            }
            // empty line - include it if it's neither the first nor the last one
            // using "counter" instead of "i" fixes problems where the empty line is included after channel markers and such
            if ((!pr) && (!txt) && (counter > 1) && (i < lines.length - 1)) {
                res += '<div line>' + timestamp + '&nbsp;' + '</div>';
            }
        }
        if (client.extra_break && res.length) res += "<br />";
        return res;
    }
    
    Hi, I'm Ata. Oh and maybe some other people, too. o:) Check out my various packages for Nexus: Vuu combat system, Global Pathfinder, Slicer Tools, Ship compass, JS from command line, Vitals Tracker, and Equipment Manager.
    tysandr
  • KestrelKestrel Member Posts: 356 ✭✭✭✭
    @RocketCat is there any way to make it so that only emotes and say commands show up in logs?

    "They are elect to whom beautiful things mean only Beauty."
    — Oscar Wilde


    "I'll take care of it, Luke said. And because he said it instead of her, I knew he meant kill. That is what you have to do before you kill, I thought. You have to create an it, where none was before."
    — Margaret Atwood

  • RocketCatRocketCat Member Posts: 179 ✭✭✭
    Kestrel said:
    @RocketCat is there any way to make it so that only emotes and say commands show up in logs?
    Would probably be a bit convoluted... but theoretically yes. Ill look into it.
    Hi, I'm Ata. Oh and maybe some other people, too. o:) Check out my various packages for Nexus: Vuu combat system, Global Pathfinder, Slicer Tools, Ship compass, JS from command line, Vitals Tracker, and Equipment Manager.
    KestrelPoet
  • tysandrtysandr Member Posts: 90 ✭✭✭
    edited February 2019
    Okay!

    Would you like to insert notices with multicolors, by using a simple "span" structure? Introducing OrangeJuice.nxs, a method that allows you to introduce spans with simple HTML.

    Download here.
    str += '<span class="huh xc-rgba(244,1,1,1)">Representing <span class="xc-green">blood</span>:</span> '
    str += hack + '<span class="xc-rgba(144, 233, 212, 1)">!</span>'
    oj.express(str, 0, -2)



    The main function is oj.express(str, vpos, hpos). Use xc-color to express a color within the class attribute. Place all other custom classes before using xc-color as your last class.

    vpos, defaults to 0
     -2: prints to the top of the block
     -1: prints to the first displayable line (ignores gagged lines)
     0: prints to the triggered line
     1: prints to the next displayable line (ignores gagged lines)
     2: prints to the prompt

    hpos, defaults to 1
     -2: prints to newline at front of positioned line
     -1: prints in front of positioned line (prepending)
     0: prints newline
     1: prints to end of positioned line (append)
     2: prints to end of positioned line & newline

    Really no material difference between hpos,0 & hpos,2 currently. Also, I would avoid using newline (hpos,-2; hpos,2) with prompt positioning (vpos,2) as I seem to have a fixed height for the prompt & it overlaps text once the scrollback moves.

    Hope it works well for you :)
    vote ∘ Explore Nexus mods for Starmourn & Achaeandb for Nexus

    Kestrel
  • RocketCatRocketCat Member Posts: 179 ✭✭✭
    tysandr said:
    cool stuff
    Works like a charm! As usual...
    Hi, I'm Ata. Oh and maybe some other people, too. o:) Check out my various packages for Nexus: Vuu combat system, Global Pathfinder, Slicer Tools, Ship compass, JS from command line, Vitals Tracker, and Equipment Manager.
  • tysandrtysandr Member Posts: 90 ✭✭✭
    Just a little update re: NDB, thanks to Squeakum & others, I had a look at the code & it was quite inefficient at highlighting names.

    I rewrote a method that is significantly quicker although it may still not be the optimal method:
    ndb.alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    
    ndb.highlight = function(msg, names, colors) {
      var alphabet = ndb.alphabet
      for (var name in names) {
        var arr   =  names[name]
        var c     = colors[name] || {}
        var color = 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')'
        for (var i = 0; i < arr.length; i++) {
          var idx = arr[i]
          // if the next char in the string is not a letter
          if (msg[(idx + 1)] && alphabet.indexOf(msg[(idx + name.length)]) == -1) {
            // replace at the index for the length of the name with the color
            replace_current_line(idx, name.length, name, color)
          }
        }
      }
    }
    
    ndb.sub = function(msg) {
      if (!ndb.options.doHighlight) { return }
      if (typeof client.current_line.parsed_line == 'undefined') { return }
      if (typeof current_text != 'function') { return }
      var coptions = ndb.coptions || {}
      // var now = new Date().getTime()
      var m = {}
      var c = {}
      for (var k in _db) {
        var i = 0
        while (i < msg.length) {
         if (msg.indexOf(k, i) != -1) {
           if (typeof m[k] == 'undefined') { m[k] = [] }
           if (typeof c[k] == 'undefined') { 
             if (_db[k].useColor == true) { 
               c[k] = _db[k].color 
             } else if (coptions[_db[k].faction] != 'undefined') { 
               c[k] = coptions[_db[k].faction]
             } 
           }
           m[k].push(msg.indexOf(k, i))
           i = msg.indexOf(k, i) + 1
         } else { break }
        }
      }
      ndb.highlight(msg,m,c)
      // var n = new Date().getTime()
      // console.log(n - now)
    }
    If you replace the initial ndb.sub within ndb.uiFunctions with this, you should shave about 10-20ms depending on the size of your ndb.
    vote ∘ Explore Nexus mods for Starmourn & Achaeandb for Nexus

  • RocketCatRocketCat Member Posts: 179 ✭✭✭
    Quick and easy, similar functionality to Mudlet lua and echo commands.

    JS <javascript> - to execute some javascript
    JSS <javascript> - to JSON.stringify stuff and print it
    ECHO <text> - similar to mudlet, test your triggers


    Hi, I'm Ata. Oh and maybe some other people, too. o:) Check out my various packages for Nexus: Vuu combat system, Global Pathfinder, Slicer Tools, Ship compass, JS from command line, Vitals Tracker, and Equipment Manager.
    tysandrPoet
  • RocketCatRocketCat Member Posts: 179 ✭✭✭
    Abaware: A simple package to ask: "Do I have this ability?"

    Usage: Just call abw.haveSkill(group, skill) and it will return true if you have the skill or false if you don't. use toLowerCase() before calling because I forgot to do that in the method itself and I'm lazy now.

    Example: abw.haveSkill('nanotech','swarm') => true
    abw.haveSkill('nanotech','delay') => false



    Hi, I'm Ata. Oh and maybe some other people, too. o:) Check out my various packages for Nexus: Vuu combat system, Global Pathfinder, Slicer Tools, Ship compass, JS from command line, Vitals Tracker, and Equipment Manager.
  • RocketCatRocketCat Member Posts: 179 ✭✭✭
    Here's another miniscript. Nexus Equipment Manager:

    EQM: Parse your weapons and armor into EQM. This may take a bit.
    EQSUMMARY: View a summary of details about your equipment.
    MAKESET <alias> <IMPACT|EM|THERMAL|CELLULAR|MENTAL|DRAINING|ELECTRIC>: Will make a set of armor with the specified alias from your inventory, maximizing the specified resistance.
    MAKESET EQUIPPED <alias>: Creates a new armor set out of the currently equipped armor.
    ARMORSETS: View your defined armor sets.
    ARMORSET DELETE <alias>: delete the specified armor set.
    ARMORSET EQUIP <alias>: equips the specified armor set. Use it multiple times until everything is equipped.

    And for those who trust in the system (I shall not be held accountable for you scrapping your 9600 power thing):
    SCRAPALL ARMOR: Will scrap all armor pieces which are not part of a defined set or worn/equipped.
    SCRAPALL WEAPONS <power>: Will scrap all weapons below the specified power.

    ARMORSETS should save between sessions, but experience suggests Nexus variables cannot be trusted. So you might need to rebuild ARMORSETS, or manually fix the contents of the nexus variable "eqm.sets"

    The package really has only been tested for Nanoseer, so things might not work entirely as expected for other classes yet, but I'm happy to address these and other issues.


    Hi, I'm Ata. Oh and maybe some other people, too. o:) Check out my various packages for Nexus: Vuu combat system, Global Pathfinder, Slicer Tools, Ship compass, JS from command line, Vitals Tracker, and Equipment Manager.
    XiruPoetReeloc
  • PoetPoet Member Posts: 107 ✭✭✭
    For those that lament the loss of the Nexus map in caches, here's a tab that will capture the map. CONFIG MAPSHOW ON for maximum utility. For as long as this is enabled, you won't see the map in the main window. I did not fancy it up, or put in an on/off toggle. It basically just grabs the map from the main window, and puts it in a tab. The only thing I added was a green highlight on your current location.  mapTab is the command to start it up. If you like it and want to run it all the time, put the following in your onLoad function.
    send_command("mapTab");  //activates the local map tab

    You can download the package here: https://drive.google.com/file/d/1P3ajesqqUsmZwM9B7jm_6pIJ-wbRNIGx/view?usp=sharing

    I set it to load at the bottom left, cause that's where I keep my map. It will load behind the other tabs, without an icon. It will also be completely blank until you type MAP, or move with mapshow on. 

    If you want it to load somewhere else, open the mapTab function and look for:
    client.register_custom_tab( t, 'container_2' )
    There is a comment below that details which container is which, just change the number. Next time you restart the client and run the function it will load wherever. You can also drag the tab around once it's open, just like the default ones.
    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
    ReelocRocketCatSteve
  • PoetPoet Member Posts: 107 ✭✭✭
    I put this up on Discord as well (and screwed it up the first time). If you want to turn your Talents Progress Bar into a percentage, set up the following as a regex trigger:

    ^Progress to next talent point\: \[ (=*)(-*) \]$

    Set the dropdown to "execute script" and put the following in the box:

    talentpercent = Math.floor((args[1].length/33) * 100);
    display_notice("Current talent progress percentage: "+talentpercent+"%");

    @Nykara came up with the regex.  I just implemented the Javascript.

    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
    Squeakumseel
Sign In or Register to comment.