mIRC Home    About    Download    Register    News    Help

Print Thread
$dqwindow properties #260984 12/07/17 02:07 PM
Joined: Aug 2003
Posts: 236
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 236
$dqwindow should be extended to provide properties like most other mirc identifiers equivalent to the following alias identifier:
Code:
alias dqwindow {
 if ($isid == $false) return
 var %and
 if ($prop == enabled) %and = 1
 elseif ($prop == open) %and = 2
 elseif ($prop == opening) %and = 4
 elseif ($prop == writing) %and = 8
 elseif ($prop == written) %and = 16
 else return $!dqwindow
 if ($!dqwindow & %and) return $true
 else return $false
}

Last edited by Protopia; 12/07/17 07:42 PM.
Re: $dqwindow properties [Re: Protopia] #260986 12/07/17 04:51 PM
Joined: Jul 2006
Posts: 3,558
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,558
This was added very recently, you need to check the new features that are added as well as checking if a feature as been already asked before, before asking!

Originally Posted By: 7.48
29.Added $dqwindow identifier that returns the state of the single
message window. When used in on TEXT/ACTION events, it also returns
opening/writing/written states.

echo State: $iif($dqwindow & 1,enabled,not enabled)
echo State: $iif($dqwindow & 2,open,not open)
echo State: $iif($dqwindow & 4,opening,not opening)
echo State: $iif($dqwindow & 8,writing,not writing)
echo State: $iif($dqwindow & 16,written,not written)

Last edited by Wims; 12/07/17 04:52 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: $dqwindow properties [Re: Wims] #260987 12/07/17 06:16 PM
Joined: Aug 2003
Posts: 236
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 236
Originally Posted By: Wims
This was added very recently, you need to check the new features that are added as well as checking if a feature as been already asked before, before asking.

And you, my friend, need to read the suggestion before responding.

My suggestion is to build upon this identifier (which was added in 7.48) by providing properties for it (rather than using bitwise logical operations).

Re: $dqwindow properties [Re: Protopia] #260988 12/07/17 06:28 PM
Joined: Apr 2004
Posts: 840
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 840
Originally Posted By: Protopia
$dqwindow should be extended to provide properties like most other mirc identifiers [..]

Many built-in identifiers return bit masks. Why should this particular one be extended to offer a second way of getting the same information?


Saturn, QuakeNet staff
Re: $dqwindow properties [Re: Protopia] #260989 12/07/17 06:31 PM
Joined: Jul 2006
Posts: 3,558
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,558
I read your suggestion the first time, the only sentence is
Quote:
$dqwindow should be extended to provide properties like most other mirc identifiers equivalent to the following alias identifier:
which is not describing at all what others properties you want or what are these 'mirc identifier equivalent'. So then I checked your code and it's using && instead of & it seems. All in all it looks like you are asking for the built-in identifier $dqwindow to return a $true/$false value if either of the bitwise comparison is true, which can be done in a custom alias easily then


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: $dqwindow properties [Re: Wims] #260990 12/07/17 08:15 PM
Joined: Aug 2003
Posts: 236
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 236
Originally Posted By: Sat
Many built-in identifiers return bit masks. Why should this particular one be extended to offer a second way of getting the same information?


Most use properties - and properties make the code more readable.

I am not aware of other identifiers that use bit masks - my ignorance. Perhaps you can enlighten me.

Originally Posted By: Wims
I checked your code and it's using && instead of & it seems. All in all it looks like you are asking for the built-in identifier $dqwindow to return a $true/$false value if either of the bitwise comparison is true, which can be done in a custom alias easily then.


Yes, it was a typo and should have been & not &&. And yes it can clearly be done in a custom alias, because that was the example.

However, lots of things can be done using custom aliases - you can implement $left, $right and $mid as a custom alias using $asc and $chr and loops, but no one would suggest that would be a good way of doing it. Simpler examples would be $cr, $crlf, $lf; mirc.ini could be examined for $dccignore etc.

My point is that this would have been more consistent if implemented using properties in the first place, and retro-fitting it to be compatible both with the current implementation and consistent with the language by having properties would be a nice way of fixing this.

But I certainly accept that this is perhaps lower priority than other functionality and nice to have rather than essential.

Re: $dqwindow properties [Re: Protopia] #260991 13/07/17 12:03 AM
Joined: Apr 2004
Posts: 840
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 840
Originally Posted By: Protopia
I am not aware of other identifiers that use bit masks - my ignorance. Perhaps you can enlighten me.

At the very least, $mouse.key and $remote - and there's also for example /scon -t. Honestly, perhaps there are not as many cases as I thought, but there is definitely a precedent.

I agree that names make code more readable, but bit masks are simpler to implement and ultimately just as functional..


Saturn, QuakeNet staff
Re: $dqwindow properties [Re: Protopia] #260993 13/07/17 01:29 AM
Joined: Apr 2010
Posts: 921
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 921
Why include what can be done via scripting(as you just proved) in just 5 lines:

Code:
alias dqwindow.enabled if ($isid) return $iif($dqwindow & 1, $true, $false)
alias dqwindow.open if ($isid) return $iif($dqwindow & 2, $true, $false)
alias dqwindow.opening if ($isid) return $iif($dqwindow & 4, $true, $false)
alias dqwindow.writing if ($isid) return $iif($dqwindow & 8, $true, $false)
alias dqwindow.written if ($isid) return $iif($dqwindow & 16, $true, $false)



Last edited by FroggieDaFrog; 13/07/17 01:30 AM.

I am SReject
My Stuff
Re: $dqwindow properties [Re: FroggieDaFrog] #260995 13/07/17 08:23 AM
Joined: Aug 2003
Posts: 236
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 236
Originally Posted By: FroggieDaFrog
Code:
alias dqwindow.enabled if ($isid) return $iif($dqwindow & 1, $true, $false)
alias dqwindow.open if ($isid) return $iif($dqwindow & 2, $true, $false)
alias dqwindow.opening if ($isid) return $iif($dqwindow & 4, $true, $false)
alias dqwindow.writing if ($isid) return $iif($dqwindow & 8, $true, $false)
alias dqwindow.written if ($isid) return $iif($dqwindow & 16, $true, $false)


Better code than mine - but see above for reasons why it should be provided by mIRC rather than by script (i.e. consistency, readability and so that scripters do not need to reinvent the wheel or go hunting for code snippets).