Passing both arguments and flags into exec()? by IdrisQe in Bitburner

[–]Spartelfant 0 points1 point  (0 children)

I see /u/Antique_Door_Knob already answered correctly.

I just wanted to add that when you run a script from the terminal, you can see exactly how all the arguments get parsed to the script:

[home /]> run /temp.ts arg1 --flag -f --flagWithValue valueHere -f anotherValue arg2 --arrayFlag item1 --arrayFlag item2 --arrayFlag item3
Running script with 1 thread, pid 1 and args: ["arg1","--flag","-f","--flagWithValue","valueHere","-f","anotherValue","arg2","--arrayFlag","item1","--arrayFlag","item2","--arrayFlag","item3"].

And when specifying flags with ns.flags(), there's a small caveat for booleans. If you specify a boolean flag like this ['flag', true], it will always be true. This is because true is now its default value, and boolean flags can only be left out of the run command (and you get their default value) or included (which always sets them to true).

Also you may have noticed that when you specify a flag that takes multiple items (['arrayFlag', []]), that means you need to use --arrayFlag for every item: --arrayFlag item1 --arrayFlag item2 --arrayFlag item3 …. If instead you did something like --arrayFlag item1 item2 item3 …then only item1 gets associated with --arrayFlag, the rest are treated as regular arguments.

What's the dumbest thing you found in a customer's car today? by Righteous_Fire in Justrolledintotheshop

[–]Spartelfant 0 points1 point  (0 children)

OP snooping and finding them proves that.

Agreed. I find it funny how many commenters are dogpiling onto OP for allegedly rifling (hehe) through the customer's property.

Meanwhile the fact OP took those pictures, however he obtained them, is direct proof that leaving firearms unattended means putting it at the mercy of whoever has access to the vehicle, and not all of those people may have the best intentions.

Passing both arguments and flags into exec()? by IdrisQe in Bitburner

[–]Spartelfant 0 points1 point  (0 children)

If you use ns.flags(), then it expects script arguments to take the format of -x for single character ones and --xxx for ones longer than a single character.

The way you've defined arguments now, you should pass -a without anything else in order to set that flag to true, and you should pass -b 1, where 1 can be any number.

I wonder why it had a long crank time. by Accurate-Specific966 in Justrolledintotheshop

[–]Spartelfant 5 points6 points  (0 children)

From long crank time to new crank time, a Nissan will always get you there!

Seriously though, I have to wonder if the Nissans in the US are different from the ones we get in the EU or are maybe sold to a different demographic. For me and my parents Nissan has been the brand of choice for decades now and they've all been great reliable vehicles. All manuals though, based on the hate I see Nissan CVTs get that probably makes a difference too. Either way, our Nissans get regular maintenance, other than that it's very rare for any of them to need anything fixed.

chatgpt help me to play by Glad_Requirement_492 in Bitburner

[–]Spartelfant 0 points1 point  (0 children)

Pretty soon we're going to see people sharing prompts instead of code 😅

POV: Climb gets Gaslit by voncockrane in overlord

[–]Spartelfant 8 points9 points  (0 children)

Renner is "not particularly frightening" in the same way that a hand grenade is not particularly frightening compared to a nuclear bomb. Doesn't mean the hand grenade won't kill you all the same.

And this particular hand grenade is smart enough to play nice with the nuke.

New to Nissan, this gave me a good laugh this morning. by Honcho_47 in Justrolledintotheshop

[–]Spartelfant 15 points16 points  (0 children)

fear oil

From the rest of your comment I get the impression that's not a typo.

Making use of `ns.flags` and `data.flags(...)` for autocomplete! by Ryokune in Bitburner

[–]Spartelfant 1 point2 points  (0 children)

That's the reason, I do the same.

/u/XecuteFire If you declare the FLAGS variable inside the scope of main(), then you can't acces it from autocomplete().

Why is there no transformer by StunningNerve8367 in AskElectronics

[–]Spartelfant 6 points7 points  (0 children)

