mIRC Home    About    Download    Register    News    Help

Topic Options
#260984 - 12/07/17 03:07 PM $dqwindow properties
Protopia Offline
Fjord artisan

Registered: 30/08/03
Posts: 225
Loc: UK
$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
}


Edited by Protopia (12/07/17 08:42 PM)

Top
#260986 - 12/07/17 05:51 PM Re: $dqwindow properties [Re: Protopia]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
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)


Edited by Wims (12/07/17 05:52 PM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#260987 - 12/07/17 07:16 PM Re: $dqwindow properties [Re: Wims]
Protopia Offline
Fjord artisan

Registered: 30/08/03
Posts: 225
Loc: UK
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).

Top
#260988 - 12/07/17 07:28 PM Re: $dqwindow properties [Re: Protopia]
Sat Offline
Hoopy frood

Registered: 19/04/04
Posts: 838
Loc: The Netherlands
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

Top
#260989 - 12/07/17 07:31 PM Re: $dqwindow properties [Re: Protopia]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
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

Top
#260990 - 12/07/17 09:15 PM Re: $dqwindow properties [Re: Wims]
Protopia Offline
Fjord artisan

Registered: 30/08/03
Posts: 225
Loc: UK
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.

Top
#260991 - 13/07/17 01:03 AM Re: $dqwindow properties [Re: Protopia]
Sat Offline
Hoopy frood

Registered: 19/04/04
Posts: 838
Loc: The Netherlands
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

Top
#260993 - 13/07/17 02:29 AM Re: $dqwindow properties [Re: Protopia]
FroggieDaFrog Offline
Hoopy frood

Registered: 16/04/10
Posts: 910
Loc: USA
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)




Edited by FroggieDaFrog (13/07/17 02:30 AM)
_________________________
I am SReject
My Stuff

Top
#260995 - 13/07/17 09:23 AM Re: $dqwindow properties [Re: FroggieDaFrog]
Protopia Offline
Fjord artisan

Registered: 30/08/03
Posts: 225
Loc: UK
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).

Top