mIRC Home    About    Download    Register    News    Help

Print Thread
timer dont want to execute goto loop #107736 12/01/05 11:32 PM
Joined: Jan 2005
Posts: 6
G
GoDz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2005
Posts: 6
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?)

Re: timer dont want to execute goto loop #107737 12/01/05 11:38 PM
Joined: Jun 2004
Posts: 133
S
state Offline
Vogon poet
Offline
Vogon poet
S
Joined: Jun 2004
Posts: 133
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.
Re: timer dont want to execute goto loop #107738 12/01/05 11:39 PM
Joined: Dec 2003
Posts: 261
M
milosh Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Hi. From mIRC help file:
/timer[N/name] [-ceomhipr] [time] <repetitions> <interval> <command>
So, you don't have second argument <interval>.


velicha dusha moja Gospoda
Re: timer dont want to execute goto loop #107739 12/01/05 11:44 PM
Joined: Jan 2005
Posts: 6
G
GoDz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2005
Posts: 6
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.
Re: timer dont want to execute goto loop #107740 12/01/05 11:50 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: timer dont want to execute goto loop #107741 12/01/05 11:53 PM
Joined: Jan 2005
Posts: 6
G
GoDz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2005
Posts: 6
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.
Re: timer dont want to execute goto loop #107742 12/01/05 11:59 PM
Joined: Nov 2004
Posts: 332
R
ricky_knuckles Offline
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
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.

The Kodokan will move you, one way or another.
Re: timer dont want to execute goto loop #107743 13/01/05 12:06 AM
Joined: Jan 2005
Posts: 6
G
GoDz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2005
Posts: 6
jea.. thanks, ill look in to it.. (damnit.. would be so easy if it just worked)

Re: timer dont want to execute goto loop #107744 13/01/05 01:21 AM
Joined: Dec 2003
Posts: 261
M
milosh Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
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.

velicha dusha moja Gospoda
Re: timer dont want to execute goto loop #107745 13/01/05 01:06 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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)

Re: timer dont want to execute goto loop #107746 13/01/05 07:29 PM
Joined: Jan 2005
Posts: 6
G
GoDz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2005
Posts: 6
thanks for the effort guys.. i solved it in a similar way.. still way more complicaded than if it had worked crazy

Re: timer dont want to execute goto loop #107747 13/01/05 10:14 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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. :<