mIRC Home    About    Download    Register    News    Help

Print Thread
#118710 28/04/05 01:29 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
1.

if ($timer(..)) do stuff

But I'd like to see the istimer operator.

if (test istimer) do stuff

2.

I know this can easily be scripted, but I'd like to see a istimerwm for wildcard match.

Instead of something like..

Code:
alias timers {
  var %x = $timer(0), %timers
  while (%x) {
    if (* $+ $1 $+ * iswm $timer(%x)) var %timers = $addtok(%timers,$v2,44)
    dec %x
  }
  echo -a %timers
}


if (*tes* istimerwm) { do stuff }
-Andy

#118711 28/04/05 01:31 AM
Joined: Feb 2005
Posts: 194
A
Vogon poet
Offline
Vogon poet
A
Joined: Feb 2005
Posts: 194
Signed smile


"God sometimes puts us in the dark for us to see the light"
#118712 28/04/05 01:55 AM
Joined: Dec 2002
Posts: 208
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Dec 2002
Posts: 208
If this is to be added, I can think of some others that should go along with it, like ishash, isfile, isquery or any number of other $identifiers that can be used to determine the existance of anything, along with wm versions of each. Just to complete the symmetry, there should also be $alnum, $alpha, $num, $letter, etc so that we can use them in place of isalnum, isalpha, isnum, isletter, etc. I think this would be very useful.


If I knew now what I will know then... maybe things will have been different...
#118713 28/04/05 03:34 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Out of curiosity, what is the difference for the istimer and $timer?

if ($timer(test)) { }

and

if (test istimer) { }

How would the second be useful? Am I missing something with it?

As far as the wildcard version, that could be nice.

Also, the question goes with the comment about isfile... what's wrong with using $isfile? The other ones are nice, tho.


Invision Support
#Invision on irc.irchighway.net
#118714 28/04/05 04:05 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Well, there is no difference really, I'd rather check to see if the timer is true through it's own operator rather than identifier. That's all, so I wouldn't bee too bothered if this wasn't added as we can already do that. But the wm one is a little more complex for 'newbies'. And would probably rather use one IF statement to check for wildcard matches.

if (*tes* istimerwm) { stuff to do }

-Andy

#118715 28/04/05 04:22 AM
Joined: Dec 2002
Posts: 208
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Dec 2002
Posts: 208
I was actually being rather sarcastic, and thought that the extravagance of what I was suggesting might make that clear. I was wrong. Every single thing I suggested is already available in some other way. I don't see much point in asking Khaled to work to add abilities that are already there. I think that expanding $timer to include wildcard matches would be a nice feature (I believe that there is a feature suggestion thread about that somewhere around here), but cannot see adding an operator (istimer) to do what can already be done, just differently.

Do not think that I was trying to be insulting; I just thought that a bit of hyperbole might make it clear that it is a waste of Khaled's time to include the suggested feature when there are many, many genuinely new features that can be added in its place.

edit: oh, by the way, this is what I am currently using for a $wtimer(wildcard,N) in case anyone finds it useful:

Code:
 wtimer {
  var %loop = 0, %temp
  while (%loop < $timer(0)) {
    inc %loop
    if ($1 iswm $timer(%loop)) %temp = $addtok(%temp,$v2,32)
  }
  if ($2 == 0) return $numtok(%temp,32)
  elseif ($2 isnum 1-) return $gettok(%temp,$2,32)
  else {
    echo -atc info wtimer:  invalid parameters
    halt
  }
} 


not sure why it wants to insert all the extra blank lines.

Last edited by Hrung; 28/04/05 04:37 AM.

If I knew now what I will know then... maybe things will have been different...
#118716 28/04/05 07:59 AM
Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
I like this idea, I also would like to see isquery
But really what I would like to see is custom operators.
Basically it would just check $result
Code:
alias istimer {
  if ($timer($1-)) return $true
  return $false
}
alias isquery {
  if ($query($1-)) return $true
  return $false
}


Using the above aliases do the following...

//istimer TEST | echo -a $iif($result,YES,NO)
could be same as
if (TEST istimer) echo -a YES
or
if (TEST !istimer) echo -a NO

//isquery $me | echo -a $iif($result,YES,NO)
could be same as
if ($me isquery) echo -a YES
or
id ($me !isquery) echo -a NO

