Im trying to access a specific area in a string
lets say I have a string 9934576 so I want to only access the 99 and 34 and 576 all separately
I want to access these numbers separately for an inventory system I want to save the rareity “gold,epic,rare,etc” and category “shirt,weapon,health,etc” the rest of the string would be for the item in the first place
chest to save if its been opened “if the chest number is in an array it will be opened”
chest level to see if players level is strong enough to open chest "ill most likely add a key and no key variant
Item id is why i would like to figure this out I feel it would add a lot more freedom for me in the future this would save the category and rarity of an item along with what item it would be
Amnt is incase duplicates there are no items that I wont want u to receive multiples of so im not gonna code in a feature for that
enchantments idrk if ill implement but i feel it would give more strategy
IDK how it works now after recent changes of variables
But you would turn number variable into string variable by writing ToString(Variable)
Now for you you still see 9934576
But for engine now that is text and not a number
So if you add 2 to it you won’t end up with 9934578
But with 99345762 cause now it is as if you have collection of letters and you add another letter to whole string
Imagine like each letter is block and you simply add another block to your structure
Kinda think building something with lego blocks
Ok now you can use StrAt(string, number)
So you could go with
StrAt(ToString(Variable),0)
StrAt(ToString(Variable),1)
Get
9
and
9 which are 1st two 99 of your 9934576
Be aware you get 9 and 9 not 99 from it
Imagine ToNumber(String) inverts process by changing string (letters) into numbers
So you could go
ToNumber(StrAt(ToString(Variable),0)+StrAt(ToString(Variable),1))
And from this you would get 99
Armed with that knowledge all you change for various positions of digits you need would be
And that would spit out 345 from 9934576
So inside this ToNumber( )
For each letter/digit you need StrAt(ToString(Variable),DigitPositionHere)
And if you need more than one then
StrAt(ToString(Variable),DigitPositionHere)+StrAt(ToString(Variable),DigitPositionHere)
You need + between expressions
It would be easier to store the data into structures or even a structure of structures.
If you want things to be in a single string then you could use the array tools extension. It has an expression that will break apart a text separated by say commas into an array. It would be more dynamic because the values could be different sizes.
There’s a regular expression extension that could be of help here too. Regular expressions (or regex) are a way of defining rules for pattern matching, and will do what you want.