Closed Phlarx closed 3 months ago
Autocomplete does not pay any ramcost. We cannot provide access to ns in autocomplete.
But the types of data provided could be expanded to include some of those things.
ns.getPlayer()
has RAM cost, probably won't be added.
ns.stock.getSymbols()
does have RAM cost, but it also returns values of a fixed object, just hardcode it.
ns.corporation
doesn't have RAM cost.
Just hardcode the values.
Thanks, I hadn't thought of that.
In all seriousness, I don't consider manually duplicating lists of data, no matter the size or content, a good solution. It's a solution that works, sure, but it's a bad smell and should be avoided when possible.
I wouldn't expect to be able to circumvent RAM calcs, that's a valid reason for not providing certain functionality; the list I gave are things I have wanted, it's perfectly reasonable that not all of them would or should be accessible.
You joke as if you know everything when in fact you don't know half the capabilities of what you have in your hands.
Here, I'll make it easier to understand
nano crime-types.js
and press enterexport const crimeTypes = {
assassination: "Assassination",
bondForgery: "Bond Forgery",
dealDrugs: "Deal Drugs",
grandTheftAuto: "Grand Theft Auto",
heist: "Heist",
homicide: "Homicide",
kidnap: "Kidnap",
larceny: "Larceny",
mug: "Mug",
robStore: "Rob Store",
shoplift: "Shoplift",
traffickArms: "Traffick Arms"
};
nano print-crime-types.js
and press enter
import { crimeTypes } from './crime-types.js'
export async function main(ns) { ns.tprint(Object.values(crimeTypes).join(', ')); }
7. Save
8. Go back to your terminal
9. On your terminal input `run print-crime-types.js` and press *enter*
An, in case I still wasn't obvious enough, let me make it clear that you can also use your imports inside other functions, including autocomplete
.
You can also write other things inside the main function apart from printing. 🙃
You joke as if you know everything when in fact you don't know half the capabilities of what you have in your hands.
Please be polite; there's no call to be this sarcastic.
There are perfectly valid reasons for not wanting to duplicate data that the game already provides.
In addition, he seems to have missed the point of the discussion. I'd stated "I would like to do X without Y", and he'd responded "Here's how you do Y".
For the record, it is already possible to do X without Y, by utilizing the new shared script module behavior with 2.3.0. It's imperfect because it requires running the script once to initialize a top-level variable with the required data, but afterward it works without requiring duplicate data, nor polluting document
or any other global object.
There's no x without y here.
Well, I don't know what else to tell you. You have the tools to do it. It's not hard. It doesn't involve bad smell. So sure, if you prefer to just wait until it gets handed to you, feel free to wait.
without requiring duplicate data, nor polluting document or any other global object
My solution does not involve global variables, neither on document or anywhere. It also doesn't require you to run the script. Sure, it also doesn't work for things that require RAM, but as Snarling has stated, you won't be getting access to those anyway.
To be clear at no point I meant to say your idea is bad. I'm saying part of it is already perfectly accessible and you should implement it while the api isn't updated.
In 2), you make the assumption that I'm not already using the workarounds that both you and I have suggested. I did not ask for a tutorial; rather I responded that the request was still valid despite any alternative strategies. Perhaps it was a bit flippant, but that does not make it untrue.
I am hopeful that this capability will be added, yes, but it is naive to presume that I've put the world on hold waiting for a feature to be added. Please refrain from talking down to others when you don't have the whole picture. As this is not a forum for discussing github etiquette, I'll stop there.
@d0sboots What do you think about adding static data from ns.enums
to autocomplete data? Snarling seems to agree with expanding autocomplete data to include some provided data.
Seems reasonable to me.
Some data from the
ns
object would be very useful for setting up autocomplete. For example, I have wanted to use:ns.stock.getSymbols()
ns.enums.CrimeType
ns.corporation.getCorporation().divisions
Object.keys(ns.getPlayer().skills)
ns.read('listOfThings.txt')
ns.readPort(CONFIG_PORT)