I7: Numbers with thousands separated by commas

I’m in the process of porting my TADS 2 game, To Hell in a Hamper, over to I7, which, considering that I’ve written much larger and more complex I7 games, is proving much more of a headache than I imagined. (For my reasons, see this thread [url]https://intfiction.org/t/npapi-no-longer-supported-in-chrome-firefox/8636/1])

In the original TADS 2 code, the altitude of the balloon was expressed as a three-digit number called startroom.height, which started at 120.

I simply converted the number into a string using the function cvtstr( num ), and then used the substr( str, ofs, len ) to find the first, second and third letters of the string:

heightVerb: darkVerb verb = 'height' sdesc = "height" action(Actor) = { "The balloon is "; say(substr(cvtstr(startroom.height),1,2)); ","; say(substr(cvtstr(startroom.height),3,1)); "00 feet above the ground. "; say(startroom.height); } ;

I can’t find any way to do this in I7. What’s more, and I may be looking in the wrong places, but I can’t find any way to do this in I6 either.

An alternative approach would be to divide the altitude by 100 (call this X)

Then round down X to the nearest whole number to give the first digit (call this Y)

Then subtract the whole number Y from X to give the remainder (Z), and multiply Z by 100 to give the last two digits.

The problem with this approach is that I can’t find any way in I7 to return a whole number.

Any help / ideas would be greatly appreciated!