Home   Archive   Permalink



why is the timer not working ?

R E B O L []
    
;timer
    
protect-system
    
prin "Zeit eingeben:"
time: input
    
    
wait time    
    
    
    
print ""
    
print "done"
    
halt

posted by:   Mennohexo     23-Jul-2017/11:33:24-7:00



Try to check the type of your time. It probably is of type string.

posted by:   Arnold     23-Jul-2017/16:02:40-7:00



This will automatically convert to a time type, if an appropriate time value has been input by the user:
    
time: do input
    
You can also handle more potential user input errors if you want:
    
do get-time: [
    if not time? attempt [time: to-time do input] [
     print "re-enter a proper time value:"
     do get-time
    ]
]
    


posted by:   Nick     23-Jul-2017/16:27:45-7:00



Better yet, give them a default value:
    
do get-time: [
    if not time? attempt [
     time: to-time do request-text/title/default "Seconds:" copy "00:00:02"
    ] [
     alert "re-enter a proper time value"
     do get-time
    ]
]

posted by:   Nick     23-Jul-2017/20:32:50-7:00



Best, a function with no side effects or global variables:
    
get-time: func [/local time] [
    either time? attempt [
     time: to-time do request-text/title/default "Seconds:" copy "00:00:02"
    ][
     return time
    ][
     alert "re-enter a proper time value"
     get-time
    ]
]
var: get-time
time ; not set

posted by:   Nick     23-Jul-2017/20:41:42-7:00



Yeah , hello iArnold - dangerous programmer
    
time do input works.
    
i like easy programming.
    
lazy style. ha
    
; timer is enough. why a complete header.
    
    
make a object :
    
bank-account: make object! [ first-name: last-name: account: balance: none ]
    
READY ! object works.
    
other languages make it complicated.
    
Huuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuhhh
    a real object
That is strange and heavy. Huuuuuuuhh
    
drink: [whiskey cola whiskey cola water]
    
while [most programmers are further hacking]
         [drink a bourbon whiskey on the rocks
             on the beach togehter with two bikini
                 tanga girls drink: next drink]
    
wait delay: 1000
    
    


posted by:   Mennohexo     24-Jul-2017/4:04:28-7:00