reb Posted October 26, 2009 Posted October 26, 2009 Hi I have a script running (all functions called by hot keys) and if a condition is true (call it a flag) I need to exit the function before it finishes and keep the script running. I am really drawing a blank on this one. Here is an example of what I want to do. $test = "" test() Func Test() if $test = "" then EndFunc ; (If I use exit it closes the script but I need to keep the script running) MsgBox(0,"","this is a test") EndFunc Thanks for your help. REB MEASURE TWICE - CUT ONCE
reb Posted October 27, 2009 Author Posted October 27, 2009 Try Return.Here is what I tried.test()global $test, $x$test = "dick"Func Test() if $test = "" then Return $x; If I use exit it closes the scriptMsgBox(0,$test,"this is a test")EndFuncerror (6) : ==> Variable used without being declared.:if $test = "" then Return $xif ^ ERRORWhat am I doing wrong?REB MEASURE TWICE - CUT ONCE
AdmiralAlkex Posted October 27, 2009 Posted October 27, 2009 What am I doing wrong? REB Didn't you read the error? You used the variable before declaring it! You probably want your script to start more like: global $test, $x $test = "dick" test() .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Fubarable Posted October 27, 2009 Posted October 27, 2009 Perhaps because you're calling test() before you've declared $test.
reb Posted October 27, 2009 Author Posted October 27, 2009 Didn't you read the error? You used the variable before declaring it! You probably want your script to start more like: global $test, $x $test = "dick" test() I sure did. Works now THANK YOU REB MEASURE TWICE - CUT ONCE
reb Posted October 27, 2009 Author Posted October 27, 2009 Perhaps because you're calling test() before you've declared $test.Thank you.You are right on.REB MEASURE TWICE - CUT ONCE
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