Unable to get the result!

Hello again
I’m trying to use the previous value as a variable which is a UnixTime so to translate it into date and I used data.NEXT for the variable name but I’m facing this error! could anybody explain that to me please?

image

Only predefined variables need the data. prefix. For all the other variables just write their name, so in this case just write NEXT

1 Like

Well, I did try that one and this is what I’ve encountered

image

Yes that is because the timestamp is in milliseconds (13 digits) and not seconds (10 digits). Sadly OB2 only supports int32 parameters not int64 so the timestamp in milliseconds is too big to fit in 32 bits, you will need to cut the last 3 digits (which are usually not important) through a Substring block (assign it to a new variable), and then plug the new variable in the block like you did now.

1 Like

There is also a trick to do it in a single block using the range operator like this

BLOCK:ConstantString
  value = "1637515515000"
  => VAR @unix
ENDBLOCK

BLOCK:UnixTimeToDate
  unixTime = @unix[0..10]
  => VAR @date
ENDBLOCK

Basically [0..10] means get the first 10 digits from the original timestamp.
So in your case replace NEXT with NEXT[0..10] and it will work just fine ^^

1 Like

Thank you is not enough, I was stuck searching it for hours lol :sweat_smile: appreciate it

image

OB2 is a bit harder than OB1 because in OB1 everything was a string and LoliScript was an interpreted language, while OB2 has more variable types and LoliCode is a compiled language since it translates directly to C# code.

This has a lot of advantages but it’s also harder to learn since some design choices are enforced by the need to always produce C# code that works.

1 Like

Exactly it seems like everything we knew in OB1 has been completely changed but also improved because I see that the check process is better than before and x3 faster

That’s partially due to the fact that the code is compiled for speed (especially when working with loops etc.) but also because I rewrote the Http library (not using a 3rd party lib anymore) and it’s much more performant. Plus there were improvements in .NET itself over the years.

I am planning to add support for reusing the same underlying connection for different requests to the same host over the same proxy soon, which is going to speed up the process of sending multiple requests by a LOT, you will definitely see the difference.

1 Like

I can tell that the updates are always a good thing that the developer must think about because it always show a great result especially in such domain.
Also the idea of using more than one request for the same host that would be absolutely the best thing ever.