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 

what am I doing wrong?

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


Joined: 12 Jul 2007
Posts: 248
Location: Libera

PostPosted: Mon Apr 22, 2013 5:34 am    Post subject: what am I doing wrong? Reply with quote

Code:
{exec cut \-d. \-f1 /proc/uptime} reply; set secs [expr $reply % 60]; set mins [expr $reply / 60 % 60]; set hours [expr $reply / 3600 % 24]; set days [expr $reply / 86400]

Can anyone please let me know how can I fix this? what am I doing wrong?
I'm not a coder, I'm trying to be one. this is from a script I found and I am trying to fix it.

The errors I get are:

Code:
% {exec cut \-d. \-f1 /proc/uptime} reply; set secs [expr $reply % 60]; set mins [expr $reply / 60 % 60]; set hours [expr $reply / 3600 % 24]; set days [expr $reply / 86400]
invalid command name "exec cut \-d. \-f1 /proc/uptime"
%

_________________
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Apr 22, 2013 6:15 am    Post subject: Reply with quote

if you wish to store the result of the exec command in the reply variable, then replace:
Code:

{exec cut \-d. \-f1 /proc/uptime} reply;

with either:
Code:

set reply [exec cut \-d. \-f1 /proc/uptime]

or:
Code:

catch {exec cut \-d. \-f1 /proc/uptime} reply

I would go with first option.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
spithash
Master


Joined: 12 Jul 2007
Posts: 248
Location: Libera

PostPosted: Mon Apr 22, 2013 8:39 am    Post subject: Reply with quote

what about this?

Code:
[03:59:38] <@spithash> ;set reply {exec cut -d. -f1 /proc/uptime} set secs [expr {$reply % 60}]; set mins [expr {$reply / 60 % 60}]; set hours [expr {$reply / 3600 % 24}]; set days [expr {$reply / 86400}]
[03:59:40] <@nigger> spithash: #29 Tcl error: can't use non-numeric string as operand of "%"

_________________
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Apr 23, 2013 12:27 am    Post subject: Reply with quote

Before the set secs you forgot to add an ;

Try with:
Code:

set reply [exec cut -d. -f1 /proc/uptime]; set secs [expr {$reply % 60}]; set mins [expr {$reply / 60 % 60}]; set hours [expr {$reply / 3600 % 24}]; set days [expr {$reply / 86400}]

_________________
Once the game is over, the king and the pawn go back in the same box.
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