Syntax Q's...


BeeHay

Recommended Posts

Hello again!

Just a few quick questions about some things I am unsure of...

Am I using the try correctly? Can I have a waitfor() after a try?


private timey = systime() + 120
while(1)
try
waitfor(SysTime() > timey, 10)
//do stuff here
Delay(1)
timey = SysTime() + 120
Delay(1)
catch()
endcatch()
endwhile
[/CODE]

Also, can I do "OR" in a wait for?

[CODE]
while(1)
waitfor((var < private.var) || (var2 < private.var2))
//do stuff
endwhile
[/CODE]

Any advice would be great!

Link to comment
Share on other sites

The try is correct, though your indentation needs work (might just be the post). I also typically put

? strLastError

at a minimum in my catch blocks so I can at least see the error in the command/alert window.

Yes, you can do OR in waitfor(). Waitfor takes an expression, so you can do any math that results in a number. BTW in your second code, you forgot the interval for waitfor().

Link to comment
Share on other sites

Thanks for the quick reply!

Yes, the forums "code" window wont let me tab to correct my indentation! :P

Ah yes, I forgot the interval in the last one....

Appreciate it!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.