Sign in to follow this  
Followers 0
Bigginer

Need help. Not statements (Password)

8 posts in this topic

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

Share this post


Link to post
Share on other sites



If $Password = $RealPassword then 
    ;(do rest of script)
Else
    Exit
EndIf

:)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Paulie

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
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

It's my job to comfort the disturbed and to disturb the comfortable.
My Projects: Profiler, MakeSFX, UserInfo

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Ok. Works perfectly, thanks alot.

Btw, thanks Marc. I will try that too =)

Edited by Bigginer

Share this post


Link to post
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
Sign in to follow this  
Followers 0