mIRC Homepage
Posted By: GoDz timer dont want to execute goto loop - 12/01/05 11:32 PM
anyone having this problem?

if i run this alias:
/ting {
:ting
echo hhh
goto ting
}

it works fine.. but if i run this:

/ting {
:ting
echo hhh
timer 15 goto ting
}

it says * /goto: 'ting' not found

why is this? and how can i fix it (or workaround it?)
Posted By: state Re: timer dont want to execute goto loop - 12/01/05 11:38 PM
could use

alias ting {
echo -a hhh
timerting 1 1 /ting
}

but this will create a never ending loop
Posted By: milosh Re: timer dont want to execute goto loop - 12/01/05 11:39 PM
Hi. From mIRC help file:
/timer[N/name] [-ceomhipr] [time] <repetitions> <interval> <command>
So, you don't have second argument <interval>.
Posted By: GoDz Re: timer dont want to execute goto loop - 12/01/05 11:44 PM
the first fix wont work since this is only an example... still thanks for the effort


the second reply: it is suppose to be 1 5 not 15
Goto's work on a local scope, ie. they'll only jump to a point defined within the same event/alias. The command parameter of a call to /timer is executed in a different scope to the calling alias, if it weren't then the alias wouldn't be able to return or end until the timer had expired (after 15 seconds in your case).

I can't really give a fix for the problem since if your code worked as you expected it would create an infinite loop, which of course is not what you want.

P.S. Both the interval and repetitions parameters are necessary for the timer command to work.
Posted By: GoDz Re: timer dont want to execute goto loop - 12/01/05 11:53 PM
in this example an infinite loop is just what i want.. the use in my script is different.. but with the exact same form

P.S. jea.. know.. little typo.. wrote 15 instead of 1 5
i tested it in a number of different ways and could not make it work
for a particualrly fun result put the timer on the command line rather than the goto and watch the ugliness unfurl
you might try a while:
or possibly a variable loop
Posted By: GoDz Re: timer dont want to execute goto loop - 13/01/05 12:06 AM
jea.. thanks, ill look in to it.. (damnit.. would be so easy if it just worked)
Posted By: milosh Re: timer dont want to execute goto loop - 13/01/05 01:21 AM
Try this:
Code:
alias blabla /ting
alias ting { 
  echo -a hhh 
  timerting 1 5 /blabla
}
Posted By: DaveC Re: timer dont want to execute goto loop - 13/01/05 01:06 PM
Code:
/ting {
  if ($1 == Goto) { var %goto.place = $2 | tokenize 32 $3- | goto %goto.place }
  ...
  :tong
  echo hhh
  timer 1 15 ting goto tong $1-
} 


I havent actualy tried that, but the idea is that u call the same alias again in 15 seconds, but this time pass the word GOTO and ther place in the alias to goto, then the rest of the parameters originally passed, when the alias starts it checks for GOTO, temp saves the place to go, removes the $1 & $2, and goes to that saved place.

I made it a once off timer, so its like a program that stopped for 15 seconds, then continued on at the GOTO PLACE, you could make it a "/timer 0 15 ting goto someplace" for it to do some routine every 15 seconds.
In fact, you could start your own kinda pretend multi threaded script, where you set off multiple timer delayed parts of the script running
(i cant actually fathom a script ever needing to work like this, but can amagine its workings)
Posted By: GoDz Re: timer dont want to execute goto loop - 13/01/05 07:29 PM
thanks for the effort guys.. i solved it in a similar way.. still way more complicaded than if it had worked crazy
Posted By: DaveC Re: timer dont want to execute goto loop - 13/01/05 10:14 PM
Np, I thought mine would have suited ya, its only one extra line at the start and the alias name & $1- in the timer, although I did fail to mention that any tempory variables would be lost, which would have been a important point to have remebered to tell you. :<
© mIRC Discussion Forums