|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Thu Dec 03, 2009 11:56 am
[3.12] Variable floating number assignment error, adding a comma instead of dot |
I have found what makes the #ALARM stop working as described in this thread: http://forums.zuggsoft.com/forums/viewtopic.php?t=34256&sid=aa4279bc0d7a2db459b7d4fe53370c30
This problem is caused by an error in a variable assignment.
I have the following code:
Code: |
temp4=3.4
#ALARM "AlarmName" {-@temp4} {alarm code}
|
OR
Code: |
#VAR temp4 3.4
#ALARM "AlarmName" {-@temp4} {alarm code}
|
And sometimes, I haven't figured out during which circumstances, both variable assigning methods result in the variable temp4 getting the value 3,4 instead of 3.4. A comma, instead of a dot.
The code is placed inside an alias, and after a bunch of #IFs, it reaches to this code. When I have manually adjusted the value to 3.4 from 3,4 , and I've used #SHOW to display the values of temp4 before and after the assignings, it appears that the variable assignment itself replaces the dot with a comma. Eventually, after executing the alias some times, adjusted manually, or done I don't know what, the alias stops compiling and I get the following message:
"ERROR: Error in floating point value." (don't remember exact formulation)
Maybe it's a problem with the alias compiling?
I am now testing the following code, to see if it will repeat itself:
Code: |
#VAR temp4 {3.4}
#ALARM "AlarmName" {-@temp4} {alarm code}
|
I will update the thread when I find out more.
//DanteX |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Thu Dec 03, 2009 12:37 pm |
The following code
Code: |
#SHOW wait 4
#SHOW Temp4 before assigning 1: @temp4
#VAR temp4 {3.4}
#SHOW Temp4 after assigning 1: @temp4
#ALARM "AlarmName" {-@temp4} {alarm code}
|
returned the following:
Code: |
wait 4
Temp4 before assigning 1: 3.4
Temp4 after assigning 1: 3,4
|
and when I go to the alias "compiled code", I get the following message:
Error compiling script:
error in floating point value
The alias won't work at all now.
When I restart CMUD, it'll work fine... for a while. Until the problem occurs again.
EDIT: Now I'm attempting with having a "permanent" variable that's never modified that contains the value 3.4. The code is changed to:
Code: |
#SHOW wait 4
#SHOW Temp4 before assigning 1: @temp4
#VAR temp4 @temp3point4
#SHOW Temp4 after assigning 1: @temp4
#ALARM "AlarmName" {-@temp4} {alarm code}
|
so that the alias does a content transfer from one variable to another, instead of assigning a number directly. |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Thu Dec 03, 2009 3:22 pm |
The result of the last test:
Code: |
wait 4
Temp4 before assigning 1: 3.4
Temp4 after assigning 1: 3,4
|
with the code:
Code: |
#SHOW wait 4
#SHOW Temp4 before assigning 1: @temp4
#VAR temp4 @temp3point4
#SHOW Temp4 after assigning 1: @temp4
|
Strange... |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Dec 03, 2009 5:52 pm |
What country are you from? Are you in a country that uses the comma for floating point numbers instead of a decimal point? CMUD might be calling a Windows system routine that is changing it from a decimal point to a comma, and that might explain why I can't reproduce it here.
|
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Thu Dec 03, 2009 9:53 pm |
I'm from Sweden, and my system is a swedish win XP. The thing is that I also have a difficulty reproducing it, which is why I cannot specify what causes it to behave like this. The symptom I get when it happens is that other aliases stop compiling also... seemingly not all, but aliases in other package files. And after a restart, it's all ok mostly.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 04, 2009 5:29 am |
Is there any setting in Swedish Windows XP to set the currency character? Or does anybody know how I would change this on my Vista system? I recall that there was a way in XP to change my country settings, but I haven't found that in the Vista settings (Vista Business Edition here).
Anyway, if there is a way for you to turn this off, or set it to a decimal point in Windows itself, that would help to see if the problem goes away. |
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Fri Dec 04, 2009 7:35 am |
I could change the decimal sign in: Control panel -> National and language prefences -> Then using a button called "adapt" or something in the Enligsh version under the first tab, right near the language setting. Testing now to see if it'll repeat itself.
|
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Fri Dec 04, 2009 3:33 pm |
I haven't had problems since I changed to a dot from comma, so it could be it. I still don't want to say it's not happening cuz it's a too short time to test. But after not having crashes for 2-3 hours while it crashed every 30 before the change, I'm becoming positive regarding it.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 04, 2009 5:25 pm |
Looks like they moved or removed this in Vista. I don't have any "National and language preferences" in my Vista control panel. So this might be hard for me to fix. Most of CMUD uses my own string/number conversion routines, which all force the use of the decimal point. But obviously somewhere in CMUD it is calling the Windows or Delphi routines for conversion and that is picking up your national language settings and changing it to a comma.
I might be able to fix this by allowing the comma instead of the decimal point within my own conversion routines, so I'll add that to the to-do list for the future. But it will be hard for me to test whether that really fixes the problem or not. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
|
|
|
DanteX Apprentice
Joined: 13 Aug 2007 Posts: 166
|
Posted: Sun Dec 06, 2009 11:36 am |
Since changing to dot in Windows, the problem has not been repeated for like 2 days. Starts feeling safe to say that a windows comma delimiter COULD cause problems.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Dec 07, 2009 9:27 pm |
Found the "Regional and Language Options" control panel in Vista Business. I'll add this to the bug list to see if I can find the problem.
|
|
|
|
|
|