|
Joined: Apr 2008
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Apr 2008
Posts: 51 |
Msn has "Nudge". Yahoo has "Buzz". Upon sclick of one of their buttons, the screen gives the illusion of vibrating. I would like to incorporate this into one of my dialogs but i do not know how to go about doing this. I could move the dialog, back and forth. But, different system speeds make it appear inconsistent. the use of timers is probably the way to go. That is where i get stuck. Not sure how to set it up properly(if at all). Any help would be greatly appreciated. Below is our starting dialog
alias test { dialog $iif($dialog(test),-v,-md) test test }
menu menubar,channel {
.test:{ test }
}
dialog test {
title "Buzz"
size -1 -1 110 100
option dbu
button "BUZZ", 2, 30 50 50 24,
}
on *:dialog:test:*:*: {
if ( $devent == sclick ) {
if ($did == 2) { splay -p $mircdir $+ \sounds\buzz.mp3 }
; my timers are not set nor is the size :(
.timer 1 1 dialog -s test -1 -1 115 115
.timer 1 1 dialog -s name -1 -1 110 110
}
It should be a bit of fun if i can get this working. If you can do it, maybe explain where my thinking pattern is off.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
Here is code I made to 'nudge' channel/PM windows:
on *:TEXT:$($me):*:nudge $target
;/nudge1 'shakes' the target window when target is minimized, maximized or normal
alias nudge1 {
var %nsound = sounds/nudge.wav
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=state, 8=astate, 9-=active
if ($2 == $null) {
var %x = $iif($window($1).x < 0,0,$v1)
var %y = $iif($window($1).y < 0,0,$v1)
var %s = $window($1).state
if (max isin %s) %s = -x
elseif (nor isin %s) %s = -r
else %s = -
var %a = $window($active).state
if (max isin %a) %a = -ax
elseif (min isin %a) %a = -an
elseif (nor isin %a) %a = -ar
else %a = -
.timer -m 1 1 nudge $1 0 %x %y $ticks 750 %s %a $active
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if ((!$window($1)) || ($7 == $null)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
window $1 %x %y
if (($9- != $1) && ($9- != $null)) window $8 $qt($9-)
if ($7) window $7 $1
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.nudge.,$1) -m 1 30 nudge $1 $calc(($2 + 1) % 6) $3-
window -ar $1
window $1 %x %y
}
;/nudge2 'shakes' the target window when target is minimized or normal only
alias nudge2 {
var %nsound = sounds/nudge.wav
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=state, 8=astate, 9-=active
if ($2 == $null) {
var %x = $iif($window($1).x < 0,0,$v1)
var %y = $iif($window($1).y < 0,0,$v1)
var %a = $window($active).state
if (max isin %a) return
elseif (min isin %a) %a = -an
elseif (nor isin %a) %a = -ar
else %a = -
var %s = $window($1).state
if (max isin %s) return
if (nor isin %s) %s = -r
else %s = -
.timer -m 1 1 nudge $1 0 %x %y $ticks 750 %s %a $active
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if ((!$window($1)) || ($7 == $null)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
window $1 %x %y
if (($9- != $1) && ($9- != $null)) window $8 $qt($9-)
if ($7) window $7 $1
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.nudge.,$1) -m 1 30 nudge $1 $calc(($2 + 1) % 6) $3-
window -ar $1
window $1 %x %y
}
To test it on a window manually, type /nudge1 #channel or /nudge2 #channel . You should be able to modify it to make it work on dialogs. -genius_at_work
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
alias nudgetest {
if (!$dialog(nudge)) dialog -mv nudge nudge
dialog -a nudge
}
dialog nudge {
title "Nudge"
size -1 -1 100 100
option dbu
button "Nudge",10,35 35 30 30
}
on *:DIALOG:nudge:sclick:10:dnudge $dname
;;; /dnudge <dialogname>
alias dnudge {
var %nsound = sounds/nudge.wav
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=w, 8=h
if ($1 == $null) return
if ($2 == $null) {
var %x = $iif($dialog($1).x < 0,0,$v1)
var %y = $iif($dialog($1).y < 0,0,$v1)
var %w = $dialog($1).cw, %h = $dialog($dname).ch
.timer -m 1 1 dnudge $1 0 %x %y $ticks 750 %w %h
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if (!$dialog($1)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
dialog -s $1 %x %y $7 $8
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.nudge.,$1) -m 1 30 dnudge $1 $calc(($2 + 1) % 6) $3-
dialog -s $1 %x %y $7 $8
}
/nudgetest -genius_at_work
|
|
|
|
Joined: Apr 2008
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Apr 2008
Posts: 51 |
this is fantastic!!! i tried to set it up using an onTEXT event.
on *:TEXT:*Buzz*:%uno.channel:{
; if ($did(AutoList,80).state == 1) splay -p $mircdir $+ \UNOsndz\buzz.mp3
did -v AutoList 501
.timer 1 2 did -h AutoList 501
}
80 is a checkbox to enable it. i seem to have some trouble triggering it. All i need is this right?
alias dnudge {
var %nsound = sounds/Buzz.mp3
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=w, 8=h
if ($1 == $null) return
if ($2 == $null) {
var %x = $iif($dialog($1).x < 0,0,$v1)
var %y = $iif($dialog($1).y < 0,0,$v1)
var %w = $dialog($1).cw, %h = $dialog($dname).ch
.timer -m 1 1 dnudge $1 0 %x %y $ticks 750 %w %h
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if (!$dialog($1)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
dialog -s $1 %x %y $7 $8
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.AutoList.,$1) -m 1 30 dnudge $1 $calc(($2 + 1) % 6) $3-
dialog -s $1 %x %y $7 $8
}
|
|
|
|
Joined: Apr 2008
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Apr 2008
Posts: 51 |
on sclick on me dialog i have this:
elseif ($did == 94) { msg %uno.channel Buzz
; splay -p $mircdir $+ \UNOsndz\buzz.mp3
;;; /dnudge <dialogname>
alias dnudge {
var %nsound = sounds/buzz.mp3
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=w, 8=h
if ($1 == $null) return
if ($2 == $null) {
var %x = $iif($dialog($1).x < 0,0,$v1)
var %y = $iif($dialog($1).y < 0,0,$v1)
var %w = $dialog($1).cw, %h = $dialog($dname).ch
.timer -m 1 1 dnudge $1 0 %x %y $ticks 750 %w %h
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if (!$dialog($1)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
dialog -s $1 %x %y $7 $8
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.nudge.,$1) -m 1 30 dnudge $1 $calc(($2 + 1) % 6) $3-
dialog -s $1 %x %y $7 $8
}
}
Is this right? It won't work for me.
|
|
|
|
Joined: Apr 2008
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Apr 2008
Posts: 51 |
i tried this...
on *:TEXT:*Buzz*:%uno.channel:{
if ($did(AutoList,80).state == 1) splay -p UNOsndz/buzz.mp3
did -v AutoList 501
.timer 1 2 did -h AutoList 501
dnudge AutoList
;;; /dnudge <dialogname>
alias dnudge {
var %nsound = sounds/buzz1.mp3
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=w, 8=h
if ($1 == $null) return
if ($2 == $null) {
var %x = $iif($dialog($1).x < 0,0,$v1)
var %y = $iif($dialog($1).y < 0,0,$v1)
var %w = $dialog($1).cw, %h = $dialog($dname).ch
.timer -m 1 1 dnudge $1 0 %x %y $ticks 750 %w %h
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if (!$dialog($1)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
dialog -s $1 %x %y $7 $8
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.AutoList.,$1) -m 1 30 dnudge $1 $calc(($2 + 1) % 6) $3-
dialog -s $1 %x %y $7 $8
}
}
i do not know what i am doing wrong...hmmm
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
You have your alias in the ON TEXT event. They have to be separate in order to work. In this case, it's a simple matter of a mis-placed bracket. on *:TEXT:*Buzz*:%uno.channel:{
if ($did(AutoList,80).state == 1) splay -p UNOsndz/buzz.mp3
did -v AutoList 501
.timer 1 2 did -h AutoList 501
dnudge AutoList
}
;;; /dnudge <dialogname>
alias dnudge {
var %nsound = sounds/buzz1.mp3
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=w, 8=h
if ($1 == $null) return
if ($2 == $null) {
var %x = $iif($dialog($1).x < 0,0,$v1)
var %y = $iif($dialog($1).y < 0,0,$v1)
var %w = $dialog($1).cw, %h = $dialog($dname).ch
.timer -m 1 1 dnudge $1 0 %x %y $ticks 750 %w %h
if ($exists(%nsound)) splay $qt(%nsound)
return
}
if (!$dialog($1)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
dialog -s $1 %x %y $7 $8
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.AutoList.,$1) -m 1 30 dnudge $1 $calc(($2 + 1) % 6) $3-
dialog -s $1 %x %y $7 $8
}
|
|
|
|
Joined: Apr 2008
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Apr 2008
Posts: 51 |
Thanx again for the help RusselB. Thank you for your patience in giving me a couple hints towards telling me to look closer at what i am doing. it really helps! not only did i have a bracket misplaced, but i also used $dname when i needed to use the full dialog name. Here is what got it working.
on *:TEXT:*Buzz*:%uno.channel:{
if ($did(AutoList,80).state == 1) splay -p UNOsndz/buzz.mp3
did -v AutoList 501
.timer 1 2 did -h AutoList 501
dnudge AutoList
}
; Then towards the top where my other alias' were i put:
alias dnudge {
; var %nsound = sounds/buzz.mp3
;-----------------------------------------------------
;1=target, 2=count, 3=x, 4=y, 5=ticks, 6=msec, 7=w, 8=h
if ($1 == $null) return
if ($2 == $null) {
var %x = $iif($dialog($1).x < 0,0,$v1)
var %y = $iif($dialog($1).y < 0,0,$v1)
var %w = $dialog($1).cw, %h = $dialog(AutoList).ch
.timer -m 1 1 dnudge $1 0 %x %y $ticks 750 %w %h
; if ($exists(%nsound)) splay $qt(%nsound)
return
}
if (!$dialog($1)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
dialog -s $1 %x %y $7 $8
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.AutoList.,$1) -m 1 30 dnudge $1 $calc(($2 + 1) % 6) $3-
dialog -s $1 %x %y $7 $8
}
i have one issue with it though..when the nudge goes off. i lose a little bit of the dialog(becomes smaller). not sure why... $8 the height is what is the trouble...hard to figure out. with the test dialog, it works fine. hmmm My dialog is: size -1 -1 294 183 option dbu
Last edited by kkoser; 11/05/08 04:43 AM.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
I'm not sure why that's happening, but the easiest way to counter it is to reset the dialog size after the nudge This should do the trick on *:TEXT:*Buzz*:%uno.channel:{
if ($did(AutoList,80).state == 1) splay -p UNOsndz/buzz.mp3
did -v AutoList 501
.timer 1 2 did -h AutoList 501
dnudge AutoList
dialog -s AutoList -1 -1 294 183
}
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
What are all the options for your dialog table? Maybe one of those options is interfering with the calculations (possibly a mIRC bug).
-genius_at_work
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
The problem is a result of the menus in the dialog. mIRC doesn't seem to be consistent with setting and retrieving the height of the client area of dialogs when a menu bar is present.
Simply find the difference and add it to the $dialog().ch value in the code.
-genius_at_work
|
|
|
|
Joined: Apr 2008
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Apr 2008
Posts: 51 |
wow. a bit over my head. how do i add the value?
You are right though it shrink the size of the menu bar each time.
|
|
|
|
Joined: Apr 2008
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Apr 2008
Posts: 51 |
ok again thank you for letting solve this. it is a real pleasure to get an idea and try to make it work. here is what i did to fix it. if you think you can do better holler at me. lol. old code:
if (!$dialog($1)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
dialog -s $1 %x %y $7 &8
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.$1.,$1) -m 1 30 dnudge $1 $calc(($2 + 1) % 6) $3-
dialog -s $1 %x %y $7 $8
}
New code
if (!$dialog($1)) return
var %x = $3, %y = $4, %o = 4
if ($calc($ticks - $5) > $6) {
dialog -s $1 %x %y $7 404
return
}
elseif ($2 == 0) { inc %x %o | inc %y %o }
elseif ($2 == 1) { dec %x %o | inc %y %o }
elseif ($2 == 2) { inc %x %o | dec %y %o }
elseif ($2 == 3) { dec %x %o | dec %y %o }
elseif ($2 == 4) { dec %x %o | inc %y %o }
elseif ($2 == 5) { inc %x %o | dec %y %o }
$+(.timer.$1.,$1) -m 1 30 dnudge $1 $calc(($2 + 1) % 6) $3-
dialog -s $1 %x %y $7 404
}
the only thing i had to change was $8 which was holding the value of the height of the dialog. When i entered the starting height(404), it worked awesomely. thank you again.
Last edited by kkoser; 12/05/08 05:00 AM.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
That will work just fine (as long as you don't use the dnudge alias for any other dialogs of different heights.
-genius_at_work
|
|
|
|
|