mIRC Homepage
Posted By: Protopia $dqwindow properties - 12/07/17 02:07 PM
$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
}
Posted By: Wims Re: $dqwindow properties - 12/07/17 04:51 PM
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)
Posted By: Protopia Re: $dqwindow properties - 12/07/17 06:16 PM
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).
Posted By: Sat Re: $dqwindow properties - 12/07/17 06:28 PM
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?
Posted By: Wims Re: $dqwindow properties - 12/07/17 06:31 PM
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
Posted By: Protopia Re: $dqwindow properties - 12/07/17 08:15 PM
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.
Posted By: Sat Re: $dqwindow properties - 13/07/17 12:03 AM
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..
Posted By: FroggieDaFrog Re: $dqwindow properties - 13/07/17 01:29 AM
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)


Posted By: Protopia Re: $dqwindow properties - 13/07/17 08:23 AM
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).
© mIRC Discussion Forums