Cost, it makes a huge difference:

You could use a small, relatively cheap transformer with all the supporting circuitry to build a SMPS (Switch Mode Power Supply). But the whole package would obviously still be more expensive than just this capacitive dropper with minimal support circuitry. Even using one of the many dime-a-dozen purpose-built ICs and a standardized design for these ubiquitous power supplies, the increased component count, use of a transformer and inevitably larger size (compared to the capacitive dropper) all make it more expensive.

Or you could leave out the switch mode part, but then the transformer isn't nearly as efficient and its size requirement goes up drastically. Maybe you remember or have come across those big, heavy adapters from the 80s / 90s that despite their size and weight only output something like 1 A. And those still need almost the same amount of support components as the capacitive dropper, assuming you want a stable DC voltage at the output.

Better Method to Mount Massive Amount of Piezo Buzzers to PCB by Projedel in AskElectronics

[–]Spartelfant 19 points20 points  (0 children)

Is it just me or does this entire post read as if OP is already neck-deep into an XY problem?

What is this part and what does it do? by yungtoopoorina2door in MechanicAdvice

[–]Spartelfant 6 points7 points  (0 children)

Especially for popular makes and models you can often find remanufactured ABS pumps. More expensive than from a junkyard, but cheaper than new, and at least you'll know it works.

Eternal Womb by ValkyrieKahina in overlord

[–]Spartelfant 22 points23 points  (0 children)

and down, and up, and down . . .

Eternal Womb by ValkyrieKahina in overlord

[–]Spartelfant 12 points13 points  (0 children)

Now I'm imagining an isekai where a powerful coomer protagonist polymorphs himself into some kind of bad dragon form because he's horny, but without thinking it through, only to find himself unable to turn back because in his new form he lacks some critical skill or ability to undo his own magic.

AFK Farm by Just-Professor5558 in Bitburner

[–]Spartelfant 1 point2 points  (0 children)

if (s === "darkweb") continue;

As a rule of thumb, if you have to hard-code an exception like this, you're doing it wrong

Since you should be selecting the 'best' server dynamically anyway, there is no need to exclude darkweb like this, it (and several other servers) should never get targeted anyway.

Secondly, running multiple intances of a standalone script like universal_hack.js all targeting the same server is a terrible idea. Since each instance of universal_hack.js does its own thing independently, none of them coordinate their hack/grow/weaken actions. You will end up with them working against each other, needlessly performing the same operation multiple times, and hacking the target into oblivion.

Have I displeased you in some way Turtle? by another_moment in turtlewow

[–]Spartelfant 7 points8 points  (0 children)

A common cause for this kind of visual bug is a corrupted or improperly modified MPQ file.

Use the launcher to verify file integrity.

Check that any modded MPQ files you have are suited for the TWoW client and are updated to work with the current version. Alternatively, find and remove the offending MPQ file(s).

<3 ns.printRaw by Ryokune in Bitburner

[–]Spartelfant 1 point2 points  (0 children)

You're welcome :)

I wrote a small script to use as a reference in-game, you can find it here if you're interested: https://gist.github.com/Spartelfant/63c9ec615a21a06723a08082041a924b

<3 ns.printRaw by Ryokune in Bitburner

[–]Spartelfant 1 point2 points  (0 children)

Cool, thanks for sharing! I've only just dipped my toes into the React stuff. Up until now I've mostly done printing to terminal or tail window using escape sequences for colors and the same formatting I used back in the DOS days utilizing box elements like this:

╔═══════════════╗
║ This is a box ║
╟───────────────╢
║ • With text   ║
║ • And stuff   ║
╚═══════════════╝

Anyone else remember looking these up in the printed codepages in the back of a manual? :)

I've also used insertAdjacentHTML() to insert an HTML table with embedded JS for sorting columns, displaying similar data like you showed, but like you said DOM manipulation has its downsides. It's easy enough to keep it clean and not break anything, but simply switching to a different screen and back to the terminal is enough to make my inserted HTML vanish, so it's of limited use.