Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to get specific values from an Integer in Maxscript (ex. 4321, I want to get the 2nd digit which is 2). This fairly simple to do in Python. You can either use division and remainder methods:
n=2
value = 4321
SecondDigit = value // 10**n % 10
Or you can convert it to a string and get the character/digit:
value = 4321
NumberString = str(value)
int(NumberString[1])
I am having a really hard time doing this in Maxscript. Maxscript is a bit different from python and converting this logic over is difficult. would someone be able to point me in the direction?
Solved! Go to Solution.