Jump to content

GUI breaks all the time - (Locked)


Hankey
 Share

Recommended Posts

I was trying to make a pop-up GUI, but it always comes to an issue. It either loops all the time, so it's created and removed constantly, or doesn't work at all. 

 

Another try and the GUI doesn't want to be created even though conditions do work. Here's the last try:

Global $MP
Local $GUI2; = 1
Local $Labala = 1
Local $block = 0

While (1)

    $MP = GUIGetCursorInfo($GUI1)

    If $MP[4] == 23 Then ;22 = text of armor

        If $block == 0 Then

            TrayTip("", "???", 1)
            $GUI2 = GUICreate("", 100, 100, 100, 100, $WS_POPUP)
            $Labala = GUICtrlCreateLabel("???", 60, 60)
            GUICtrlSetBkColor($Labala, $BGC)
            GUICtrlSetColor($Labala, $ChampionC)
            GUISetState($GUI2, @SW_SHOW)
            $block = 1

        EndIf

    Else

        $block = 2

    EndIf

        If $block == 2 Then

            GUIDelete($GUI2)
            TrayTip("", "[pk", 1)
            $block = 0

        EndIf


    ;EndIf

WEnd

 

 

Funnily enough, I get an issue where a variable is not declared, but it clearly is declared. Everything works super nicely and good if I remove everything that contains "GUI" in it. 

Error screenshot: 9MapaCY.png

 

The variable $MP DID WORK before I've put "else $block = 2 endif". This script is basically a desperate move to make it work... I'm sitting here about 4 hours if not more doing the same thing with hundreds of different tries and nothing works...

Link to comment
Share on other sites

I don't know how to edit posts, but if there's another way of making a pop-up window that I can customize myself (text, color of background and text, maybe an icon, transparency) then feel free to inform me about it. I am quite new to AutoIt and I still don't know everything.

Link to comment
Share on other sites

Your script is telling you that you're trying to access an array when you don't have an array, you have a simple variable.

$MP = GUIGetCursorInfo($GUI1) ; this is a simple variable

If $MP[4] == 23 Then ; here's where you're trying to treat it as an array, and it's not

 

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

You're right, missed that.

Is $GUI1 a GUI you created with GUICreate, or is it another application's GUI? 

As an aside, using "==" is used for a case sensitive string comparison, you normally should use "=". 

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

No, this is not my entire script. The $BGC $ChampionC are previously declared color variables so I can use them everywhere in my script. 

Local $ChampionColor[3] = [0xFF, 0xFF, 0x0]
Local $ChampionC = _ColorSetRGB($ChampionColor)

 

I was making a helper program for a game where we could see all monster stats, items etc, just to help theorycrafting, blah, blah. Something similar to http://grimtools.com

Link to comment
Share on other sites

  • Developers

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...