 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
feejo
Joined: 16 Jun 2007 Posts: 245
|
Posted: Tue Jan 22, 2008 8:35 pm Post subject: Error: A Goto/Gosub must not jump into a block that doesn't |
|
|
Error: A Goto/Gosub must not jump into a block that doesn't enclose it.
| Code: |
PixelGetColor, 3NB, 232, 195 ; 3e prix
If (3nb = 0x0080FF) ; Si le 3e chiffre est Orange, c'est un niveau 1 (JVO)
{
num:=1
Goto, fin
}
Else ; Pas détecté il recherche niveau 2.
...
Fin:
...
|
|
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 383 Location: Berlin
|
Posted: Tue Jan 22, 2008 8:42 pm Post subject: |
|
|
You should rework your script. AutoHotkey checks the whole scripts labels (but not that ones in a function). I have no clue how to solve this.
But why do you need this? Try to change the IF structure. |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 970 Location: London, UK
|
Posted: Tue Jan 22, 2008 8:57 pm Post subject: |
|
|
If you enclose the if and else code correctly the goto is not required.
Example | Code: |
If A=1
{
Do this
}
Else
{
Do this instead
}
Finish:
|
Which is what tuncay said  _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
feejo
Joined: 16 Jun 2007 Posts: 245
|
Posted: Wed Jan 23, 2008 9:38 pm Post subject: |
|
|
Here is my full script, I put a
*************ERROR HERE**************
where the script block.
| Code: |
1:
PixelGetColor, 3NB, 232, 195 ; 3e
If (3nb = 0x0080FF) ;Orange
{
num:=1 ; nombre de beep.
;Tooltip, Niveau 1 détecté. JVO.
;Sleep, 1000 ; pour attendre avant de rechèquer.
Goto, Fin ; *************ERROR HERE**************
}
Else ; Pas détecté il recherche niveau 2.
;Chèque pour le niveau 2 (JVV), il y a 2 conditions: vert sur 2e et 3e.
PixelGetColor, 2NB, 232, 180
If (2nb = 0x00FF00) ;vert
{
PixelGetColor, 3NB, 232, 195
If (3nb = 0x00FF00) ;Vert
{
num=3
Goto, fin
}
}
Else ;Chèque niveau 3
; Il va chèquer niveau 3: JJV
If (2nb = 0x00FFFF) ;J
{
If (3nb = 0x00FF00) ;V
{
num:=3 ; nombre de beep.
Goto, Fin
}
}
Else ; c'est niveau 4 ou rien.
;Va chèquer pour un niveau 4
PixelGetColor, 3NB, 232, 195
If (3nb = 0x00FFFF) ;J
{
num:=4 ; nombre de beep.
;Tooltip, Niveau 1 détecté. JVO.
;Sleep, 1000 ; pour attendre avant de rechèquer.
Goto, Fin
}
Else
Fin:
Loop
{
;InputBox, Num, Select, The number of beeps
If !Num or (Num = OldNum)
Continue
OldNum := Num
Loop %Num%
SoundBeep
}
Goto, 1
Exit
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Wed Jan 23, 2008 10:30 pm Post subject: |
|
|
Hi,
Is it the whole code?
The "1" label has no "Return" and there are useless "Elses".
Use proper code indentation to spot the errors. |
|
| Back to top |
|
 |
feejo
Joined: 16 Jun 2007 Posts: 245
|
Posted: Thu Jan 24, 2008 5:30 pm Post subject: |
|
|
Why when I execute this when it reach ******HERE******** num = empty.
| Code: | 1:
num:=1
Fin:
;InputBox, Num, Select, The number of beeps
Sleep, 1
Msgbox, num = %num% oldnum = %OldNum%
If (num:=OldNum)
{
goto, 1
}
Else
{
Sleep, 1000 ; Pour laisser le temps d'entendre lorsqu'il peut y avoir changement.
Msgbox, num = %num% oldnum = %OldNum% ******HERE********
SoundBeep 3000
num:=OldNum
Msgbox, num = %num% oldnum = %OldNum%
Goto, 1
}
Exit |
|
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jan 24, 2008 5:54 pm Post subject: |
|
|
this line "If (num:=OldNum)" should be "If (num=OldNum) or If num=%OldNum%".
The way it is you assigning to num the value stored in OldNum(blank) |
|
| Back to top |
|
 |
feejo
Joined: 16 Jun 2007 Posts: 245
|
Posted: Thu Jan 24, 2008 6:39 pm Post subject: |
|
|
 |
|
| 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
|