|
Joined: May 2006
Posts: 122
Vogon poet
|
OP
Vogon poet
Joined: May 2006
Posts: 122 |
How about a -l switch added to the timer switch where the timer can only because altrered by the current script? That would stop timers that are important to a certain scripts functionalty from be accidently terminated. Would also prevent common timer names conflicting with other scripts using the same timer name.
|
|
|
|
DaveC
|
DaveC
|
would also make terminating rouge timers damn hard!
|
|
|
|
Joined: May 2006
Posts: 122
Vogon poet
|
OP
Vogon poet
Joined: May 2006
Posts: 122 |
True what about if it was still accessable via the command line but the name was local
|
|
|
|
DaveC
|
DaveC
|
actually having them local accessable and locally named wouldnt be a problem, as long as there was an override flag that allowed access to them from any script or the command line, maybe your idea a -l for setting them and a -L to override and effect them from elsewhere.
There might of course be problems with that in that there are now duplicate names possable. The solve for that isnt clear to me at the moment.
I however have never found it a problem to create unque names for my times, i start with my 3 initials DJC follow up with a dot then the name of the script or its acroname if its a long name (the.script.name = TSN) followed by a dot followed by the timername so i get DJC.TSN.FlasherControl as an example! The chance someone else is using that is gonna be as close to nil as you can get.
|
|
|
|
Joined: Apr 2004
Posts: 755
Hoopy frood
|
Hoopy frood
Joined: Apr 2004
Posts: 755 |
From now on i will do the exact same. Use your initials followed by a dot followed by the scripts name folowed by the timers name :tongue:
|
|
|
|
Joined: Feb 2004
Posts: 201
Fjord artisan
|
Fjord artisan
Joined: Feb 2004
Posts: 201 |
I however have never found it a problem to create unque names for my times, i start with my 3 initials DJC follow up with a dot then the name of the script or its acroname if its a long name (the.script.name = TSN) followed by a dot followed by the timername so i get DJC.TSN.FlasherControl as an example! The chance someone else is using that is gonna be as close to nil as you can get. I am just hoping no-one out there have your initials and name their files the same.. $ticks anyone? :P
|
|
|
|
DaveC
|
DaveC
|
Yeah someone is going to have My initals, use the same name script, and call there timer specific names the same thing..... right....
PS: $ticks is useless alone as you might set of several of them with in the same tick count, and then you also cant terminate the timer unless you store the name of it somewhere, so now you have to make unque vars etc
|
|
|
|
Joined: Dec 2002
Posts: 2,884
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,884 |
If DaveC's method doesn't do it for you, you could always use something like $md5($script) for a timer name. Obviously only one file can have any filepath, and the odds of two scripts with different filepaths having the same hash is 1 in 340,282,366,920,938,463,463,374,607,431,768,211,456. Or as I like to call it, "unlikely".
|
|
|
|
Joined: Oct 2005
Posts: 1,671
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,671 |
Another idea that comes to mind is an identifier that returns the name of the timer that was just set. That would allow you to use various methods to make a 'random' timer name and still be able to reference that timer later.
Example:
timer $+ $rand(0000,9999) 1 1 echo -a Timer $lasttimer set %timername $lasttimer
or
timer 1 1 echo -a Timer $lasttimer set %timername $lasttimer
I think it would be best if the $lasttimer identifier updated *as* the timer is being activated, so that the identifier can be used within the timer command (as shown above).
-genius_at_work
|
|
|
|
Joined: Dec 2002
Posts: 2,884
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,884 |
$ltimer already exists to provide this (although it's not set until after the /timer command).
|
|
|
|
Joined: Feb 2006
Posts: 523
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 523 |
to use the timer's name inside its command i'd recommend $ctimer. that'll allow you to use things like this safely:
.timer $+ $nick 1 5 echo -a $!ctimer
for cases where $nick could be anything, including { } or | that would otherwise disrupt the echo :P i believe a combination of $ctimer and $ltimer solves your issues 
"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
|
|
|
|
DaveC
|
DaveC
|
Watch it someone well ask you what might happen is you had 340,282,366,920,938,463,463,374,607,431,768,211,457 scripts loaded!!!!!!!!!!!!!!!
|
|
|
|
Joined: Feb 2004
Posts: 201
Fjord artisan
|
Fjord artisan
Joined: Feb 2004
Posts: 201 |
What if you have 340,282,366,920,938,463,463,374,607,431,768,211,458 scripts open?
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Quite frankly, if you had that many scripts loaded, I'd be surprised if you could do anything on mIRC, as the scripts would probably take most (if not all) of the processing time to run...I mean, did you try to figure out how that number would be written in word format? I did, and ran out of prefixes that I know long before I ran out of sections that would need to be prefixed.
|
|
|
|
Joined: Oct 2005
Posts: 1,671
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,671 |
340,282,366,920,938,463,463,374,607,431,768,211,458 alias ½ if ($1) return $3 $+ $gettok(OneTwoThreeFourFiveSixS7EightNineTenEl7TwelveThir+Four+Fif+Six+S7+Eigh+Nine+,$1,2) $2
alias numconv {
var %x,%o,%s,%i $remove($1-,$chr(44),$chr(32))
if (!$regex(%i,/^(?=\S*\d)(\d{0,66}|0*)(\.\d*)?($| )/)) return $iif(%i != %o,Invalid)
%i = 0 $+ $regml(1)
while %i {
%x = $½($mid(%i,-3,1),Hundred) $iif($mid(%i,-2) < 20,$½($int($ifmatch)),$+($½($calc($mid(%i,-2,1) -10)),ty,$½($mid(%i,-1),,-)))
%o = %x $iif(%x && %s,$gettok(ThousandM.B.Tr.Quadr.Quint.Sext.Sept.Oct.Non.!Un!Duo!Tre!Quattuor!Quin!Sex!Septen!Octo!Novem!Vigint.,%s,2)) %o
%i = $left(%i,-3)
inc %s
}
return $iif(%o,$replace(%o,7,even,+t,t,lvet,nt,urt,rt,!,dec.,.,illion,+,teen),Zero)
} echo -a $numconv(340,282,366,920,938,463,463,374,607,431,768,211,458) Three Hundred Forty Undecillion Two Hundred Eighty-Two decillion Three Hundred Sixty-Six Nonillion Nine Hundred Twenty Octillion Nine Hundred Thirty-Eight Septillion Four Hundred Sixty-Three Sextillion Four Hundred Sixty-Three Quintillion Three Hundred Seventy-Four Quadrillion Six Hundred Seven Trillion Four Hundred Thirty-One Billion Seven Hundred Sixty-Eight Million Two Hundred Eleven Thousand Four Hundred Fifty-Eight :P -genius_at_work
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Thanks. I'd managed to get it to (but not including) Three Hundred Forty Undecillion Two Hundred Eighty-Two decillion Three Hundred Sixty-Six Nonillion
|
|
|
|
|