3DS Max, MaxScript string formatting problem

When i try to format a string it’s always put an “OK” the end of it.
And also the variable only keep the “OK”.
Any ideas?

I believe you have to create a stringStream and pass that into the format function. Otherwise, you’re just storing the return value of the format function, which is “OK” (which is lame). So:

myStringStream = stringstream ""
format "%" someVar to:myStringStream

Yes, you always have to format() to something. Generally it is either a StringStream or directly to the Listener REPL.

I use format regularly to print debug information directly to the listener just add a newLine ( \n ) character at the end.

format "Hello %\n" "world"

The OK appears now on a new line. The reason the OK is there because that is the return value of the format function. If you don’t want that, then indeed use format “%” stringStreamValue


Thank you all the replies!