egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] missing close parenthesis

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
aRTiST
Voice


Joined: 17 Apr 2009
Posts: 4

PostPosted: Fri Apr 17, 2009 11:09 am    Post subject: [SOLVED] missing close parenthesis Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Apr 17, 2009 11:27 am    Post subject: Reply with quote

A close parenthesis is actually a ")". Most likely, it's this:
Code:
double(3.7G)
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
View user's profile Send private message
aRTiST
Voice


Joined: 17 Apr 2009
Posts: 4

PostPosted: Fri Apr 17, 2009 12:02 pm    Post subject: Thanks a lot :D Reply with quote

First of all THX Very Happy

The hint leads me the right way.

There was an "Sign" in that var
Code:



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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber