Jump to content

GUI "reset" and Checkbox help


skitt
 Share

Recommended Posts

The checkboxes value seems to be random when i start the GUI. its like 12 and 13 or some random number under 20. what i want it to do is give me a 0 if off and a 1 if on. Also, after i press my calculate button, it will do the fuction, but if i change a variable, or even not change anything, and press calculate again, it goes to 0 and doesnt work, meaning everytime i wanna do a calculation, i need to restart the GUI. Thats pretty much what im having trouble with. If you see anything else that looks wrong, don't hesitate to tell meh!

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 400, 179, 197, 127)
$Label1 = GUICtrlCreateLabel("Attack =", 296, 80, 44, 17)
$Label2 = GUICtrlCreateLabel("Label2", 344, 80, 36, 17)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Label3 = GUICtrlCreateLabel("Base Attack min - max", 16, 8, 109, 17)
$min = GUICtrlCreateInput("", 16, 32, 41, 21)
$Label4 = GUICtrlCreateLabel("-", 64, 32, 7, 17)
$max = GUICtrlCreateInput("", 80, 32, 41, 21)
$Label5 = GUICtrlCreateLabel("Added Attack", 8, 64, 69, 17)
$add = GUICtrlCreateInput("", 24, 88, 33, 21)
$Calculate = GUICtrlCreateButton("Calculate", 296, 32, 73, 25, $WS_GROUP)
$devo = GUICtrlCreateCheckbox("devo", 144, 32, 17, 17)
$best = GUICtrlCreateCheckbox("best", 144, 64, 17, 17)
$bow = GUICtrlCreateCheckbox("bow", 144, 96, 17, 17)
$speed = GUICtrlCreateCheckbox("speed", 144, 128, 17, 17)
$Devotion = GUICtrlCreateLabel("Devotion", 168, 32, 47, 17)
$control2 = GUICtrlCreateLabel("Bestial Fury", 168, 64, 58, 17)
$control4 = GUICtrlCreateLabel("Speed of the Wind", 168, 128, 93, 17)
$control3 = GUICtrlCreateLabel("Bow of Blessing", 168, 96, 79, 17)
$Label6 = GUICtrlCreateLabel("Enchant", 16, 120, 44, 17)
$Enchant = GUICtrlCreateInput("", 24, 144, 25, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$a = 0
$avg = 0
While 1
    ToolTip($devo&"   "&$best)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Calculate
            $min = GUICtrlRead($min)
            $max = GUICtrlRead($max)
            $add = GUICtrlRead($add)
            $devo = GUICtrlRead($devo)
            $Enchant = GUICtrlRead($Enchant)
            $best = GUICtrlRead($best)
            $bow = GUICtrlRead($bow)
            $speed = GUICtrlRead($speed)
            $avg = (($min+$max)/2)+($Enchant*4)
            $a = int($add+$avg+($avg*$devo*.4)+($avg*$best*.5)+($avg*$bow*.2)+($avg*$speed*.2)+($avg*.0785))
            $Label2 = GUICtrlCreateLabel($a, 344, 80, 36, 17)
    EndSwitch
WEnd
Link to comment
Share on other sites

  • Moderators

skitt,

That looks like a game bot to me.

I take it you have not read this?

Do not expect much help here. :blink:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

skitt,

That looks like a game bot to me.

I take it you have not read this?

Do not expect much help here. :blink:

M23

it has to do with calculating the total Attack you get when adding up the attack on your weapon, some other attack modifiers, buffs, ect. if you must know, its a game called aion. It has absolutely nothing to do with a bot. I do not condone cheating in any games.

Please don't jump to conclusions just because it has to do with a game.

Edited by skitt
Link to comment
Share on other sites

  • Moderators

skitt,

Please don't jump to conclusions just because it has to do with a game

The trouble is that we are so often correct. ;)

OK, I will believe you as on closer inspection it does seem to be a simple calculator. Perhaps you should make it clear with any future posts that although it deals witha game, it is NOT a bot. Might help! :

Anyway your problem results from the fact that you are overwriting the ControlIDs of the various controls with their contents when you press your Calculate button - like this:

; $speed holds the ControlID of the Checkbox
$speed = GUICtrlCreateCheckbox("speed", 144, 128, 17, 17)

; When you press the button the first time, you set $speed to the value of the checkbox (either 1=checked or 4=not checked)
$speed = GUICtrlRead($speed)

So when you press the button again - it tries to read another control and not the speed checkbox. :P

