mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-09 17:23:53 +01:00
another blocker against mku equal 0 and added tprintf
This commit is contained in:
parent
3ab306f9d7
commit
c9ab7908a7
4
dist/engine.bundle.js
vendored
4
dist/engine.bundle.js
vendored
File diff suppressed because one or more lines are too long
20
dist/vendor.bundle.js
vendored
20
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
17
doc/source/netscript/basicfunctions/tprintf.rst
Normal file
17
doc/source/netscript/basicfunctions/tprintf.rst
Normal file
@ -0,0 +1,17 @@
|
||||
tprint() Netscript Function
|
||||
===========================
|
||||
|
||||
.. js:function:: tprintf(format, args...)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
:param format: Format of the string to be printed.
|
||||
:param args: Values to be formatted
|
||||
|
||||
Prints a raw formatted string to the terminal.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
tprintf("Hello world!"); // Prints "Hello world!" to the terminal.
|
||||
tprintf("Hello %s", "world!"); // Prints "Hello world!" to the terminal.
|
@ -19,6 +19,7 @@ This includes information such as function signatures, what they do, and their r
|
||||
sleep() <basicfunctions/sleep>
|
||||
print() <basicfunctions/print>
|
||||
tprint() <basicfunctions/tprint>
|
||||
tprintf() <basicfunctions/tprint>
|
||||
clearLog() <basicfunctions/clearLog>
|
||||
disableLog() <basicfunctions/disableLog>
|
||||
enableLog() <basicfunctions/enableLog>
|
||||
|
@ -1112,8 +1112,13 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
|
||||
} else if (product.marketTa1) {
|
||||
sCost = product.pCost + markupLimit;
|
||||
} else if (isString(product.sCost)) {
|
||||
if(product.mku === 0) {
|
||||
console.error(`mku is zero, reverting to 1 to avoid Infinity`);
|
||||
product.mku = 1;
|
||||
}
|
||||
sCost = product.sCost.replace(/MP/g, product.pCost + product.rat / product.mku);
|
||||
sCost = eval(sCost);
|
||||
|
||||
} else {
|
||||
sCost = product.sCost;
|
||||
}
|
||||
|
@ -936,6 +936,9 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
post(`${workerScript.scriptRef.filename}: ${argsToString(arguments)}`);
|
||||
},
|
||||
tprintf: function(format, ...args) {
|
||||
post(vsprintf(format, args));
|
||||
},
|
||||
clearLog: function() {
|
||||
workerScript.scriptRef.clearLog();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user