mIRC Home    About    Download    Register    News    Help

Print Thread
G
GoDz
GoDz
G
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?)

S
state
state
S
could use

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

but this will create a never ending loop

Last edited by state; 12/01/05 11:42 PM.
Joined: Dec 2003
Posts: 259
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 259
Hi. From mIRC help file:
/timer[N/name] [-ceomhipr] [time] <repetitions> <interval> <command>
So, you don't have second argument <interval>.

G
GoDz
GoDz
G
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

Last edited by GoDz; 12/01/05 11:50 PM.
Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
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.

G
GoDz
GoDz
G
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

Last edited by GoDz; 12/01/05 11:54 PM.
R
ricky_knuckles
ricky_knuckles
R
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

Last edited by ricky_knuckles; 13/01/05 12:00 AM.
G
GoDz
GoDz
G
jea.. thanks, ill look in to it.. (damnit.. would be so easy if it just worked)

Joined: Dec 2003
Posts: 259
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 259
Try this:
Code:
alias blabla /ting
alias ting { 
  echo -a hhh 
  timerting 1 5 /blabla
}

Last edited by milosh; 13/01/05 01:22 AM.
D
DaveC
DaveC
D
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)

G
GoDz
GoDz
G
thanks for the effort guys.. i solved it in a similar way.. still way more complicaded than if it had worked crazy

D
DaveC
DaveC
D
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. :<


Link Copied to Clipboard