I would like to be able to use those aliases as operators

It could also work for istimerwm & isquerywm
Code:
alias istimerwm {
  var %i = 1
  while ($timer(%i) != $null) {
    var %t = $v1
    if ($1- iswm %t) return $true
    inc %i
  }
  return $false
}
alias isquerywm {
  var %i = 1
  while ($query(%i) != $null) {
    var %t = $v1
    if ($1- iswm %t) return $true
    inc %i
  }
  return $false
}


//istimerwm *LA* | echo -a $iif($result,YES,NO)
could be same as
if (*LA* istimerwm) echo -a YES
or
if (*LA* !istimerwm) echo -a NO

//isquerywm *LA* | echo -a $iif($result,YES,NO)
could be same as
if (*LA* isquerywm) echo -a YES
or
if (*LA* !isquerywm) echo -a NO

This could be for any operator you want..
ischat isnetwork isfserv isserver iscomchan whatever you want.

Last edited by mIRCManiac; 28/04/05 08:37 AM.
#118717 28/04/05 08:20 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Well I'm all for the custom operators. And the isquery too. After all, we have ischan, right? smile

#118718 28/04/05 10:47 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Using your alias's you can always just do

//echo -a $iif($istimer(TEST),YES,NO)
if ($istimer(TEST)) echo -a YES
if (!$istimer(TEST)) echo -a NO

//echo -a $iif($isquery($me),YES,NO)
if ($isquery($me)) echo -a YES
if (!$isquery($me)) echo -a NO

//echo -a $iif($istimerwm(*LA*),YES,NO)
if ($istimerwm(*LA*)) echo -a YES
if (!$istimerwm(*LA*)) echo -a NO

//echo -a $iif($isquerywm(*LA*),YES,NO)
if ($isquerywm(*LA*)) echo -a YES
if (!$isquerywm(*LA*)) echo -a NO

ischat isnetwork isfserv isserver iscomchan whatever you want, can be made and used the same way

To throw my 2c in I dont really see that there is much difference in if it was (TEST istimerwm) or ($istimerwm(TEST)) the only diffenece being that an internal command would have some speed advantage over the other, but this would only become apparent in hugely thrashed commands, i just cant see any of the mentioned ones being so overly used that it would require an internal operator to increase performance.
So to sume up my opion is, if the code you need to do the check is resonably small, just create an alias identifer, in fact build a libarary of them if u like to save time, and just have the script file loaded containing them, or add them to the script your writting if its designed to be handed out etc.

#118719 28/04/05 04:26 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Agreed.
isquery wouldn't be a bad idea though. If you're just browsing the help file and notice "ischan" you would likely assume that there is also an "isquery" operator.


New username: hixxy
#118720 28/04/05 04:45 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
I'd rather see ischan deprecated than the other way around.

Regarding the wildmask matching of timers, it'd make much more sense to add an extra, N, parameter to $timer() and have it it treat wildcard characters appropriately if the second parameter is present (the same way as I described for $isalias()).


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#118721 30/04/05 10:50 PM
Joined: Jul 2003
Posts: 77
B
Babel fish
Offline
Babel fish
B
Joined: Jul 2003
Posts: 77
well this could all be avoided if custom comparisons could be made though techically they can aka

alias someCheck if (something == $1) return $true | return false
if ($someCheck(something)) { do stuff }

id like to see however something like
operator isLengthSame if ($len($v1) == $len($v2)) return $true | return $false
if (String isLengthSame 123456) { do stuff }


hmmm signed by me
#118722 30/04/05 11:09 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Custom operators would cause major problems in mIRC scripting since operators have no syntactic way to show that they're operators (ie. they don't come at the start of a sentence like commands and they don't start with $ or % like identifiers and variables respectively). What happens to if (the cow said moo [color:blue]isin the cow said moooooooo) { ... }[/color] if someone creates an operator called the, cow, said, moo, or moooooooo?


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#118723 01/05/05 02:20 PM
Joined: Jul 2003
Posts: 77
B
Babel fish
Offline
Babel fish
B
Joined: Jul 2003
Posts: 77
ok make it like $v1 $istimer$ $v2 or something :-p


hmmm signed by me

Link Copied to Clipboard