SteveH_66 wrote:
Very true Toyman.

Edit : Oh, I don't think you would want to use stripText. It would strip out the period without replacing it with a space, so I think that would still leave your number that was in the decimal place wouldn't it? Which would make your number like 2700 instead of 270.0 or like 2354 instead of 235.4 or whatever. Haven't tested it, just a guess there. I think that was why I went with replaceText and getWord in my code instead of going with stripText.
Not if you do it this way, sometimes adding and subtracting to the $pos variable can cause flaky results, so just grabbing the "250." then stripping the "." is usually a more stable solution.
NOTE: I added the if statement just in the case you get a number with no ".", it's a safety to keep script from misfiring and you ending in a pod
Code:
setvar $maxfigs "250.2"
getwordpos $maxfigs $pos "."
if ($pos > "0")
cuttext $maxfigs $attack 1 $pos
striptext $attack "."
else
setvar $attack $maxfigs
end
echo ANSI_15 "**" $attack "**"
Using yours...slightly modded.
Code:
echo "***"
setVar $test 257.75
getwordpos $test $pos "."
cuttext $test $attack 1 $pos
echo "*" $attack & " This is the number, with decimal places"
stripText $attack "."
echo "*" $attack & " This is the number after stripText"
echo "***"
Result:
257. This is the number, with decimal places
257 This is the number after stripText