jestermgee Posted February 22, 2008 Share Posted February 22, 2008 Sorry for an obvious question but i'm just trying to understand the terminology of this as I have only ever programmed batch files and I want to get away from them. Im confused on how to use a returned value from a function. What is the variable that is returned and how do I use it? I am trying to understand this and creating loops. If I display a message box which displays the OK and CANCEL buttons I know that they return values when each button is pressed but how do I read that value? I thought @error was used but it doesn't work for me. Nevermind about the very simple script below, it was just to figure this out but here's what the script should be doing: - A loop that starts with the question "OK or Not" - Press OK to get the "No Disk" message which loops you back to the top - Press Cancel to exit straight away While 1 MsgBox(1, "???", "Ok or not") If @error == 2 Then Exit EndIf MsgBox(0, "No Disk", "No Disk In Drive") WEnd As you know it just stays in the loop. I just need to know how I can create this situation so I can figure the rest out for myself. Link to comment Share on other sites More sharing options...
xzaz Posted February 22, 2008 Share Posted February 22, 2008 $var = MsgBox(1,"","Ok or not")if $var = 1 ThenMsgBox(0,"","Ok!")You can check it like this.Return ValueSuccess: Returns the ID of the button pressed. Failure: Returns -1 if the message box timed out. Button Pressed Return Value OK 1 CANCEL 2 ABORT 3 RETRY 4 IGNORE 5 YES 6 NO 7 TRY AGAIN ** 10 CONTINUE ** 11 Small Color Picker v0.2 | Travian bot Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now