Sign in to follow this  
Followers 0
ecstatic

Timer which counts up then display in seconds in tooltip

11 posts in this topic

Hey guys.

Im not too sure what im doing wrong here, but if any could tell me that would be aweesome.

So basically, i have a loop which goes like this

1) Starts game

2) Logs in

3) Creates game - TIMER STARTED

4) Does ingame functions

5) Goes back to create-game screen.

Now @ number 5 it wait until the timer reaches 90 seconds or whatever the specified time is. Then it loops back to number 3.

Whats wrong with my tooltip and code.

Func CreateGame()
    
$timer = _Timer_Init()

....creates game...
endfunc

Func Lobby
    Do
        Tooltip("Sleeping for " & _Timer_Diff($timer) &" Seconds.", 0, 0, "D2AI")
        Sleep(10)
    Until _Timer_Diff($timer) >= 180000; 3 minutes
Endfunc

Share this post


Link to post
Share on other sites



Hey guys.

Im not too sure what im doing wrong here, but if any could tell me that would be aweesome.

So basically, i have a loop which goes like this

1) Starts game

2) Logs in

3) Creates game - TIMER STARTED

4) Does ingame functions

5) Goes back to create-game screen.

Now @ number 5 it wait until the timer reaches 90 seconds or whatever the specified time is. Then it loops back to number 3.

Whats wrong with my tooltip and code.

Func CreateGame()
     
 $timer = _Timer_Init()
 
 ....creates game...
 endfunc
 
 Func Lobby
     Do
         Tooltip("Sleeping for " & _Timer_Diff($timer) &" Seconds.", 0, 0, "D2AI")
         Sleep(10)
     Until _Timer_Diff($timer) >= 180000; 3 minutes
 Endfunc
You should be using TimerInit and TimerDiff.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

if the tooltip is not going up then it's prob that $timer cant be passed to other funcs unless you make it global or pass it via func()

Oh yes, I'd missed that the $timer was used in a different function.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You should be using TimerInit and TimerDiff.

What is the difference between _Timer_init and timerinit, it didnt change anything on my side.

if the tooltip is not going up then it's prob that $timer cant be passed to other funcs unless you make it global or pass it via func()

The timer goes up, but i want to make it appear in seconds and counting down for the user.

Wait so how do i pass it to another function or global like you guys said.

Edited by ecstatic

Share this post


Link to post
Share on other sites

well if the tooltip is going up then you must have already declared the $timer as global.

to make it go down it would just be Tooltip("Sleeping for " & 180000 - _Timer_Diff($timer) &" Seconds.", 0, 0, "D2AI")


Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

well if the tooltip is going up then you must have already declared the $timer as global.

to make it go down it would just be Tooltip("Sleeping for " & 180000 - _Timer_Diff($timer) &" Seconds.", 0, 0, "D2AI")

Testing.. Brb

Now it is counting down, but it still is in miliseconds and not seconds >.<

Edited by ecstatic

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

o and seconds is a division by 1000 so

Tooltip("Sleeping for " & (180000 - _Timer_Diff($timer))/1000 &" Seconds.", 0, 0, "D2AI")

or

Tooltip("Sleeping for " & 180 - (_Timer_Diff($timer)/1000) &" Seconds.", 0, 0, "D2AI")

EDIT: got confused by "reaches 90 seconds" & "180000; 3 minutes" which you used both of in the question , no matter , im sure you get the idea :D

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites

My suggestion :

$timer = TimerInit()
  
Do
    Tooltip("Sleeping for " & Round(TimerDiff($timer)/1000) &" Seconds.", 0, 0, "D2AI")
    Sleep(10)
Until TimerDiff($timer) >= 10000
This displayed the sconds correctly! but the delay is off, it auto-makes regardless of how long the game was

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

you need to do the same kinda thing to this part as well

Until TimerDiff($timer) >= 10000 ; i mean this is 10 seconds and will always be 10 seconds, you need to set it to the time you want or use a variable

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0