Jump to content

Need help. Not statements (Password)


Recommended Posts

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

I can't get it to work lol. My script is,

Global $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 by Bigginer
Link to comment
Share on other sites

I can't get it to work lol. My script is,

Global $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 by Bigginer
Link to comment
Share on other sites

HotKeySet("{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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...