mIRC Homepage
Posted By: davethejackal Timers and event identifiers - 12/03/14 12:07 PM
Add a switch to timers so that when started from within an event, the command triggered by the timer executes as if it had been triggered inside the event (so has access to $nick etc).

If this is already available please do tell eek
Posted By: Wims Re: Timers and event identifiers - 12/03/14 06:29 PM
Such a switch is not required, /timer always has access to $nick or any other local identifier currently.
Code:
on *:text:!test:#test:.timer 1 1 echo -a $nick just said !test
This will always work.
Posted By: Loki12583 Re: Timers and event identifiers - 12/03/14 08:00 PM
As per his other topic, he is calling an alias which makes use of $nick, and he doesn't want to pass $nick to the alias.
Posted By: Wims Re: Timers and event identifiers - 12/03/14 09:45 PM
Right, well then, that's not possible.

@davethejackal: Keep in mind more than one event could trigger before the alias is called:
Code:
;let's suppose -X is the new switch you are talking about
on *:text:!test:#test:.timer -X 1 1 dosomething
alias dosomething echo -a $nick
What if A and B type !test at the same time? Both events will trigger and create a timer before one of those timer actually triggers, so how would mIRC know which value $nick should return?
Posted By: davethejackal Re: Timers and event identifiers - 15/03/14 01:06 AM
In the instance triggered by A $nick would be A.
In the instance triggered by B $nick would be B.

The timer event acts as if it was triggered by the person who triggered the event, like wot I done said.

Hence, if the B version triggers before the A, the B version of the timer would be 'destroyed' and replaced with the A version, and vice version.

It's up to the developer to stop this happening if that's not what they want.

Pretty much exactly what would happen if you passed the $nick as a parameter.
Posted By: Sat Re: Timers and event identifiers - 15/03/14 01:40 AM
Originally Posted By: davethejackal
Pretty much exactly what would happen if you passed the $nick as a parameter.

It would probably help if you explained why this is not sufficient for you. It is pretty simple to rewrite an alias to use $1 instead of $nick, for example.
Posted By: Wims Re: Timers and event identifiers - 15/03/14 02:53 AM
But passing $nick as a parameter is the way to go, what you are looking for is just aesthetic.
You can't really ask such a feature here, you would be asking for a switch everytime it can simplify your code a bit for a specific situation.
Here it's about $nick but what if someone request the exact same thing for all the others local identifiers: $fulladdress $chan etc, would we add a new switch for these? We would pass those value as parameters...
Posted By: davethejackal Re: Timers and event identifiers - 15/03/14 11:29 AM
Yes, that was the general idea. The entire 'environment' of a call would be transferred, not just $nick.

If would mean code was instantly scalable from single instance execute-now to multiple threaded, timer-schedulable.
Posted By: Wims Re: Timers and event identifiers - 15/03/14 03:06 PM
There are no threads in mIRC, just delayed operations on the same thread.
You are really only asking about getting that /timer's switch to keep the exact same code of an alias, that has been made not be called by a timer, just because you are now using a timer.
There are many problems with this suggestion anyway, how do you access the copied environement? Using $nick, no problem, but if you use $1- for example, which is as local as $nick, will $1- be the current parameters passed to the alias or the old $1- definition?
Why do you refuse to pass the information as a parameter to the alias?
© mIRC Discussion Forums