Jump to content

Tinkering


 Share

Recommended Posts

Im trying to figure out gui's, so I started tinkering and trying to make something simple but I dont know where to put anything. So, I have a few questions.

Where do I put my script, Do I put it in the script with the gui or is that what the #include is for?

Example:

#include <GUIConstants.au3>;does this call an auto it script thats to be used with the gui?

guicreate("test",100,100)
GUISetBkColor(0xFFFFFF)

$box = guictrlcreatecheckbox("test",1,1)

GUISetState()



While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

;Or does the script go here? EXAMPLE:

While $box = $GUI_CHECKED
GUISetBkColor(0x000000)
WEnd

Thank you,

-Assault

Link to comment
Share on other sites

I edited it, and then explained it all:

#include <GUIConstants.au3> ;Includes the constants (all other includes) for the GUI- Stub file providing compatibility between the new library design and the old.
GUICreate("Test", 100, 100) ; Creates the GUI
GUISetBkColor(0xFFFFFF) ; Sets the Bkg Colour
$box = GUICtrlCreateCheckbox("Test", 1, 1); Creates and Checkbox

GUISetState() ; Sets the State to Show

;Any code to be run before the while loop goes here

While 1 ;Starts a Loop
    $msg = GUIGetMsg() ;Gets messages from the GUI
    Select ; Conditionally run statements.
        Case $msg = $GUI_EVENT_CLOSE ; If the GUI's close button is pressed, exit the program
            Exit ; exit
        Case GUICtrlRead($box) = $GUI_CHECKED ; checks if the $msg to see if the check box is checked.
            GUISetBkColor(0x000000) ; if so, change the bkg colour
    EndSelect
WEnd ;End the Loop

BTW: Welcome to the forums!

Link to comment
Share on other sites

Thank you,

Now I have another question if I want it to check if it to check if it is checked as it runs a script, gah here Ill explain it in a way thats easy for me.

Ok say its a bot in a game and the checkbox determins if it sells or not, how would I have it check if its checked when the bot is at the point that it either sells or bypasses that..... wow I just confused myself.

One more try lol.

#include <GUIConstants.au3>;heres the gui info

guicreate("test",100,100)
GUISetBkColor(0xFFFFFF)

$box = guictrlcreatecheckbox("test",1,1)

GUISetState()

;now I want a bot to run and go kill something and then pick up what the monster drops so,

call("farm")

func farm()
;goes
;and
;kills
call("loot")
endfunc

func loot()
;loots
call("sell")
endfunc

func sell()
;checks if the box is checked, if so it sells if not it doesnt
;my attempt
If $box = $GUI_CHECKED Then
;does all the selling
EndIF
call("farm")
endfunc

I dont know if you get what Im saying, But thanks for trying.

Edited by Assault
Link to comment
Share on other sites

Like this?

#include <GUIConstants.au3>;GUI Info

GUICreate("test", 100, 100) ; Creates the GUI
GUISetBkColor(0xFFFFFF) ;Sets the Bkg Colour

$box = GUICtrlCreateCheckbox("test", 1, 1) ; Creates the Checkbox

GUISetState() ; Shows the GUI

;You Have to Have a While Loop to Show the GUI! Because AutoIt runs code line by line, it will reach then end the close! The while loop prevents that!

While 1 
    $msg = GUIGetMsg ()
    Select
        Case $msg = $GUI_Event_Close
            Exit
    EndSelect
    Farm() ; /
    Loot() ;< What you did was made one function call another, then another, then the next, which caused a recursion error.  This is the equvielent! 
    Sell() ; \
WEnd
        

Func Farm ()

EndFunc 

Func Loot()

EndFunc

Func Sell()
    ;"checks if the box is checked, if so it sells if not it doesnt" So if it isn't checked, sell it?
    ;This is my attempt :)
    If NOT GUICtrlRead ($box) = $GUI_CHECKED Then ;YOU HAVE TO READ THE GUI CTRL! The NOT is to say that the gui isnt checked.
        ;Do some selling!
    EndIf
EndFunc
Link to comment
Share on other sites

Lol I could post my bot to show you why it needs to be that way but its easier to just say I need the farm function to call loot after it targets a monster of a different type(say it farms cows it pixel searches to find part of the s then it targets say a bug which causes it to call loot), so is their a way I could have it the way mine was setup because my bot is already coded, I just want to add a GUI but use the

GUICtrlRead ($box) = $GUI_CHECKED
in my sell function?

Link to comment
Share on other sites

Lol I could post my bot to show you why it needs to be that way but its easier to just say I need the farm function to call loot after it targets a monster of a different type(say it farms cows it pixel searches to find part of the s then it targets say a bug which causes it to call loot), so is their a way I could have it the way mine was setup because my bot is already coded, I just want to add a GUI but use the

GUICtrlRead ($box) = $GUI_CHECKED
in my sell function?
What about the GUICtrlRead? It was in your original script so i kept it there?
Link to comment
Share on other sites

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