Nexus trade skills coster

Getting up to speed with Nexus scripting - thought it'd be fun to create a small simple script to read the ingredients list of a trade skill item and calculate the cost of the comms.

It was surprisingly easy to get a v1 up and running! Link - it's super basic, but in case it'd help anybody...

To use: the onLoad function has a dictionary that lists out comms and their prices. You can modify those or add to the list depending on what you have access to (the alias refreshcoster will make any updates take effect in your current session). Then when you look at a recipe, you should see the cost in purple near the ingredients list. (Note - I've only tested this on Cooking recipes - but if it turns out other trades have a different format, happy to adjust this script.)

A couple questions for those more seasoned with Nexus:
  1. Is there a way to do the display_notice at the end of the current block of text? (Right now the display_notice happens around the "Ingredients" line of a recipe, since it's a trigger, but it'd be nice if it was at the end of the recipe)
  2. Has anybody successfully hooked up Nexus to an external database, eg Firebase? It'd be nice if I could 'scrape' the list of all recipes and view a spreadsheet of all available recipes and their costs.
  3. Any tips for scraping a big body of in-game table output, like when you do RECIPES GOURMET?

Comments

  • LuceLuce Fox Populi
    1) Yes. Split this into two triggers. Have this one shove the output text into a string variable called something like price (might need to explicitly make it global, I'm not sure with Nexus) and set another variable to true (I'd probably make it pricer, priceCheck, or something in that milieu.)
    For the second, either trigger the prompt or "Comments:" or see if there's already a trigger for when you receive the prompt (the influencer script might have one, as an example) and add an if statement to check whether your boolean is true, and if it is, have it display your price string with an optional but recommended newline leading character and set the boolean false.
    In lua, this would look something like
    if pricer then
      display_notice("\n"..price)
      pricer=false
    end

    3) This is going to be a pain one way or another. Your 'best' bet is to have something set up so that you enter a command to start the thing, gag everything for a while, then take each recipe/pattern number it gets, save the original output line, check the recipe, and either save the price value to a table in much the same way that you had it handle the price per commodity, then spit out a modified list with the original output + price or have it handle each line as it gets there by spitting the original line + price out when it gets there, then turn off the trigger group that does the price checking when you hit "Total:".  The reason you might want to do it the first way is that it would let you run that hot mess once and deal with the processing of both triggers together across as many recipes as you're getting, but then allow you to set up a second set of much less intense triggers that just remembers the original numbers and a string that's the regular output + price.

    ie it goes through the whole list once, gagging the >100 lines that RECIPES GOURMET will give you plus the however many lines you'd get by inspecting each recipe and shoving the output lines into a table with the recipe number as a key and the line itself with the price added as a second field. Then if you do RECIPES GOURMET again it'll see if the recipe number is in its table, and if so it'll replace the line with the new output with price without having to re-scrape the recipe.
  • LuceLuce Fox Populi
    This is a double-post but the second bit of input I have is independent of the questions you asked:

    When you're pricing out things, don't forget crucibles. For instance, if Hallifax has the lowest prices on everything (believe me, it does not, but this is a hypothetical), and they're selling Milk at 30gp/ea, but Vegetables at 10gp/ea, then the price for milk is 20gp/ea for every 50 crucible output I'm willing to devote to milk.

    The groups are: {iron, gold, silver, platinum, mercury}; {grain, milk, fruit, vegetables, sugar}; {leather, cloth, rope, silk, salt}; {poultry, fish, meat, eggs, sulfur}

    It's likely going to pretty consistently be that the first group are priced as-is unless mercury gets stupid cheap or stupid expensive for you, the second group is going to have either grain or veg as the price point, the third will probably be leather or cloth, and the last is probably eggs, poultry, or meat. For most recipes this might not matter, but anything that needs salt, sulfur, or sugar is going to be wildly different.
  • Thanks for the tips! Yea, for v1 I didn't bother with the crucible calculation, since I assumed that maybe I could price in a bit of the premium for, e.g., sugar (even though I have that crucible). (Also in this process I realized how expensive salt is, so might need to get that crucible too).
Sign In or Register to comment.