Jump to content

Trouble with GuiSetOnEvent


Recommended Posts

I honestly can't seem to figure out why this isn't working; however, I just learned about making a Gui and I wasn't very good at autoit initially. If someone could explain it or even clean it up, I'd be grateful. I didn't see the point in adding all the other functions yet considering that the 2 I had weren't working.

#include <GuiConstantsEx.au3>

GUI()

Func GUI()
   Opt("GUIOnEventMode", 1)
   Opt("GUICoordMode", 1)

   GUICreate("BabyPandaDGAF's Wonderful Creation", 600, 475)
   GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
   GUISetState()

   ;First Column
   GUICtrlCreateButton("Tower 1 Capture", 0, 0, 150, 68)
   GUISetOnEvent(-1, "T1C")

   GUICtrlCreateButton("Tower 1 Defense", 0, 68, 150, 68)
   GUISetOnEvent(-1, "T1D")

   GUICtrlCreateButton("Tower 1 Exterminate", 0, 136, 150, 68)
   GUISetOnEvent(-1, "T1E")

   GUICtrlCreateButton("Tower 1 Interception", 0, 204, 150, 68)
   GUISetOnEvent(-1, "T1I")

   GUICtrlCreateButton("Tower 1 Mobile Defense", 0, 272, 150, 68)
   GUISetOnEvent(-1, "T1MD")

   GUICtrlCreateButton("Tower 1 Sabotage", 0, 340, 150, 68)
   GUISetOnEvent(-1, "T1Sa")

   GUICtrlCreateButton("Tower 1 Survival", 0, 408, 150, 68)
   GUISetOnEvent(-1, "T1S")

   ; Second Column
   GUICtrlCreateButton("Tower 2 Capture", 150, 0, 150, 68)
   GUISetOnEvent(-1, "T2C")

   GUICtrlCreateButton("Tower 2 Defense", 150, 68, 150, 68)
   GUISetOnEvent(-1, "T2D")

   GUICtrlCreateButton("Tower 2 Exterminate", 150, 136, 150, 68)
   GUISetOnEvent(-1, "T2E")

   GUICtrlCreateButton("Tower 2 Interception", 150, 204, 150, 68)
   GUISetOnEvent(-1, "T2I")

   GUICtrlCreateButton("Tower 2 Mobile Defense", 150, 272, 150, 68)
   GUISetOnEvent(-1, "T2MD")

   GUICtrlCreateButton("Tower 2 Sabotage", 150, 340, 150, 68)
   GUISetOnEvent(-1, "T2Sa")

   GUICtrlCreateButton("Tower 2 Survival", 150, 408, 150, 68)
   GUISetOnEvent(-1, "T2S")

   ; Third Column
   GUICtrlCreateButton("Tower 3 Capture", 300, 0, 150, 68)
   GUISetOnEvent(-1, "T3C")

   GUICtrlCreateButton("Tower 3 Defense", 300, 68, 150, 68)
   GUISetOnEvent(-1, "T3D")

   GUICtrlCreateButton("Tower 3 Exterminate", 300, 136, 150, 68)
   GUISetOnEvent(-1, "T3E")

   GUICtrlCreateButton("Tower 3 Interception", 300, 204, 150, 68)
   GUISetOnEvent(-1, "T3I")

   GUICtrlCreateButton("Tower 3 Mobile Defense", 300, 272, 150, 68)
   GUISetOnEvent(-1, "T3MD")

   GUICtrlCreateButton("Tower 3 Sabotage", 300, 340, 150, 68)
   GUISetOnEvent(-1, "T3Sa")

   GUICtrlCreateButton("Tower 3 Survival", 300, 408, 150, 68)
   GUISetOnEvent(-1, "T3S")

   ; Fourth Column
   GUICtrlCreateButton("Tower 4 Capture", 450, 0, 150, 68)
   GUISetOnEvent(-1, "T4C")

   GUICtrlCreateButton("Tower 4 Defense", 450, 68, 150, 68)
   GUISetOnEvent(-1, "T4D")

   GUICtrlCreateButton("Tower 4 Exterminate", 450, 136, 150, 68)
   GUISetOnEvent(-1, "T4E")

   GUICtrlCreateButton("Tower 4 Interception", 450, 204, 150, 68)
   GUISetOnEvent(-1, "T4I")

   GUICtrlCreateButton("Tower 4 Mobile Defense", 450, 272, 150, 68)
   GUISetOnEvent(-1, "T4MD")

   GUICtrlCreateButton("Tower 4 Sabotage", 450, 340, 150, 68)
   GUISetOnEvent(-1, "T4Sa")

   GUICtrlCreateButton("Tower 4 Survival", 450, 408, 150, 68)
   GUISetOnEvent(-1, "T4S")

   While 1
      Sleep(100)
   WEnd
EndFunc

Func T1C()
   MsgBox(0, "Tower 1 Capture Rewards", "Boar Prime Receiver" & @CRLF & "Lex Prime Receiver" & @CRLF & "Paris Prime Grip" & @CRLF & "Forma Blueprint" & @CRLF & "Odonata Prime Blueprint" & @CRLF & "Void Key" & @CRLF & "Fusion Core")
EndFunc

Func T1D()
   MsgBox(0, "Tower 1 Defense Rewards", "Rotation A: Forma Blueprint, Fusion Core, Orokin Cell, and Void Key")
EndFunc

Func Close()
   Exit 0
EndFunc

 

Link to comment
Share on other sites

I honestly can't seem to figure out why this isn't working; however, I just learned about making a Gui and I wasn't very good at autoit initially. If someone could explain it or even clean it up, I'd be grateful. I didn't see the point in adding all the other functions yet considering that the 2 I had weren't working.

Game automation script help is not allowed. BTW, you want GUICTRLSetOnEvent

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Game automation script help is not allowed. BTW, you want GUICTRLSetOnEvent

​It's not game automation (literally opens a msgbox for each button; nothing else). It's clearly a helpful tool with information regarding what rewards are located in a specific place that anyone can go to. The information can be accessed through the game's wiki as well. This tool was only made to make the process of getting this information faster. Thank you though.

Edited by briancd2
Link to comment
Share on other sites

  • Moderators

Every single person has some reason why their post is unique and doesn't run afoul of the rules, even though it pretty clearly states no game interaction. We'll let a Mod weigh in.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

briancd2

As the script does not interact with the game itself I think we will leave this thread open, but please read the (there is also a link at bottom right of each page) before you post again so that you are aware of what is and is not allowed here.

M23

 

Edited by Melba23
Learning curve still steep

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