Jump to content

1 button out of my 4 is causing the program to freeze!


Recommended Posts

So I wrote a script and it all worked well, I than started tweaking and adding small things testing it as I go. Now for some odd reason 1 button out of 4 on my GUI is causing the script to freeze and I have no idea why, It is the same as the other 3. I have even reverted back to the original script and looked at it line by line 3 times and still no luck =( Here is the script, the problem is when I click on the button "$Button3"

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ImageListConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\USER\Desktop\Crafter\Crafter.kxf
$Main = GUICreate("Crafter", 358, 287, -1, -1)
GUISetIcon("C:\Users\USER\Desktop\Crafter\Icons\JC.ico")
GUISetBkColor(0x000000)
$Pic1 = GUICtrlCreatePic("C:\Users\USER\Desktop\Crafter\Icons\Crafter.jpg", 97, 2, 162, 34, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("v1.0", 8, 0, 37, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x0000FF)
$Label2 = GUICtrlCreateLabel("Dazzled", 272, 255, 68, 31)
GUICtrlSetFont(-1, 14, 400, 0, "Pristina")
GUICtrlSetColor(-1, 0x00FF00)
$Button1 = GUICtrlCreateButton("Button1", 80, 65, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\USER\Desktop\Crafter\Icons\Button1.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label3 = GUICtrlCreateLabel("Button1", 81, 105, 43, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("Prospecting", 57, 36, 94, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Button2 = GUICtrlCreateButton("Button2", 80, 177, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\USER\Desktop\Crafter\Icons\Earth.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label5 = GUICtrlCreateLabel("Earth", 86, 221, 29, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label6 = GUICtrlCreateLabel("Converter", 30, 148, 148, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Label7 = GUICtrlCreateLabel(" Star", 191, 36, 97, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Button3 = GUICtrlCreateButton("Star", 223, 65, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\USER\Desktop\Crafter\Icons\Star.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label8 = GUICtrlCreateLabel("Star", 211, 105, 67, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label9 = GUICtrlCreateLabel(" Crafter", 207, 148, 65, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Button4 = GUICtrlCreateButton("Button4", 221, 177, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\USER\Desktop\Crafter\Icons\Crafting.ico", -1)
GUICtrlSetCursor (-1, 0)
$Input = GUICtrlCreateInput("10", 220, 232, 45, 21)
GUICtrlSetCursor (-1, 5)
$Label10 = GUICtrlCreateLabel("How many?", 213, 217, 60, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Now however the other 3 do exactly what I want (type stuff) Just when I click on button3 it wont type anything, allow me to click anything else, and the ONLY way to close is to right click program icon in system tray and close it, (cannot exit).

Link to comment
Share on other sites

I think some of your code must have gotten truncated when you copied/pasted your code... Can you post the rest of it?

Yeah here is all of it without being edited at all (last post was slightly edited to hide name and stuff)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ImageListConstants.au3>
#Include <GuiMenu.au3>

#Region ### START Koda GUI section ### Form=C:\Users\Kevin\Desktop\Jewel Crafter\JewelCrafter.kxf
$Main = GUICreate("Jewel Crafter", 358, 287, -1, -1)
GUISetIcon("C:\Users\Kevin\Desktop\Jewel Crafter\Icons\JC.ico")
GUISetBkColor(0x000000)
$Pic1 = GUICtrlCreatePic("C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Jewel Crafter.jpg", 97, 2, 162, 34, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("v1.0", 8, 0, 37, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x0000FF)
$Label2 = GUICtrlCreateLabel("Dazzled", 272, 255, 68, 31)
GUICtrlSetFont(-1, 14, 400, 0, "Pristina")
GUICtrlSetColor(-1, 0x00FF00)
$Saronite = GUICtrlCreateButton("Saronite", 80, 65, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Saronite.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label3 = GUICtrlCreateLabel("Saronite", 81, 105, 43, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("Prospecting", 57, 36, 94, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Earth = GUICtrlCreateButton("Earth", 80, 177, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Eternal Earth.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label5 = GUICtrlCreateLabel("Earth", 86, 221, 29, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label6 = GUICtrlCreateLabel(" Eternal Converter", 30, 148, 148, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Label7 = GUICtrlCreateLabel(" Disenchant", 191, 36, 97, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Disenchanter = GUICtrlCreateButton("Disenchant", 223, 65, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Disenchant.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label8 = GUICtrlCreateLabel("Disenchanter", 211, 105, 67, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label9 = GUICtrlCreateLabel(" Crafter", 207, 148, 65, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Crafter = GUICtrlCreateButton("Crafter", 221, 177, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Jewelcrafting.ico", -1)
GUICtrlSetCursor (-1, 0)
$Input = GUICtrlCreateInput("10", 220, 232, 45, 21)
GUICtrlSetCursor (-1, 5)
$Label10 = GUICtrlCreateLabel("How many?", 213, 217, 60, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    WinActivate("World of Warcraft.exe")
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Browse
            $var1 = FileOpenDialog ("Please locate and select your WoW.exe file.", @ProgramFilesDir, "Exe (*.exe)" )
            IniWrite ( "config.ini", "App" , "Test" , $var1 )
        Case $Saronite
            WinActivate('[TITLE:World of Warcraft]')
            Sleep(500)
            Send("{ENTER}")
            Sleep(200)
            Send('/cast prospecting')
            Sleep(200)
            Send("{ENTER}")
            Sleep(200)
            Send("{ENTER}")
            Send('/use Saronite Ore')
            Sleep(200)
            Send("{ENTER}")
        Case $Earth
            WinActivate('[TITLE:World of Warcraft]')
            Sleep(500)
            Send("{ENTER}")
            Sleep(200)
            Send('/use Eternal Earth')
            Sleep(200)
            Send("{ENTER}")
        Case $Crafter
            WinActivate('[TITLE:World of Warcraft]')
            Sleep(500)
            Send("{ENTER}")
            Sleep(200)
            Send('/run CloseTradeSkill()')
            Send('{ENTER}')
            Sleep(500)
            Send('{ENTER}')
            Sleep(200)
            Send('/cast Jewelcrafting')
            Sleep(500)
            Send('{ENTER}')
            Sleep(500)
            Send('{ENTER}')
            Sleep(200)
            Send('/run local s for i=1,GetNumTradeSkills() do s=GetTradeSkillInfo(i) if (s=="Bloodstone Band") then DoTradeSkill(i,' & GUICtrlRead($Input) & ') end end')
            Sleep(200)
            Send("{ENTER}")
        Case $Disenchanter
            WinActivate('[TITLE: World of Warcraft]')
            Sleep(500)
            Send('{ENTER}')
            Sleep(200)
            Send('/cast disenchant')
            Sleep(200)
            Send('{ENTER}')
            Sleep(200)
            Send('/use Bloodstone Band')
            Sleep(200)
            Send('{ENTER}')
            Sleep(4500)
            Send('{ENTER}')
            Sleep(200)
            Send('/use Crystal Chalcedony Amulet')
            Sleep(200)
            Send('{ENTER}')
            Sleep(4500)
            Send('{ENTER}')
            Send('/use Crystal Citrine Necklace')
            Sleep(200)
            Send('{ENTER}')
            Sleep(4500)
            Send('{ENTER}')
            Send('/use Sun Rock Ring')
            Sleep(200)
            Send('{ENTER}')
    EndSwitch
WEnd
Edited by kjpolker
Link to comment
Share on other sites

Yeah here is all of it without being edited at all (last post was slightly edited to hide name and stuff)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ImageListConstants.au3>
#Include <GuiMenu.au3>

#Region ### START Koda GUI section ### Form=C:\Users\Kevin\Desktop\Jewel Crafter\JewelCrafter.kxf
$Main = GUICreate("Jewel Crafter", 358, 287, -1, -1)
GUISetIcon("C:\Users\Kevin\Desktop\Jewel Crafter\Icons\JC.ico")
GUISetBkColor(0x000000)
$Pic1 = GUICtrlCreatePic("C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Jewel Crafter.jpg", 97, 2, 162, 34, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("v1.0", 8, 0, 37, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Papyrus")
GUICtrlSetColor(-1, 0x0000FF)
$Label2 = GUICtrlCreateLabel("Dazzled", 272, 255, 68, 31)
GUICtrlSetFont(-1, 14, 400, 0, "Pristina")
GUICtrlSetColor(-1, 0x00FF00)
$Saronite = GUICtrlCreateButton("Saronite", 80, 65, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Saronite.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label3 = GUICtrlCreateLabel("Saronite", 81, 105, 43, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("Prospecting", 57, 36, 94, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Earth = GUICtrlCreateButton("Earth", 80, 177, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Eternal Earth.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label5 = GUICtrlCreateLabel("Earth", 86, 221, 29, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label6 = GUICtrlCreateLabel(" Eternal Converter", 30, 148, 148, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Label7 = GUICtrlCreateLabel(" Disenchant", 191, 36, 97, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Disenchanter = GUICtrlCreateButton("Disenchant", 223, 65, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Disenchant.ico", -1)
GUICtrlSetCursor (-1, 0)
$Label8 = GUICtrlCreateLabel("Disenchanter", 211, 105, 67, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label9 = GUICtrlCreateLabel(" Crafter", 207, 148, 65, 28)
GUICtrlSetFont(-1, 14, 400, 2, "Harlow Solid Italic")
GUICtrlSetColor(-1, 0x00FF00)
$Crafter = GUICtrlCreateButton("Crafter", 221, 177, 41, 41, BitOR($BS_ICON,$WS_GROUP))
GUICtrlSetImage(-1, "C:\Users\Kevin\Desktop\Jewel Crafter\Icons\Jewelcrafting.ico", -1)
GUICtrlSetCursor (-1, 0)
$Input = GUICtrlCreateInput("10", 220, 232, 45, 21)
GUICtrlSetCursor (-1, 5)
$Label10 = GUICtrlCreateLabel("How many?", 213, 217, 60, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    WinActivate("World of Warcraft.exe")
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Browse
            $var1 = FileOpenDialog ("Please locate and select your WoW.exe file.", @ProgramFilesDir, "Exe (*.exe)" )
            IniWrite ( "config.ini", "App" , "Test" , $var1 )
        Case $Saronite
            WinActivate('[TITLE:World of Warcraft]')
            Sleep(500)
            Send("{ENTER}")
            Sleep(200)
            Send('/cast prospecting')
            Sleep(200)
            Send("{ENTER}")
            Sleep(200)
            Send("{ENTER}")
            Send('/use Saronite Ore')
            Sleep(200)
            Send("{ENTER}")
        Case $Earth
            WinActivate('[TITLE:World of Warcraft]')
            Sleep(500)
            Send("{ENTER}")
            Sleep(200)
            Send('/use Eternal Earth')
            Sleep(200)
            Send("{ENTER}")
        Case $Crafter
            WinActivate('[TITLE:World of Warcraft]')
            Sleep(500)
            Send("{ENTER}")
            Sleep(200)
            Send('/run CloseTradeSkill()')
            Send('{ENTER}')
            Sleep(500)
            Send('{ENTER}')
            Sleep(200)
            Send('/cast Jewelcrafting')
            Sleep(500)
            Send('{ENTER}')
            Sleep(500)
            Send('{ENTER}')
            Sleep(200)
            Send('/run local s for i=1,GetNumTradeSkills() do s=GetTradeSkillInfo(i) if (s=="Bloodstone Band") then DoTradeSkill(i,' & GUICtrlRead($Input) & ') end end')
            Sleep(200)
            Send("{ENTER}")
        Case $Disenchanter
            WinActivate('[TITLE: World of Warcraft]')
            Sleep(500)
            Send('{ENTER}')
            Sleep(200)
            Send('/cast disenchant')
            Sleep(200)
            Send('{ENTER}')
            Sleep(200)
            Send('/use Bloodstone Band')
            Sleep(200)
            Send('{ENTER}')
            Sleep(4500)
            Send('{ENTER}')
            Sleep(200)
            Send('/use Crystal Chalcedony Amulet')
            Sleep(200)
            Send('{ENTER}')
            Sleep(4500)
            Send('{ENTER}')
            Send('/use Crystal Citrine Necklace')
            Sleep(200)
            Send('{ENTER}')
            Sleep(4500)
            Send('{ENTER}')
            Send('/use Sun Rock Ring')
            Sleep(200)
            Send('{ENTER}')
    EndSwitch
WEnd

I am not a pro but thought id highlight a issue with your code so you can build on it. forgive me for my basic "debugging" skills in autoit.

So Button three(3) is $Disenchanter ? when i was testing it it locked the "jewel crafting" tool up on first try with default 10 , I terminated it ran with option 3 it worked then changed back to 10 and it kind of works, but some weird bug I'll try and explain.

I altered your script to output to notepad

WinActivate('[TITLE:Untitled - Notepad]')

Now the jewel crafting tool locks up if i activate all your buttons, so pressing Button1, then Button2, then button3, what makes it wierd is that when i do it like that if 10 is set it will run the buttons function 10 times.

But if i just activate one button only it will do its function just once.

Commands sent to Notepad if using one button only:

/cast disenchant
/use Bloodstone Band

/use Crystal Chalcedony Amulet

/use Crystal Citrine Necklace

/use Sun Rock Ring

Now here is the output if i press button1, then button2, then button3

/use Eternal Earth

/use Eternal Earth

/cast disenchant
/use Bloodstone Band

/use Crystal Chalcedony Amulet

/use Crystal Citrine Necklace

/use Sun Rock Ring

/cast disenchant
/use Bloodstone Band

/use Crystal Chalcedony Amulet

/use Crystal Citrine Necklace

/use Sun Rock Ring

/cast disenchant
/use Bloodstone Band

As you can see now /cast disenchant will run more than once, but the other function wont.

Hopefully one of the more skilled craftsman of autoit will be able to use my noobish attempt to debug to then provide you a solution :)

I play $wow$ also :)

ftc

Edited by failedtocompile
Link to comment
Share on other sites

I am not a pro but thought id highlight a issue with your code so you can build on it. forgive me for my basic "debugging" skills in autoit.

So Button three(3) is $Disenchanter ? when i was testing it it locked the "jewel crafting" tool up on first try with default 10 , I terminated it ran with option 3 it worked then changed back to 10 and it kind of works, but some weird bug I'll try and explain.

I altered your script to output to notepad

WinActivate('[TITLE:Untitled - Notepad]')

Now the jewel crafting tool locks up if i activate all your buttons, so pressing Button1, then Button2, then button3, what makes it wierd is that when i do it like that if 10 is set it will run the buttons function 10 times.

But if i just activate one button only it will do its function just once.

Commands sent to Notepad if using one button only:

/cast disenchant
/use Bloodstone Band

/use Crystal Chalcedony Amulet

/use Crystal Citrine Necklace

/use Sun Rock Ring

Now here is the output if i press button1, then button2, then button3

/use Eternal Earth

/use Eternal Earth

/cast disenchant
/use Bloodstone Band

/use Crystal Chalcedony Amulet

/use Crystal Citrine Necklace

/use Sun Rock Ring

/cast disenchant
/use Bloodstone Band

/use Crystal Chalcedony Amulet

/use Crystal Citrine Necklace

/use Sun Rock Ring

/cast disenchant
/use Bloodstone Band

As you can see now /cast disenchant will run more than once, but the other function wont.

Hopefully one of the more skilled craftsman of autoit will be able to use my noobish attempt to debug to then provide you a solution :)

I play $wow$ also :)

ftc

All buttons work but Disenchanter one, and I have NO IDEA why, I would love a solution =(
Link to comment
Share on other sites

To answer your question about making it sleep so much is because this has to manually type out what I want the game to do for me, since I don't know how to "inject" it into the game so it tells the game to do the following without having to type a script into chat. If you happen to know of a way to communicate with a game rather than typing I would love to know.

EDIT: Woooow, okay I apologize very much, I noticed just now I was editing a previous version the entire time, yet when running the program was using the non edited actual one, so I switched over to the intended one, deleted that small space in the WinActive and tada! Thank you soooo much.

Edited by kjpolker
Link to comment
Share on other sites

Wouldn't this be ridiculously easier if you just made like 3-4 macros on a separate action bar?

That way you could just do like... Send("1") and junk?

There are many crazy scripts available. Even ones that open your mailbox and take out the first item.

I wrote a small bot similar to what you're using for personal use. I still have the mailbox macros saved somewhere if you wish.

Link to comment
Share on other sites

Wouldn't this be ridiculously easier if you just made like 3-4 macros on a separate action bar?

That way you could just do like... Send("1") and junk?

There are many crazy scripts available. Even ones that open your mailbox and take out the first item.

I wrote a small bot similar to what you're using for personal use. I still have the mailbox macros saved somewhere if you wish.

Yes, I would love to know how to interact with gameplay without writing commands in chat if you could. That would be great! Either the script or a tutorial, if you want to IM me you can as well. send me a message if you would rather talk on IM (I have yahoo, msn, aim, facebook, myspace, etc)

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