8,484
edits
Paradox-01 (talk | contribs) m (taking a viewport screenshot)  | 
				Paradox-01 (talk | contribs)  m (added "dealing with different decimal marks" //change of plan: update #1 will ship with support for different decimal signs, would be just awkward otherwise)  | 
				||
| Line 365: | Line 365: | ||
  	logmessage MyVar  |   	logmessage MyVar  | ||
  end if  |   end if  | ||
===dealing with different decimal marks===  | |||
Decimal sign is either period or comma.  | |||
Detect the used sign:  | |||
 logmessage Mid(FormatNumber(0.1, 1, true, false, -2), 2, 1)  | |||
OniSplit always uses the period sign but XSI uses the system used one, which is language-specific.  | |||
When xml files are loaded into XSI, the OniSplit formatted values need to be converted if necessary. Example:  | |||
 if Mid(FormatNumber(0.1, 1, true, false, -2), 2, 1) = "," then  | |||
    posX = cdbl(replace(posX, ",", "."))  | |||
    posY = cdbl(replace(posY, ",", "."))  | |||
    posZ = cdbl(replace(posZ, ",", "."))  | |||
 end if  | |||
Actually you only the replacement function because it will skip the operation if the sign to replace is not found.  | |||
When xml files are written, comma signs have to be replaced again.  | |||
 posX = replace(posX, ",", ".")  | |||
 posY = replace(posY, ",", ".")  | |||
 posZ = replace(posZ, ",", ".")  | |||
edits