Play Legend of the Green Dragon Play BNT Play Promisance Play Alien Assault Traders Play Quantum Star Play Some Chess  
   D3jsp RPGRPG   ArcadeArcade   Multiplayer PokerD3Jsp Poker   FAQ/RulesFAQ/Rules  SearchSearch  MemberlistMemberlist   UsergroupsUsergroups   ChatroomLive Chat   Log inLog in   RegisterRegister 

hopefully simple autoit question

 
Post new topic  Reply to topic  d3jsp Forum Index -> General Chat
View previous topic :: View next topic ::  


Author Message
the_pillo
The Magnificent

Group: Verified Member
Joined: 09 Jul 2009
Donor:
Posts: 1105
Gold: 0.00
Clan: Honor


us.gif

Status:
Warn:
Reputation: 32    



Post#1 Posted: 11 May 2010 05:41 pm    Post subject: hopefully simple autoit question Reply with quote

Ok, i want a sleep timer countdown... like say i want something to sleep for 14000000 ms...

i havent tried it yet but is there a simpler way other than something along the lines of:

Code:

$sleep = 14000000
do
sleep(1)
$time = $sleep - 1
tooltip ("Sleep Countdown : "  &  $time  & "")
untill $time = 0



EDIT:
i tested that code and it doesnt countdown, by all technical means it should right? (and yes i fixed typos first)


Last edited by the_pillo on 11 May 2010 05:55 pm; edited 1 time in total

_____________________


Happiness is a disease, and smiling is the cough that spreads it - pillo-

"When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Cinemax


Group: Members
Joined: 05 Jul 2008
Donor:
Posts: 8361
Gold: 12885.33
Clan: HoD II


us.gif

Status:
Warn:
Reputation: 116    



Post#2 Posted: 12 May 2010 01:21 am    Post subject: Re: hopefully simple autoit question Reply with quote

the_pillo wrote:
Ok, i want a sleep timer countdown... like say i want something to sleep for 14000000 ms...

i havent tried it yet but is there a simpler way other than something along the lines of:

Code:

$sleep = 14000000
do
sleep(1)
$time = $sleep - 1
tooltip ("Sleep Countdown : "  &  $time  & "")
untill $time = 0



EDIT:
i tested that code and it doesnt countdown, by all technical means it should right? (and yes i fixed typos first)













countdown
{
local OLD_IFS="${IFS}"
IFS=":"
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START

while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))

printf "\r%02d:%02d:%02d" \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))

sleep 1
done
IFS="${OLD_IFS}"
echo " "
}

countdown "00:07:55"









Or Try this.


countdown()
(
IFS=:
set -- $*
secs=$(( ${1#0} * 3600 + ${2#0} * 60 + ${3#0} ))
while [ $secs -gt 0 ]
do
sleep 1 &
printf "\r%02d:%02d:%02d" $((secs/3600)) $(( (secs/60)%60)) $((secs%60))
secs=$(( $secs - 1 ))
wait
done
echo
)

_____________________

If I accept you as you are, I will make you worse; however, if I treat you as though you are what you are capable of becoming, I help you become that.

Click to Join HOD
E-Mail: Cinemax@D3jsp.org

Verification info. Click Here
Back to top
View user's profile Send private message Send e-mail


the_pillo
The Magnificent

Group: Verified Member
Joined: 09 Jul 2009
Donor:
Posts: 1105
Gold: 0.00
Clan: Honor


us.gif

Status:
Warn:
Reputation: 32    



Post#3 Posted: 12 May 2010 01:30 am    Post subject: Re: hopefully simple autoit question Reply with quote

Cinemax wrote:
the_pillo wrote:
Ok, i want a sleep timer countdown... like say i want something to sleep for 14000000 ms...

i havent tried it yet but is there a simpler way other than something along the lines of:

Code:

$sleep = 14000000
do
sleep(1)
$time = $sleep - 1
tooltip ("Sleep Countdown : "  &  $time  & "")
untill $time = 0



EDIT:
i tested that code and it doesnt countdown, by all technical means it should right? (and yes i fixed typos first)













countdown
{
local OLD_IFS="${IFS}"
IFS=":"
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START

while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))

printf "\r%02d:%02d:%02d" \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))

sleep 1
done
IFS="${OLD_IFS}"
echo " "
}

countdown "00:07:55"









Or Try this.


countdown()
(
IFS=:
set -- $*
secs=$(( ${1#0} * 3600 + ${2#0} * 60 + ${3#0} ))
while [ $secs -gt 0 ]
do
sleep 1 &
printf "\r%02d:%02d:%02d" $((secs/3600)) $(( (secs/60)%60)) $((secs%60))
secs=$(( $secs - 1 ))
wait
done
echo
)


wow mi amigo, looks like C or something lol

i actually got it and was just about to post what i did to get it.. it was completly syntax failure on my part


I had the variable wrong it should look like this

Code:

$sleep = 14000000
do
sleep(1000)
$sleep = $sleep - 1
tooltip("Sleep Countdown: " &  $sleep & "")
until $sleep = 0


My issue was during the $sleep = $sleep - 1 i was trying to add in another variable and it was messing it up somewhere.. This does exactly what i need. Thank you for the effort, mi amigo. Thats crazy code though, i can read and interpret some of it but wow lol, i get lost in some areas.

_____________________


Happiness is a disease, and smiling is the cough that spreads it - pillo-

"When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
1 Members: Guest
Post new topic  Reply to topic  d3jsp Forum Index -> General Chat 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
You cannot attach files in this forum
You cannot download files in this forum



D3jsp is proudly powered by phpBB © 2.0
Theme and Forum by tramway