Loli Code

Hello How i can Run This Code in OB2

BEGIN SCRIPT JavaScript
function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}
var Random = uuidv4();
END SCRIPT -> VARS "Random"

Search for the Script block, select Jint, paste the code (without the BEGIN SCRIPT and END SCRIPT lines obviously), configure the return variable correctly (both its name and type) and delete the prefilled input variables. Done.

Hi, when I use a condition in OB2 and specify in the condition that if the source has XX something will be captured, it will be shown in Log but in variable you can not tell the cause of this problem


Declare the variable outside, assign its value inside.

I did not Undrestand. Can you give an example?

Use the search function, this has been asked a thousand times ^^

BLOCK:Script
INTERPRETER:Jint
INPUT 
BEGIN SCRIPT
function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}
var UUID = uuidv4();
END SCRIPT
OUTPUT String @UUID
ENDBLOCK
1 Like