Help #java script

Hello guys! :slight_smile:

it didn’t work with LS, how do I implement it in the script block

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 GUID = uuidv4()
END SCRIPT -> VARS "GUID" ```

Remove the BEGIN SCRIPT and END SCRIPT line, they are not needed anymore. And then add an output variable of type string called GUID (remove the existing one). Done.

1 Like

I did as you said :joy:

Script (InvokeJint) <<

Executed Jint script with completion value: undefined

Yes there is no completion value, but you get your correct output variable

Here you go

BLOCK:Script
INTERPRETER:NodeJS
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 GUID = uuidv4()
END SCRIPT
OUTPUT String @GUID
ENDBLOCK
1 Like

:joy: :joy: :joy: :joy: :joy: :joy:

image

I forgot to tell you that you have to Install NodeJS first

Change NodeJS to JINT and even if the Output is Undefined, you can still use the Variable GUID

@FairyRoot @Ruri Thanks a lot for the help! Love you

image

you’re the most welcome buddy

2 Likes

Thank you as well, was following thoroughly. :heart:

With pleasure ^^, I really am glad to help.

1 Like