Jump to content

Recommended Posts

Posted (edited)

Hello,

Admire the magic! :)

Global $Explaination = "Welcome to this little Number Game." & @CRLF & @CRLF & "Follow these steps:" & _
                        @CRLF & "Step 1.: Select a number from  11 - 99, and add a 0 to it. (Number 1)" & _
                        @CRLF & "Step 2.: Select a number from 2 - 9 (Number 2)" & _
                        @CRLF & "Step 3.: Now do 'Number 2' × 9 (Number 3)" & _
                        @CRLF & "Step 4.: Now do 'Number 1' - 'Number 3' (Number 4)" & _
                        @CRLF & "Step 5.: Now put the 'Number 4' into the Input." & _
                        @CRLF & "Step 6.: Now press the button and admire the magic!"

$GUI = GUICreate("Number Game", 340, 170)
GUICtrlCreateLabel($Explaination, 10, 10)
$Input = GUICtrlCreateInput("", 100, 135, 25, 20)
$Button = GUICtrlCreateButton("Magic!", 130, 133, 100)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
    Case $nMsg = $Button
        $Read = GUICtrlRead($Input)
        If $Read = "" Then
            MsgBox(16, "ERROR", "Please fill in the number.")
        Else        
            If StringLen($Read) = 2 Then
                $Left = Number(StringLeft($Read, 1))
                $Right = Number(StringRight($Read, 1))
            ElseIf StringLen($Read) = 3 Then
                $Left = Number(StringLeft($Read, 2))
                $Right = Number(StringRight($Read, 1))
            EndIf
        
            $Result = $Left + $Right
        
            MsgBox(64, "Result", "Your first number was: " & $Result)
        EndIf
    EndSelect
WEnd

AlmarM

EDIT: Updated

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted (edited)

A little inattention, is last number(Num1-Num3) not number 3 that should be put in the input.

EDIT: And isn't so magic, it's just a beautiful part of math. BTW is very nice.

Edited by Andreik
Posted

Hello,

Admire the magic! :)

Global $Explaination = "Welcome to this little Number Game." & @CRLF & @CRLF & "Follow these steps:" & _
                        @CRLF & "Step 1.: Select a number from  11 - 99, and add a 0 to it. (Number 1)" & _
                        @CRLF & "Step 2.: Select a number from 2 - 9 (Number 2)" & _
                        @CRLF & "Step 3.: Now do 'Number 2' × 9 (Number 3)" & _
                        @CRLF & "Step 4.: Now do 'Number 1' - 'Number 3'" & _
                        @CRLF & "Step 5.: Now put the 'Number 3' into the Input." & _
                        @CRLF & "Step 6.: Now press the button and admire the magic!"

$GUI = GUICreate("Number Game", 340, 170)
GUICtrlCreateLabel($Explaination, 10, 10)
$Input = GUICtrlCreateInput("", 100, 135, 25, 20)
$Button = GUICtrlCreateButton("Magic!", 130, 133, 100)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
    Case $nMsg = $Button
        $Read = GUICtrlRead($Input)
        If $Read = "" Then
            MsgBox(16, "ERROR", "Please fill in the number.")
        Else        
            If StringLen($Read) = 2 Then
                $Left = Number(StringLeft($Read, 1))
                $Right = Number(StringRight($Read, 1))
            ElseIf StringLen($Read) = 3 Then
                $Left = Number(StringLeft($Read, 2))
                $Right = Number(StringRight($Read, 1))
            EndIf
        
            $Result = $Left + $Right
        
            MsgBox(64, "Result", "Your first number was: " & $Result)
        EndIf
    EndSelect
WEnd

AlmarM

EDIT: Updated

Maybe it should be

@CRLF & "Step 4.: Now do 'Number 1' - 'Number 3' (Number 4)" & _

@CRLF & "Step 5.: Now put the 'Number 4' into the Input." & _

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

Maybe it should be

@CRLF & "Step 4.: Now do 'Number 1' - 'Number 3' (Number 4)" & _

@CRLF & "Step 5.: Now put the 'Number 4' into the Input." & _

Ah yes :)

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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
×
×
  • Create New...