ID:144694
 
Ok, Im having some trouble with the built in length proc, let me show you.

This part works fine:
mob/verb/test()
var/word = input("Enter a word please") as text
src << "The word has [length(word)] characters"


However I cannot seem to find a way for this:
mob/verb/test()
var/number = input("Enter a number please") as num
src << "The number has [length(number)] digits"



That is an example of what I am trying to do, however length() only seems to be working with text. How would I get it to work with numbers, or is there another way to do it?

Thanks, Zythyr.
If you want to find how big the number is a text, then convert it to test.

var/number = input("Enter a number please") as num
src << "The number has [length("[number]")] digits"
In response to Unknown Person
Thanks, that works fine. Just another question though, why does it only come up with a maximum of 12?
In response to Zythyr
It's doing that because after a certain amount of digits, it turns to scientific notation. To fix that, you can use num2text() and set the second argument to a higher number. There is also a natural limit to how high or low a number can be in DM.

src << "The number has [length(num2text(number, 100))] digits"


~~> Unknown Person
In response to Unknown Person
Ahh I see, thanks for the help.

.:: Zythyr ::.