mIRC Homepage
Posted By: Cheer "Not found" ?? Its quite obviously there - 04/09/13 03:13 AM
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????
Posted By: sparta Re: "Not found" ?? Its quite obviously there - 04/09/13 04:10 AM
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.
Posted By: Cheer Re: "Not found" ?? Its quite obviously there - 04/09/13 04:44 AM
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
Posted By: KindOne Re: "Not found" ?? Its quite obviously there - 04/09/13 07:39 AM
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.
Posted By: Cheer Re: "Not found" ?? Its quite obviously there - 04/09/13 09:53 AM
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
Posted By: Iire Re: "Not found" ?? Its quite obviously there - 04/09/13 10:25 AM
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.

Posted By: Cheer Re: "Not found" ?? Its quite obviously there - 04/09/13 10:40 AM
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
Posted By: Iire Re: "Not found" ?? Its quite obviously there - 04/09/13 11:15 AM
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)
Posted By: Iire Re: "Not found" ?? Its quite obviously there - 04/09/13 10:12 PM
...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.
© mIRC Discussion Forums