Assault Posted April 8, 2007 Posted April 8, 2007 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
BrettF Posted April 8, 2007 Posted April 8, 2007 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! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Assault Posted April 8, 2007 Author Posted April 8, 2007 (edited) 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 April 8, 2007 by Assault
BrettF Posted April 8, 2007 Posted April 8, 2007 Like this? expandcollapse popup#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 Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Assault Posted April 8, 2007 Author Posted April 8, 2007 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?
BrettF Posted April 8, 2007 Posted April 8, 2007 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? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Assault Posted April 8, 2007 Author Posted April 8, 2007 Oh I see so Its can be the way I want it. Heh it was in my script w/o being there I guess? Thank you for all your help.
BrettF Posted April 8, 2007 Posted April 8, 2007 Oh I see so Its can be the way I want it. Heh it was in my script w/o being there I guess?Thank you for all your help.Thanks k. What game is the bot for? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
BrettF Posted April 8, 2007 Posted April 8, 2007 The bot is for Guildwars.Cool. You must have been very excited to post that twice Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Assault Posted April 8, 2007 Author Posted April 8, 2007 Lol, My connection lagged so I hit refresh and it posted twice.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now