Nexus for noobs

2»

Comments

  • EMDAEMDA Member Posts: 32
    I'm happy it helped. Looking into it helped resolve a few things I was wondering about myself!

    @Kilpa Thanks! That made my problem go away entirely. I didn't think that the order would have made any difference.

    @Avymos @Atalkez Regular expressions do work the same way between Nexus and Mudlet. One reason to use (?: (\w+)) in an alias is that it allows you to match the alias with both the base command and an additional argument. You're still sending the (\w+) or (.+) inside of the non-matching part to a capture group, but it allows you to enclose the argument and the space that would precede it with a ?, making the whole thing optional. So ^ch (.+)$ wouldn't actually trigger on the input of 'ch' alone. Another way to write it would be ^ch\s?(.+)?$ or ^ch\s*(.+)?$ or even ^ch(.+)?$ because they make the space optional, but then you'd be running into the problem of accidentally triggering different commands that start with ch.


  • AvymosAvymos Member Posts: 28
    I read Atalkez's response, then went back up to skim Sevrant's. Didn't fully comprehend the question :anguished:
  • SlanderSlander Member Posts: 176 ✭✭✭
    edited December 2018
    Alright, apologies in advance as I'm sure this is absurdly simple but I'm not super good with scripting. (I used Mudlet for years and still barely know how to do this with Lua.) So, question is, how do I set up an if statement in Nexus for an alias that sends crackshot if rapidfire fails due to too little ammo or rapidfire still on cooldown?

    Edit: So, here's what I've been working on but it just jumps to crackshot. Anyone care to point out what I did wrong?
    I'm gone.
  • SqueakumsSqueakums Member Posts: 230 ✭✭✭
    I'm sure this is stated somewhere obvious, but I seem to have missed it in the Nexus wiki.

    I have a simple reflex that queues my bashing attack variable (@autoattack) at my target variable (@mytarget). I can simply make a reflex that, upon recovering balance, does a send command for @autoattack @mytarget and it works just fine.

    I wanted to do the same thing, but using execute script instead of send command. I want it to check my HP % and if it's below 70%, I want it to use SUIT SUPPORT instead of queueing autoattack. I don't know the syntax for properly referencing those variables though.

    send_command(client.autoattack + ' ' + client.mytarget) doesn't seem to do it. 

    Likewise, I'm not sure how to reference the @my_HP and @my_maxHP variables in Nexus to compare them in the if block. if (client.my_HP < client.my_maxHP*.7)  {whatever} ?

    I know I can do this with simplified scripting, but I wanted to start learning how to do the more complex scripts and this seems like a good place to start. 
  • SqueakumsSqueakums Member Posts: 230 ✭✭✭
    @saturnine rf and @my_bl are both variables in the script, right? So I think your code should say Variable rf and Variable @my_bl instead of value for both of them, from the drop down box. So if variable @my_bl is > value 1, etc

    Also shouldn't rf be called @rf instead? 

    I was doing some testing with this and it'll be funky if you call your variables a value. If you want to contact Seth in game I can respond there faster without cluttering this thread--though I'm still figuring all of these out too!
  • EMDAEMDA Member Posts: 32
    @Squeakums In order to access the @myvariable stuff in Nexus in an execute script you'll have to use the functions set_variable(name) and get_variable(name, value). It's easy to overlook but the list of stuff like that you can use is here. So rewriting that command would look like:
    if (your healing conditions here) {
        //more healing stuff
    } else {
        send_command(get_variable("autoattack") + " " + get_variable("mytarget"));
    };

    You should be able to get the rest of it pretty easily. If you do end up doing progressively more stuff through the script blocks it will be much easier for you to just declare the variables in your onLoad script, but you'll lose the cross-use with the simplified scripting at that point.

    @saturnine I'm not scoundrel so I can't test to make sure it's all working well, but I think you'll want to make the "Value" above rf and @my_bl into "Variable", as mentioned. The last thing you might run into is that your modify_variable label to set rf to 0 doesn't look like it will be called by anything, since it's below the end of your rapidfire label block and above the crackshot one.
  • EMDAEMDA Member Posts: 32
    I'm running into a regex issue while trying to match a capture. I can't for the life of me figure out what's going wrong so I'm hoping it's painfully obvious and someone will spot it. I'm trying to match the Blade Attack pattern the game sends you with the regex:
    ^You: Blade (\w+)(?: -\> (.+))?\.$


    That's an example line of text from the game, but for some reason it doesn't fire. If I use regex101.com to test the pattern against the line, or similar lines drawn from the Fight Club thread, they match and capture perfectly. The trigger is active and it is set to Regular Expression.
  • PoetPoet Member Posts: 122 ✭✭✭
    I've also had trouble catching these characters:  ->   I don't know how to tell you to fix it other than grab everything after the "\w" as a group.  I'm told that it's a nexus issue, as Mudlet deals with it ok.
    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
  • tysandrtysandr Member Posts: 90 ✭✭✭
    Here's why:



    Nexus cannot keep > in uploading & interpreting our scripts because HTML also uses <, > particular for tags. Nexus substitutes > for &gt; and similar < for &lt;. You can use this in your regex pattern. Not sure if it will be an easy fix for Nexus.
    vote ∘ Explore Nexus mods for Starmourn & Achaeandb for Nexus

  • tysandrtysandr Member Posts: 90 ✭✭✭
    Actually could be done from IRE side pretty simply, add in a display parser for these two lines:
    [650]    selected_reflex.text = refs.find("#reflex_trigger_text").val();
    in store_reflex_info

    and
    [596]    refs.find("#reflex_trigger_text").val(reflex.text);
    in fill_reflex_info.

    Just doing something like
     >  store_reflex_info => escape_html(val())
     >  fill_reflex_info => de-escape(.text)

    Would be extremely difficult on our end as we don't have access to the internal scope of the function(s).
    vote ∘ Explore Nexus mods for Starmourn & Achaeandb for Nexus

  • PoetPoet Member Posts: 122 ✭✭✭
    edited December 2018
    If I'd thought about it a bit harder, I'd probably have realized that the <> were the problem.  I still can't get mine to work.  Maybe they could just not send us those characters?

    Edit:  I finally got it by using .*\s, which is incredibly inefficient, but whatever, at least it works.
    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
  • EMDAEMDA Member Posts: 32
    edited December 2018
    EDIT: I don't know why this post is a duplicate of a much earlier post or why it sent when I was sleeping, sorry about that!

    @tysandr and @Caliah , thanks for explaining that! Adjusting the regex patterns to "-&gt;" solved it, and is something I never would have thought to try.
  • EolevaEoleva Member Posts: 15
    Okay I decided to make a log so I could comb it and then make some stuff, but WOW the log looks like absolute butthole in Notepad. What program should I use and what can I do to make sure I can actually review my logs?

    Thanks in advance...
  • PoetPoet Member Posts: 122 ✭✭✭
    Eoleva said:
    Okay I decided to make a log so I could comb it and then make some stuff, but WOW the log looks like absolute butthole in Notepad. What program should I use and what can I do to make sure I can actually review my logs?

    Thanks in advance...
    The logs are .html- web pages essentially.  They'll look just like the client feed if you open them in a browser.  You can copy and paste from there.  There are alternatives, if you are doing heavy text processing, such as Notetab Pro which can do things like strip all the html tags out, search and replace using regex etc.  I mostly just copy and paste from the browser.
    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
  • EolevaEoleva Member Posts: 15
    edited January 2019
    Thanks for the help there, Caliah!

    Okay I am trying to make a counter for my turret on my bot. I get 8 charges before my turret needs a recharge. I'd like a little bit of a heads up for this, just in case.

    I get that I need to make a variable, but I'm having issues learning what I need to replace the target name with and how to account for "a" vs "an"

    Blindingly bright, a stuttering ray of light lances from the barrel of a deployed turret with a mounted laser barrel, slicing into an iridescent opal beetle.

    So I have that first part... I couldn't really find anything in the Nexus help thing to tell me how to write this up (I might have missed it though). So should it be something like:

    Blindingly bright, a stuttering ray of light lances from the barrel of a deployed turret with a mounted laser barrel, slicing into (?:(the | a | an) @tar.

    uhhh im so lost thank you for any help





  • MineiMinei Member Posts: 49 ✭✭✭
    Blindingly bright, a stuttering ray of light lances from the barrel of a deployed turret with a mounted laser barrel, slicing into .*\.

    That should capture the line. Then you substract one shot from your variable. Remember to update your variable when you reload. This is a very good site to help you write and test regular expressions.
  • EolevaEoleva Member Posts: 15
    Minei said:
    Blindingly bright, a stuttering ray of light lances from the barrel of a deployed turret with a mounted laser barrel, slicing into .*\.

    That should capture the line. Then you substract one shot from your variable. Remember to update your variable when you reload. This is a very good site to help you write and test regular expressions.
    I went to that website but that is... a bit beyond me, right now. My skills are somewhere below novice. This is what I have but it just isn't working. I don't think the counter is lessening at all, I use the turret and then I check the variable and it stays at 8. Not sure why I can't just paste my print screen here, but this is what it looks like:


    ugh what a mess!

  • EMDAEMDA Member Posts: 32
    It looks like your trigger is set up properly for the most part, but you'll want to change the 'Contains' drop-down box to 'Regular Expression'. When it's on Contains it tries to match whatever you put in the box within each line it receives, so right now it would be looking for a line that has that whole thing, including the ".*\." part. Changing it to Regular Expression will tell Nexus to interpret the .* in a way that matches your text.
  • PoetPoet Member Posts: 122 ✭✭✭
    Eoleva said:
    Minei said:
    Blindingly bright, a stuttering ray of light lances from the barrel of a deployed turret with a mounted laser barrel, slicing into .*\.

    That should capture the line. Then you substract one shot from your variable. Remember to update your variable when you reload. This is a very good site to help you write and test regular expressions.
    I went to that website but that is... a bit beyond me, right now. My skills are somewhere below novice. This is what I have but it just isn't working. I don't think the counter is lessening at all, I use the turret and then I check the variable and it stays at 8. Not sure why I can't just paste my print screen here, but this is what it looks like:


    ugh what a mess!

    You're almost there.

    There are a couple of ways to do this.  First is switch from "contains" to "begins with" and use: 
    Blindingly bright, a stuttering ray of light lances from the barrel of a deployed turret with a mounted laser barrel, slicing into
    as the phrase to match.

    Second is to switch from "contains" to "regex" and use:
    ^Blindingly bright, a stuttering ray of light lances from the barrel of a deployed turret with a mounted laser barrel, slicing into .*\.$
    as the phrase to match.

    Regex is powerful, but you can do this without it.  Right now it looks like your counter isn't counting because it just isn't matching.
    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
  • EolevaEoleva Member Posts: 15
    Ah! Thank you! It works now!


  • PoetPoet Member Posts: 122 ✭✭✭
    edited January 2019
    Does anybody know how to get the button highlighting to work?  

    I wrote a little test script to practice changing the buttons, and I got the first bit working. As far as I can see though, the highlight doesn't do anything?

    buttons_set_label("1", "Updated");	// - Set the text label on a button.
    buttons_set_commands("1", "hrm");	// - Sets the command sent to the game when the button is pressed.
    buttons_set_highlight("1", "on");	// - Set whether the button is highlighted or not.
    client.print("Button Script Run");
    So that runs, changes the button label and command, but the button looks the same whether highlight is set to on or off. I tried true and green as well, and it doesn't complain, but it doesn't do anything with those either.

    Edit- I also notice now, that if you change the buttons using code, they stop respecting the 'show tooltips' checkbox and go back to having popups even with it disabled. Can we have a way to turn that on and off as well please?
    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
  • PoetPoet Member Posts: 122 ✭✭✭
    ok, button highlight...

    This is the one place in the client code, apparently, that you don't have to enclose your setting in quotes.

    buttons_set_highlight("1", false)
    or true to turn it on.
    [Cassandra]: Poet will be unsurprised to learn that she has unread news.
  • XiruXiru Member Posts: 501 ✭✭✭✭
    Let me preface this with I have no idea what I'm doing with IF ELSE statements.

    That being said, why does this work?
    trigger text: a rime of frost begins to steal across its flesh as you drain the heat and energy
    execute script:
    if (get_variable('frozen') == true) {
    set_variable('frozen2', true)
    } else {
    set_variable('frozen', true)
    }

    while this doesn't?

    trigger text: You can again whip yourself into a frenzy.
    execute script:
    if (get_variable('rage') == true){
    set_variable('canfrenzy' true);
    } else {
    send_command("oblivion frenzy");
    set_variable('canfrenzy', false);
    }

    instead I get:

    Error in trigger Script []:
    SyntaxError: missing ) after argument list
    You can again whip yourself into a frenzy.

    Vote for Starmourn! Don't hurt Poffy.
  • tysandrtysandr Member Posts: 90 ✭✭✭
    You missed a comma in 'canfrenzy', true
    vote ∘ Explore Nexus mods for Starmourn & Achaeandb for Nexus

  • XiruXiru Member Posts: 501 ✭✭✭✭
    I love you.
    Vote for Starmourn! Don't hurt Poffy.
  • EMDAEMDA Member Posts: 32
    I guess this is more of a GMCP question than a Nexus question, but how would you go about collecting what skills a character has from a given skillset? Sending a generic "Char.Skills.Get" shows how many a character has learned like "{ "name": "Captaincy", "rank": " 7/23" }", but sending it with a specific skill like "Char.Skills.Get {"group":"captaincy"}" always shows the entire list of skills, and with the way skills are grouped up by category within a skillset the first 7 skills in the list aren't necessarily the 7 that character has. Would you have to manually order a list for each skillset or is there another query I've been overlooking?
Sign In or Register to comment.