Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using sum to do certain action
#1
Hello.
I'm trying to create a method to perform a certain action when a variable fulfills a certain condition.
But it is not working, the program accuses duplicity in the variable "i".
It would be better for me if I could start a timer, when starting the script and doing a certain action after 30 seconds for example, restarting the timer.
Thanks
For example:
Code:
Copy      Help
int i=1
;; start stopwatch
Loop
    wait 0.1
    RECT r;
    SetRect &r 650 284 859 400 ;
    if(scan("color:0x55AAFF" w r 16 4))
        mou r.left+r.right/2 r.bottom+50
        key+ F2 ;; F3
        wait 0.1
        key- F2 ;; F3
;;      if (stopwatch = 30 seconds)
                key V           ;; Space
                restart stopwatch
        int i+
        if (i=15)
                key V           ;; Space
                int i=1
        goto Loop ;;
    SetRect &r 12 77 1414 649 ;
    if(scan("color:0x55AAFF" w r 16 4))
        mou r.left+r.right/2 r.bottom+50
        key+ F2 ;; F3
        wait 0.1
        key- F2 ;; F3
        goto Loop ;;
    else
        key V           ;; Space
        wait 0.5
        goto Loop ;;
#2
I try it, but display error message:
this variable is already declared. If you want to use the same variable, remove the second declaration (typename and space before the variable).
 
Code:
Copy      Help
int time=timeGetTime+5000
rep
    out timeGetTime
    if (time<timeGetTime)
        out "5 seconds after"
        int time=timeGetTime+5000
        out "reset timestamp"
        shutdown -6
        wait 0.2

Works!
Code:
Copy      Help
int time=timeGetTime+5000
rep

    if (time<timeGetTime)
        out "passaram os segundos"
        time=timeGetTime+5000
        out "resetando timestamp"
        wait 2


Forum Jump:


Users browsing this thread: 1 Guest(s)