Bigginer Posted August 15, 2007 Share Posted August 15, 2007 Hi.I'm trying to make a script that requires a password, i thought this would work but it doesn't.$Password = $Password = InPuTBox("Enter Password", "Enter the password", "")$RealPassword = "hello"If $Password = $RealPassword then (do rest of script)If $Password = NOT $RealPassword then Terminate.I can't get it to terminate the script if the wrong password is entered, does anybody know how to do this?Thanks Link to comment Share on other sites More sharing options...
Paulie Posted August 15, 2007 Share Posted August 15, 2007 If $Password = $RealPassword then ;(do rest of script) Else Exit EndIf Link to comment Share on other sites More sharing options...
Bigginer Posted August 15, 2007 Author Share Posted August 15, 2007 (edited) I can't get it to work lol. My script is, expandcollapse popupGlobal $Paused HotKeySet("{PAUSE}", "Togglepause") HotKeySet("{ESC}", "Terminate") sleep(42) MsgBox(0, "----", "---") $Password = InPuTBox("Enter Password", "Enter the password", "") $RealPassword = "---" send("{PAUSE}") While 1 If $Password = $RealPassword then If pixelgetcolor(556,965)=0x00AD6B Then Sleep( 90000 ) Send( "{END}" ) Sleep( 500 ) Send( "{INS}" ) Sleep( 500) Else Exit If pixelgetcolor(243,850)=0xADA99B Then Sleep( 90000 ) Send( "{END}" ) Sleep( 500 ) Send( "{INS}" ) Sleep( 500 ) EndIf EndIf EndIf WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) WEnd EndFunc Func Terminate() Exit 0 EndFunc What's wrong? =\ Edited August 15, 2007 by Bigginer Link to comment Share on other sites More sharing options...
Paulie Posted August 15, 2007 Share Posted August 15, 2007 (edited) And just for future reference, when using the "NOT" operator, it always precedes the entire condition: If NOT $a = $b then ;Do something ElseIf NOT $c = $d Or NOT $e = $f then ;Do something else EndIf Edited August 15, 2007 by Paulie Link to comment Share on other sites More sharing options...
Bigginer Posted August 15, 2007 Author Share Posted August 15, 2007 (edited) I can't get it to work lol. My script is, expandcollapse popupGlobal $Paused HotKeySet("{PAUSE}", "Togglepause") HotKeySet("{ESC}", "Terminate") sleep(42) MsgBox(0, "----", "---") $Password = InPuTBox("Enter Password", "Enter the password", "") $RealPassword = "---" send("{PAUSE}") While 1 If $Password = $RealPassword then If pixelgetcolor(556,965)=0x00AD6B Then Sleep( 90000 ) Send( "{END}" ) Sleep( 500 ) Send( "{INS}" ) Sleep( 500) Else Exit If pixelgetcolor(243,850)=0xADA99B Then Sleep( 90000 ) Send( "{END}" ) Sleep( 500 ) Send( "{INS}" ) Sleep( 500 ) EndIf EndIf EndIf WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) WEnd EndFunc Func Terminate() Exit 0 EndFunc What's wrong? =\ EDIT: Woops, edited post above too =) Edited August 15, 2007 by Bigginer Link to comment Share on other sites More sharing options...
Paulie Posted August 15, 2007 Share Posted August 15, 2007 expandcollapse popupHotKeySet("{PAUSE}", "Togglepause") HotKeySet("{ESC}", "Terminate") Global $Paused = 0, $RealPassword = "---" MsgBox(0, "----", "---") $Password = InPuTBox("Enter Password", "Enter the password", "") MsgBox(0, "----", "Press 'Pause' to begin the script.") TogglePause();Makes the script start "Paused" While 1 If $Password = $RealPassword then If pixelgetcolor(556,965)=0x00AD6B Then Sleep( 90000 ) Send( "{END}" ) Sleep( 500 ) Send( "{INS}" ) Sleep( 500) EndIf If pixelgetcolor(243,850)=0xADA99B Then Sleep( 90000 ) Send( "{END}" ) Sleep( 500 ) Send( "{INS}" ) Sleep( 500 ) EndIf Else Exit EndIf WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) WEnd EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Marc Posted August 15, 2007 Share Posted August 15, 2007 The nesting of IF-Conditions look a little confusing... press CTRL-T to auto-format the Source Code in the Scite Editor to see what I'm talking about. Instead of checking the passwort in the loop, I'd suggest something like this: $Password = InputBox("Enter Password", "Enter the password", "") $RealPassword = "---" If $Password <> $RealPassword Then Exit While 1 If PixelGetColor(556, 965) = 0x00AD6B Then [....] WEnd Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL) Link to comment Share on other sites More sharing options...
Bigginer Posted August 15, 2007 Author Share Posted August 15, 2007 (edited) Ok. Works perfectly, thanks alot. Btw, thanks Marc. I will try that too =) Edited August 15, 2007 by Bigginer 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