| View previous topic :: View next topic |
| Author |
Message |
aRTiST Voice
Joined: 17 Apr 2009 Posts: 4
|
Posted: Fri Apr 17, 2009 11:09 am Post subject: [SOLVED] missing close parenthesis |
|
|
| Code: | proc do:format {amount} {
set amount [stripcodes abcgru $amount]
if {[string match "*KB." $amount]} {
set amount [string map {"KB." ""} $amount]
set amount [expr double($amount)*1024]
} elseif {[string match "*MB." $amount]} {
set amount [string map {"MB." ""} $amount]
set amount [expr double($amount)*1024*1024]
} elseif {[string match "*GB." $amount]} {
set amount [string map {"GB." ""} $amount]
set amount [expr double($amount)*1024*1024*1024]
} elseif {[string match "*TB." $amount]} {
set amount [string map {"TB." ""} $amount]
set amount [expr double($amount)*1024*1024*1024*1024]
} elseif {[string match "*PB." $amount]} {
set amount [string map {"PB." ""} $amount]
set amount [expr double($amount)*1024*1024*1024*1024*1024]
} else {
set amount [string map {"B." ""} $amount]
set amount $amount
}
return $amount
}
proc format_1024_units {value} {
set len [string length $value]
if {$value < 1024} {
return [format "%s B" $value]
} else {
set unit [expr {($len - 1) / 3}]
return [format "%.1f %s" [expr {$value / pow(1024,$unit)}] [lindex [list B KB MB GB TB PB EB ZB YB] $unit]]
}
} |
This is part of a script that im trying to use, but i allways got the following error
| Code: |
Tcl error [do:addnukes]: syntax error in expression "double(235929600)+double(3.7G)": missing close parenthesis at end of function call |
The error leads to that part : | Code: |
set newcredits_day [expr double([lindex $userdata_day 0])+double([do:format $amount])]
set newcredits_week [expr double([lindex $userdata_week 0])+double([do:format $amount])]
set newcredits_month [expr double([lindex $userdata_month 0])+double([do:format $amount])] |
In my opinion parenthesis is a missing "}" , but i cant find an unclosed one.
i would be very happy for every help in that problem.
greets arti
Last edited by aRTiST on Sat Apr 18, 2009 1:55 pm; edited 2 times in total |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri Apr 17, 2009 11:27 am Post subject: |
|
|
A close parenthesis is actually a ")". Most likely, it's this:
where the G is to blame. Edit it to use proper integers, and it should work.
Edit: Think I hit submit abit early. It would seem the do:format proc fails to remove that G. It does use string map to remove GB, but that would fail to remove a simple G. Possible faulty/corrupt data in $amount ? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
aRTiST Voice
Joined: 17 Apr 2009 Posts: 4
|
Posted: Fri Apr 17, 2009 12:02 pm Post subject: Thanks a lot :D |
|
|
First of all THX
The hint leads me the right way.
There was an "Sign" in that var
That "" wouldnt be stripped by "set amount [stripcodes abcgru $amount]"
Now i have to remove that crap, not sure how but perhaps ill find a way.
thx nml375 |
|
| Back to top |
|
 |
|