Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: 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
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: 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.
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: 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...
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: 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.
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Dec 04, 2009 9:38 pm   
 
In vista home premium it would be "Regional and Language Options" in the control panel classic view. Or "Clock, Language, Region" in the default control panel view. hopefully it would be the same in buisness.

The first tab will allow you to set or customize your region.


Additional info
http://en.allexperts.com/q/Windows-Vista-3724/LANGUAGE-APPLIACATION-Windows-VISTA.htm

http://kbalertz.com/949793/Applications-observe-regional-settings-start-locale.aspx
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net