How can I do this mathematical operation of removing 1 from 1000000000 in Openbullet 2?
Hi,
Perhaps the compute block which does the mathematical operations?
But in this case no need for calculation
Hello,
The following value that I have commented out of 1000000000 is an example. What I want to do exactly comes below:
BLOCK:CurrentUnixTime
LABEL:CUT
=> VAR @CUT
ENDBLOCK
BLOCK:Compute
input = $“< CUT>-1”
=> VAR @computeOutput
ENDBLOCK
And I can’t get it to give me the right value, that is, subtract 1 from the CUT variable.
In the Current Unix Time block you got a value of 1675192988 and I want to subtract 1 from this value. The result of the mathematical operation should appear the following value 1675192987 but a different one appears, indicating that this is not what I want.
This should do the trick:
BLOCK:CurrentUnixTime
=> VAR @currentUnixTimeOutput
ENDBLOCK
BLOCK:RegexReplace
original = @currentUnixTimeOutput
pattern = "^\\d"
=> VAR @regexReplaceOutput
ENDBLOCK
In case u are trying to -1 from the unix string:
BLOCK:Script
INTERPRETER:Jint
INPUT
BEGIN SCRIPT
var currentTime = Math.floor(Date.now() / 1000);
var finalTime = currentTime - 1;
END SCRIPT
OUTPUT Int @finalTime
ENDBLOCK
Now it works.
Thanks for sharing your knowledge.