If variable(1) = 7th number of variable(2)

I am trying to get a specific number from a variable for example if 8 = 9th number of variable …

Is it Possible to do that? If yes then how?

Yes, actually!

To do that, you can use the SubStr() expression and set it to be the value of a variable - we will call that variable “Search”, for example - and then you can test it.
It’s easier showing it to you then explaining. For example, if you have a variable “A” with the value of “123456789”, you could do:

// Getting the value of the 9th number of variable A. // 
Do = SubStr(VariableString(A), 8, 1) to the text of scene variable "Search".

In that expression, “VariableString(A)” gets the string of the variable “A”, “8” is the value of the position you want, and “1” is the length of the string you want - in this case, only 1 character, as we only want the 9th digit. This way, the value of “Search” would be the 9th number in that string.
It’s important to remember that the position of the first character is of value 0, so the value of the 9th position would be 8. I’m not sure why, but it’s how it works.

// Testing if the 9th number of A equals 8 //
If scene variable "Search" is = 8
  do [insert your action here]

In this case, the result would be false, as the 9th number of my variable “A” is not 8, so the action would not be played.
I think there are other ways to do it too, but this is the easiest way in my opinion, and my favorite too. The expression can be found by clicking that blue button that says “ABC” next to the text input field - that holds a lot of useful expressions!

I hope this helps!

1 Like

Hi @MayhemCats !
Thank you for your response and thank you for informing me about all of this. I appreciate it!

1 Like

I’m glad I could help! ^^

I recently added it to the code and it seems as the thing is nonexistent?

Never mind I found out that it has to be “modify string” and not value. Thank you again

1 Like