Jump to content

mathwizz


thenewkid
 Share

would you use this  

2 members have voted

  1. 1. would you use this

    • i would use this
      0
    • i will not use this
      1
    • i may use this in the time to come
      1


Recommended Posts

mathwizz is a program you can use to test your math skills with

the script now works with the beta update

the code is not to clear as im new to programing and have been away from it for some time

things to add

setings hard med and easy

a timer

to add / to its list atm it will only do * - +

to make a sore board so you know if you are geting beter as well

and sounds

if you have any ideas plz post them :shocked:

things added

negative numbers

sounds

score borad

#include <GuiConstants.au3>
#include <Array.au3>
#include <File.au3>
Opt("TrayMenuMode",1)
Opt('TrayOnEventMode',1)

Global $numbers1, $numbers2, $simbol, $usersays, $usersay, $Result, $score, $name

$scoreborad = TrayCreateItem("Score borad")
TrayItemSetOnEvent($scoreborad,"Showscoreborad")
$trayexit = TrayCreateItem("Exit")
TrayItemSetOnEvent($trayexit,"_Exit")

;Start guis
GuiCreate("math wizz", 268, 90,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GuiCtrlCreateInput("", 90, 20, 160, 20)
$Label_2 = GuiCtrlCreateLabel("Name", 20, 20, 60, 20)
$Button_3 = GuiCtrlCreateButton("start", 90, 60, 90, 20)
GUISetBkColor( 0xB0B0D0 )
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button_3
            $name = GUICtrlRead($Input_1)
            ExitLoop
            GUIDelete("math wizz")
    EndSelect
WEnd


GuiCreate("Math wizz" & " " & $name , 312, 118,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Makethemath = GuiCtrlCreateButton("Make the math", 210, 20, 90, 20)
$Checkthemath = GuiCtrlCreateButton("Check the math", 210, 40, 90, 20)
$Exit = GuiCtrlCreateButton("Exit", 210, 60, 90, 20)
$seescore = GUICtrlCreateLabel($score, 250, 90, 90, 20)
$nubers1 = GuiCtrlCreateLabel($numbers1, 30, 30, 60, 20)
$simbal = GuiCtrlCreateLabel($simbol, 90, 30, 30, 20)
$mubers2 = GuiCtrlCreateLabel($numbers2, 140, 30, 50, 20)
$usersay = GuiCtrlCreateInput($usersays, 30, 60, 90, 20)
$Group_8 = GuiCtrlCreateGroup("The math", 10, 10, 200, 100)
$Label_9 = GuiCtrlCreateLabel($Result, 140, 60, 60, 20)
GUISetBkColor( 0xB0B0D0 )

GuiSetState()
; end of gui

$score = "0"
GUICtrlSetData($seescore, $score)
Func checkthemath()
    ;geting the numbers
    $n1 = GUICtrlRead($nubers1)
    $sb = GUICtrlRead($simbal)
    $n2 = GUICtrlRead($mubers2)
    ;doing some math
    $Res = $n1 & $sb & $n2
    $Result = Execute($Res)
    GUICtrlSetData($Label_9 ,$Result)
    $final = GUICtrlRead($Label_9)
    $us = GUICtrlRead($usersay)
    ; are we right?
    if $final = $us Then
        SoundPlay(@WindowsDir & "\media\tada.wav",1)
        ToolTip("thats right")
        $score += "1"
        GUICtrlSetData($seescore, $score)
        doingthemath()
    Else
        SoundPlay(@WindowsDir & "\media\chord.wav",1)
        ToolTip("Wrong")
        $score -= "1"
        GUICtrlSetData($seescore, $score)
    EndIf
EndFunc

Func doingthemath()
    ; to make the math
    GUICtrlSetData($usersay , "")
    GUICtrlSetData($Label_9 , "")
    $simbol = Random ( 1, 3, 1)
    if $simbol = 1 Then
        $simbol = "+"
        $numbers1 = Random( -9999, 9999,1)
        $numbers2 = Random( -9999, 9999,1)
    ElseIf $simbol = 2 Then
        $simbol = "-"
        $numbers1 = Random( -9999, 9999,1)
        $numbers2 = Random( -9999, 9999,1)
    ElseIf $simbol = "3" Then
        $simbol = "*"
        $numbers1 = Random( -100, 100,1)
        $numbers2 = Random( -100, 100,1)
    EndIf
    ; to set the math
    GUICtrlSetData($nubers1, $numbers1)
    GUICtrlSetData($simbal, $simbol)
    GUICtrlSetData($mubers2, $numbers2)
EndFunc

Func Showscoreborad()

    Dim $line
    ;to count the file lines
    $howmenylines = _FileCountLines ("Scores.txt")
    ;to make the arrays
    If Not _FileReadToArray("Scores.txt",$line) Then
        MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
        Exit
    EndIf
    ; to sart the arrays
    _ArraySort ($line ,1 ,0, $howmenylines)
    ;to show thw arrays
    _ArrayDisplay($line, "Score Borad")
EndFunc

Func _Exit()
    FileWriteLine("Scores.txt",$score & " " & "was " & $name &  " score" )
    Exit
EndFunc

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            _Exit()
        Case $msg = $Makethemath
            doingthemath()
        Case $msg = $Checkthemath
            checkthemath()
        Case $msg = $Exit
            _Exit()
    EndSelect
WEnd

Math_wizz.au3

Edited by thenewkid

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Link to comment
Share on other sites

Good math skill is using negative numbers too , I like the fact you mix up math operators like *+-/ ......keep going Mate :-D

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Link to comment
Share on other sites

its called 'MATH' Manadar....you know the stuff they teach at school.

I had to do an aptitude test for a job interview last week and simular apps helped me score an A :-D

Go get em thenewkid!!!!!

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Link to comment
Share on other sites

its called 'MATH' Manadar....you know the stuff they teach at school.

I'll take you on in a math test any time!! Be prepared to get your butt kicked.

I don't understand how to use this at all. =/ It's not very obvious.

Edit: Make the math, does nothing.

Check the math, shops a tooltip 'Thats right'

and Exit, exits..

I don't get it??

Edited by Manadar
Link to comment
Share on other sites

Make the math will make and show the question just above the textbox and check the math will tell you if you are right or wrong and show the answer next to the text box im working on a timer as well now for it

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Link to comment
Share on other sites

Make the math will make and show the question just above the textbox and check the math will tell you if you are right or wrong and show the answer next to the text box im working on a timer as well now for it

Make the math will not show the question for me. I'm using Windows XP Pro SP2, Classic theme, and AutoIt v3.2.3.6 Beta.

Link to comment
Share on other sites

doesn't work for me

Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Hey, nice code!

The problem when running the code with beta seems to be that you are using 3 parameters for GUICtrlSetData() each time.

The third parameter is not neccesary with a GUI Label object, as it's just for controls that need a default selection.

After removing all of the default value parameters for GUICtrlSetData, (I think there's 9 of them) your code works for me!

Have fun and Happy scripting!

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...