mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2013
Posts: 4
C
Cheer Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Sep 2013
Posts: 4
So this problem is really strange. I have a script of roughly 500 lines of code. I have a goto error message saying that the goto "is not found" ... but it quite obviously is there.... I took a screen shot... can someone explain to me why I am getting that error when it quite obviously is there???

http://i41.tinypic.com/whfku1.jpg Theres the screen shot

As you can see in the screenshot the goto is quite obviously there but its saying its not found. Why????

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
The part that is called by the script is missing, misspelled or somthing else, no one here can help you if you dont give us the part that are broken.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Sep 2013
Posts: 4
C
Cheer Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Sep 2013
Posts: 4
There is only one script file. The script isn't multiple parts. Also, in the screenshot. You can see that "Goto mustcalcy" and :mustcalcy are BOTH there. You can see that in the screenshot and you can see clearly that they are not misspelled. You can double and triple check the screenshot for yourself

Last edited by Cheer; 04/09/13 04:44 AM.
Joined: Feb 2011
Posts: 448
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 448
Look, paste the entire script here. We need to read the entire script to see what is going wrong. Using screenshots instead of pasting the script will get you nowhere.

Joined: Sep 2013
Posts: 4
C
Cheer Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Sep 2013
Posts: 4
The script is too long to paste in here. I just want to know why it says its not found when its quite obviously there? The rest of the script works totally fine. The only issue is in that screenshot where it says its not there but it very clearly is

Last edited by Cheer; 04/09/13 09:55 AM.
Joined: Aug 2013
Posts: 81
I
Babel fish
Offline
Babel fish
I
Joined: Aug 2013
Posts: 81
If you feel a script is too long to paste directly in the forum, you could always try using a pastebin and posting the link: (http://pastebin.com and http://pastebin.ca are two examples)

After a bit of quick testing, I believe what may be happening here is that since the if condition is evaluated to false, anything associated with it is ignored/never processed or seen - including the goto label. A simple example of this can be seen in the following alias:

Code:
alias gototest {
  if (0) { 
    :test
    echo -ga Ok 
  }
  else goto test
}


...Which gives the error: * /goto: 'test' not found.

What I would recommend is putting the goto label before the if, and using an or condition on that if statement that only evaluates to true if the else had been reached first... Quick example (based on the alias above):

Code:
alias gototest {
  :test
  if (0) || (%n) { 
    echo -ga Ok 
  }
  else {
    var %n 1
    goto test
  }
}


...Which echos Ok as expected.


Joined: Sep 2013
Posts: 4
C
Cheer Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Sep 2013
Posts: 4
Ok. I understand. That makes sense now. It should really say ":test condition false" or something rather than saying "Not found" because Not found causes confusion because its saying that it isn't there when it quite obviously is. I guess I know what changes I need to make now

Joined: Aug 2013
Posts: 81
I
Babel fish
Offline
Babel fish
I
Joined: Aug 2013
Posts: 81
Haha, well in a perfect world maybe. =P

I think the way it behaves like it does, however, is because, as I had mentioned earlier, everything associated with the if statement is ignored/never processed if the condition is false... An easy way to imagine this might be to pretend that that entire block of code is erased from the script if the else is reached. (Obviously this probably isn't happening, but I think it's a simple way to understand the idea)

(Try, also, to think of this from the script processor's point of view rather than your own. Yes, in text, the goto label inside the if is clearly present to us, but to the script, once it evaluates that condtion to false, nothing associated with it exists.)

As for placing the goto label before the if statement... If you think about it, this serves two functions: First - the label is never ignored, (since it's not associated with any false conditions), and second - the if statement is given another chance to evaluate to true. (Which of course is why I suggested an or condition that depends on the else having been reached first)

Joined: Aug 2013
Posts: 81
I
Babel fish
Offline
Babel fish
I
Joined: Aug 2013
Posts: 81
...Rechecking the if and having it evaluate to true, in turn, prevents the else from triggering again and causing an infinite loop... I forgot to mention this eariler.


Link Copied to Clipboard