You need a separate set of variables to hold the contents - like this:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 400, 179, 197, 127)
$Label1 = GUICtrlCreateLabel("Attack =", 296, 80, 44, 17)
$Label2 = GUICtrlCreateLabel("Label2", 344, 80, 36, 17)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Label3 = GUICtrlCreateLabel("Base Attack min - max", 16, 8, 109, 17)
$min = GUICtrlCreateInput("", 16, 32, 41, 21)
$Label4 = GUICtrlCreateLabel("-", 64, 32, 7, 17)
$max = GUICtrlCreateInput("", 80, 32, 41, 21)
$Label5 = GUICtrlCreateLabel("Added Attack", 8, 64, 69, 17)
$add = GUICtrlCreateInput("", 24, 88, 33, 21)
$Calculate = GUICtrlCreateButton("Calculate", 296, 32, 73, 25)
$devo = GUICtrlCreateCheckbox("devo", 144, 32, 17, 17)
$best = GUICtrlCreateCheckbox("best", 144, 64, 17, 17)
$bow = GUICtrlCreateCheckbox("bow", 144, 96, 17, 17)
$speed = GUICtrlCreateCheckbox("speed", 144, 128, 17, 17)
$Devotion = GUICtrlCreateLabel("Devotion", 168, 32, 47, 17)
$control2 = GUICtrlCreateLabel("Bestial Fury", 168, 64, 58, 17)
$control4 = GUICtrlCreateLabel("Speed of the Wind", 168, 128, 93, 17)
$control3 = GUICtrlCreateLabel("Bow of Blessing", 168, 96, 79, 17)
$Label6 = GUICtrlCreateLabel("Enchant", 16, 120, 44, 17)
$Enchant = GUICtrlCreateInput("", 24, 144, 25, 21)
$Label2 = GUICtrlCreateLabel("", 344, 80, 36, 17) ; Create your label once <<<<<<<<<<<<<
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$a = 0
$avg = 0
While 1

    If GUICtrlRead($devo) = 1 Then
        $val_devo = 1
    Else
        $val_devo = 0
    EndIf
    If GUICtrlRead($best) = 1 Then
        $val_best = 1
    Else
        $val_best = 0
    EndIf

    ToolTip($val_devo & "   " & $val_best)

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Calculate
            $val_min = GUICtrlRead($min)
            $val_max = GUICtrlRead($max)
            $val_add = GUICtrlRead($add)
            $val_devo = GUICtrlRead($devo)
            $val_Enchant = GUICtrlRead($Enchant)
            $val_best = GUICtrlRead($best)
            $val_bow = GUICtrlRead($bow)
            $val_speed = GUICtrlRead($speed)
            $avg = (($val_min+$val_max)/2)+($val_Enchant*4)
            $a = int($val_add+$avg+($avg*$val_devo*.4)+($avg*$val_best*.5)+($avg*$val_bow*.2)+($avg*$val_speed*.2)+($avg*.0785))
            GUICtrlSetData($Label2, $a) ; And just change the value here
    EndSwitch
WEnd

All clear? :blink:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

ahh, thats makes total sense. thanks for the quick reply. when tested, though, the checkbox thing is still whacky. it gives be a larger number when the checkboxes are unchecked then when they aren't!

Edited by skitt
Link to comment
Share on other sites

  • Moderators

skitt,

Sorry, you need to apply the same test to the checkboxes when calculating as when setting the tooltip:

While 1

    If GUICtrlRead($devo) = 1 Then
        $val_devo = 1
    Else
        $val_devo = 0
    EndIf
    If GUICtrlRead($best) = 1 Then
        $val_best = 1
    Else
        $val_best = 0
    EndIf

    ToolTip($val_devo & "   " & $val_best)

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Calculate
            $val_min = GUICtrlRead($min)
            $val_max = GUICtrlRead($max)
            $val_add = GUICtrlRead($add)
            $val_Enchant = GUICtrlRead($Enchant)
            If GUICtrlRead($bow) = 1 Then
                $val_bow = 1
            Else
                $val_bow = 0
            EndIf
            If GUICtrlRead($speed) = 1 Then
                $val_speed = 1
            Else
                $val_speed = 0
            EndIf
            $avg = (($val_min+$val_max)/2)+($val_Enchant*4)
            $a = int($val_add+$avg+($avg*$val_devo*.4)+($avg*$val_best*.5)+($avg*$val_bow*.2)+($avg*$val_speed*.2)+($avg*.0785))
            GUICtrlSetData($Label2, $a)
    EndSwitch
WEnd

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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