Jump to content
Sign in to follow this  
lawonama

A little bug in my code?

Recommended Posts

lawonama

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Start
    If $Begin = 0 then
        SplashTextOn("CSBH", "Hello", 700, 60, -1, -1, 1, "", 24)
        Sleep(2000)
        SplashOff()
        Sleep(100)
        $Begin = 1
    EndIf
    If $Begin = 1 then
        SplashTextOn("CSBH", "Bye", 700, 60, -1, -1, 1, "", 24)
        Sleep(2000)
        SplashOff()
        Sleep(100)
        $Begin = 0
    EndIf
        Case $Info
            MsgBox(4096, "Info", "Mady by Lawonama!")
    EndSwitch
WEnd

I have this code. It needs to;

> Show a splash text

> Sleep 2000

> Set the splash text off

> Sleep 100

> Set the variable $begin to 0 without applying it.

Buy it applies, how can I fix it?

Share this post


Link to post
Share on other sites
AdmiralAlkex

Best would probably be to make it only 1 if, example:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Start
    If $Begin = 0 then
        SplashTextOn("CSBH", "Hello", 700, 60, -1, -1, 1, "", 24)
        Sleep(2000)
        SplashOff()
        Sleep(100)
        $Begin = 1
    ElseIf $Begin = 1 then
        SplashTextOn("CSBH", "Bye", 700, 60, -1, -1, 1, "", 24)
        Sleep(2000)
        SplashOff()
        Sleep(100)
        $Begin = 0
    EndIf
        Case $Info
            MsgBox(4096, "Info", "Mady by Lawonama!")
    EndSwitch
WEnd

Or make sure the second If isn't run if the first one is, example:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Start
    If $Begin = 0 then
        SplashTextOn("CSBH", "Hello", 700, 60, -1, -1, 1, "", 24)
        Sleep(2000)
        SplashOff()
        Sleep(100)
        $Begin = 1
        ContinueLoop
    EndIf
    If $Begin = 1 then
        SplashTextOn("CSBH", "Bye", 700, 60, -1, -1, 1, "", 24)
        Sleep(2000)
        SplashOff()
        Sleep(100)
        $Begin = 0
    EndIf
        Case $Info
            MsgBox(4096, "Info", "Mady by Lawonama!")
    EndSwitch
WEnd

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  

×