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 

Subtract seconds (math) [Help]

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


Joined: 15 Mar 2015
Posts: 317

PostPosted: Tue Feb 16, 2016 10:26 am    Post subject: Subtract seconds (math) [Help] Reply with quote

In the file "djhora" I have stored the time value "count4d" .
What I want is to recover this value and subtract it to the current time .
If the result is equal to 180 seconds then execute a command.
Code:

.....more commands.....
if {![file exists djhora]} {    
   set count4d [clock seconds]
          
   set temp [open "djhora" w+]
    puts $temp "$count4d"
   close $temp
   }

set temp [open "djhora" r]
set djh [gets $temp]
close $temp

   if {[expr {[clock seconds] - $djh}] == 180} { do more commands..... }


What is wrong ?
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed Feb 17, 2016 9:04 am    Post subject: Re: Subtract seconds (math) [Help] Reply with quote

Are you sure you want to use == ?

Whatever you are doing, won't it be difficult to hit it exactly on 180 seconds?

Perhaps you want >= or <= ?
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Wed Feb 17, 2016 10:32 am    Post subject: Re: Subtract seconds (math) [Help] Reply with quote

Thanks willyw, work fine! Very Happy
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
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