You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to help with issues like #353 and #388, we need a consistent way of measuring current gain rates that any script can use.
While there are formulas APIs that let us get expected gain rates, there will not always be available, and it would be nice to have something that works for new players from the very start (before they have the SF that auto-grants formulas.exe). It would also be nice not to have to pay the price of formulas.exe and/or resort to ram-dodging, at least for now.
One idea I had was to take the "measureRepGainRate" function that work-for-factions.js uses, and expand on it:
/** Measure our rep gain rate (per second) * TODO: Move this to helpers.js, measure all rep gain rates over a parameterizable number of game ticks (default 1) and return them all. * @param {NS} ns * @param {() => Promise<number>} fnSampleReputation - An async function that samples the reputation at a current point in time */asyncfunctionmeasureRepGainRate(ns,fnSampleReputation){//return (await getPlayerInfo(ns)).workRepGainRate;// The game no longer provides the rep gain rate for a given work type, so we must measure itconstinitialReputation=awaitfnSampleReputation();letnextTickReputation;letstart=Date.now();while(initialReputation==(nextTickReputation=awaitfnSampleReputation())&&Date.now()-start<450)awaitns.sleep(50);return(nextTickReputation-initialReputation)*5;// Assume this rep gain was for a 200 tick}/** Measure our faction rep gain rate (per second) * @param {NS} ns */asyncfunctionmeasureFactionRepGainRate(ns,factionName){returnawaitmeasureRepGainRate(ns,async()=>awaitgetFactionReputation(ns,factionName));}/** Measure our company rep gain rate (per second) * @param {NS} ns */asyncfunctionmeasureCompanyRepGainRate(ns,companyName){returnawaitmeasureRepGainRate(ns,async()=>awaitgetCompanyReputation(ns,companyName));}
Currently, it supports getting faction or company reputation, but we could have other variations that measure changes in all player stats between ticks, and also get a more "stable" view of gains by measuring over several ticks and returning only the smallest gain for each stat (removing noise from occasional sporadic earnings)
The text was updated successfully, but these errors were encountered:
In order to help with issues like #353 and #388, we need a consistent way of measuring current gain rates that any script can use.
While there are formulas APIs that let us get expected gain rates, there will not always be available, and it would be nice to have something that works for new players from the very start (before they have the SF that auto-grants formulas.exe). It would also be nice not to have to pay the price of formulas.exe and/or resort to ram-dodging, at least for now.
One idea I had was to take the "measureRepGainRate" function that work-for-factions.js uses, and expand on it:
Currently, it supports getting faction or company reputation, but we could have other variations that measure changes in all player stats between ticks, and also get a more "stable" view of gains by measuring over several ticks and returning only the smallest gain for each stat (removing noise from occasional sporadic earnings)
The text was updated successfully, but these errors were encountered: