 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Adzie Guest
|
Posted: Sat Jun 21, 2008 5:10 pm Post subject: What's wrong with my code? |
|
|
For some reason, my script, which worked flawlessly earlier has suddenly decided to prompt me with this:
| Code: | Error: The same variable cannot be used for more than one control. The current thread will exit.
Specifically: vMintime
|
But vMintime is only attached to one control. I searched my script (Notepad++) and it found 4 instances of "Mintime", and only one of "vMintime". Below is the code segment in which they're all contained:
| Code: |
Gui, Add, Edit, w50 x%bar%
Gui, Add, UpDown, w50 vMintime Range1-10, 4
gui,add,Button,x140 gGo,Go
gui,show, H120 Center, AdzWare HPF Cheat Script
Return
Go:
gui,submit,hide
gui, destroy
;
br2:=(300-30)/2
mxt:= (Mintime + 20)
gui,add,text,w300 +center,What is the maximum amount of time that the script should wait between loops (in minutes)?`n(Recommended - 10 minutes)
Gui, Add, Edit, w50 x%br2%
Gui, Add, UpDown, vMaxtime Range%Mintime%-%mxt%, 10
gui,add,Button, x140 gGo2,Go
gui,show, H120 Center, AdzWare HPF Cheat Script
Return
Go2:
gui,submit,nohide
gui, destroy
rmnt := (mintime*60000) |
Unless I'm completely blind and missing something, I can't work out what's wrong with it. The rest of the app works fine, so it isn't a critical flaw, but is there a way to fix it?
Thx |
|
| Back to top |
|
 |
Rhys
Joined: 17 Apr 2007 Posts: 722 Location: Florida
|
Posted: Sat Jun 21, 2008 6:25 pm Post subject: |
|
|
Something else is causing an entry to the top of that section again... Missing return? _________________ [Join IRC!]
 |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 908 Location: The Interwebs
|
Posted: Sat Jun 21, 2008 6:50 pm Post subject: |
|
|
Perhaps you closed the window using the exit button, and tried to open it again? Unless you add a GuiClose subroutine with a Gui, Destroy, the close button only hides it, which has made me run into some trouble before....
Just an idea. |
|
| Back to top |
|
 |
Adzie Guest
|
Posted: Sat Jun 21, 2008 8:18 pm Post subject: |
|
|
The error pops up as soon as I finish the prior section (entering a userid). I'm using GoSub to direct it to the section of code I've pasted in my last post:
| Code: |
[....]
If quant is not digit
{
msgbox,0,AdzWare HPF Cheat Script, Please enter a valid number of searches.
Gosub , SearchCol
}
If quant is digit
{ gosub , Times
}
;=========================;
Times:
bar:=(300-30)/2
gui,add,text,w300 +center,What is the minimum amount of time that the script should wait between searches (in minutes)?`n(Recommended - 4 minutes)
Gui, Add, Edit, w50 x%bar%
Gui, Add, UpDown, w50 vMintime Range1-10, 4
gui,add,Button,x140 gGo,Go
gui,show, H120 Center, AdzWare HPF Cheat Script
Return
Go:
gui,submit,hide
gui, destroy
;
br2:=(300-30)/2
mxt:= (Mintime + 20)
gui,add,text,w300 +center,What is the maximum amount of time that the script should wait between searches (in minutes)?`n(Recommended - 10 minutes)
Gui, Add, Edit, w50 x%br2%
Gui, Add, UpDown, vMaxtime Range%Mintime%-%mxt%, 10
gui,add,Button, x140 gGo2,Go
gui,show, H120 Center, AdzWare HPF Cheat Script
Return
Go2:
gui,submit,nohide
gui, destroy
rmnt := (Mintime*60000)
rmxt := (maxtime*60000)
[....] |
If there's a missing return, can you tell me where it's supposed to go?
Krogdor, I've got a GuiClose subroutine, and the error pops up as soon as I hit that stage of the script, before I even use the GUI. I've got no other instances of the script open either. Here's a screenshot:
It's repeating in the code in the same GUI, so I think Rhys is onto something, but I don't know what's causing it. |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 908 Location: The Interwebs
|
Posted: Sat Jun 21, 2008 8:24 pm Post subject: |
|
|
Maybe you should try and isolate that section of code? Make a script with only that first GUI, and if it works alright, add more of your code until you get the error again?
Edit:
Nevermind, I see the problem.
| Code: | If quant is not digit
{
msgbox,0,AdzWare HPF Cheat Script, Please enter a valid number of searches.
Gosub , SearchCol
}
If quant is digit
{ gosub , Times
}
return
;=========================;
Times:
bar:=(300-30)/2 |
|
|
| Back to top |
|
 |
Rhys
Joined: 17 Apr 2007 Posts: 722 Location: Florida
|
Posted: Sat Jun 21, 2008 8:46 pm Post subject: |
|
|
 _________________ [Join IRC!]
 |
|
| Back to top |
|
 |
Adzie Guest
|
Posted: Sat Jun 21, 2008 10:00 pm Post subject: |
|
|
Krogdor, it didn't work. Now it just repeats the inputbox for the number of searches twice, and then gives me the same error again  |
|
| Back to top |
|
 |
Adzie Guest
|
Posted: Sat Jun 21, 2008 10:22 pm Post subject: |
|
|
I've isolated the problem to this:
| Code: | #singleinstance force
IDCOL:
InputBox, userid, AdzWare HPF Cheat Script,Please enter your User ID.
if ErrorLevel
ExitApp
If userid is not digit
{
MsgBox,0,AdzWare HPF Cheat Script, Please enter a valid user ID
GoSub, IDCOL
}
If userid is digit
{ gosub, Checking
}
Checking:
ifnotequal, userid, 92950
{
gosub, SearchCol
}
ifequal, userid, 92950
{
msgbox,0,AdzWare HPF Cheat Script, Screw you =D
ExitApp
}
SearchCol:
Suspend, off
InputBox, quant, AdzWare HPF Cheat Script,How many searches would you like to make?
if ErrorLevel
ExitApp
If quant is not digit
{
msgbox,0,AdzWare HPF Cheat Script, Please enter a valid number of searches.
Gosub , SearchCol
}
If quant is digit
{ gosub , Times
}
Return
Times:
{
bar:=(300-30)/2
gui,add,text,w300 +center,What is the minimum amount of time that the script should wait between searches (in minutes)?`n(Recommended - 4 minutes)
Gui, Add, Edit, w50 x%bar%
Gui, Add, UpDown, w50 vMintime Range1-10, 4
gui,add,Button,x140 gGo,Go
gui,show, H120 Center, AdzWare HPF Cheat Script
Return
}
Go:
gui,submit,hide
gui, destroy
;
br2:=(300-30)/2
mxt:= (Mintime + 20)
gui,add,text,w300 +center,What is the maximum amount of time that the script should wait between searches (in minutes)?`n(Recommended - 10 minutes)
Gui, Add, Edit, w50 x%br2%
Gui, Add, UpDown, vMaxtime Range%Mintime%-%mxt%, 10
gui,add,Button, x140 gGo2,Go
gui,show, H120 Center, AdzWare HPF Cheat Script
Return
Go2:
gui,submit,nohide
gui, destroy
rmnt := (Mintime*60000)
rmxt := (maxtime*60000)
|
Because of that part of code, it asks for the user ID, opens up the times box correctly, but reopens the user ID box on top of the times box. If you re-enter the user id, it moves onto another time box, which is what causes the duplication issue. If you close the second user id box, the app exits.
Any ideas on how to fix it? |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 908 Location: The Interwebs
|
Posted: Sun Jun 22, 2008 5:40 am Post subject: |
|
|
| Code: | MsgBox,0,AdzWare HPF Cheat Script, Please enter a valid user ID
GoTo, IDCOL
}
If userid is digit
{ gosub, Checking
}
return
Checking:
ifnotequal, userid, 92950
{
gosub, SearchCol
}
ifequal, userid, 92950
{
msgbox,0,AdzWare HPF Cheat Script, Screw you =D
ExitApp
}
return |
Try that out and tell me how it works.[/u] |
|
| Back to top |
|
 |
Adzie Guest
|
Posted: Sun Jun 22, 2008 2:20 pm Post subject: |
|
|
Krogdor, all that did was hide the window and hang, but I got it working by removing:
| Code: | return
Checking:
ifnotequal, userid, 92950
{
gosub, SearchCol
} |
It falls through onto Checking anyway, so I don't need to direct it. Maybe I needed a return after the Checking subroutine, but nevermind. It's working now.
Thanks for all your help! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|