|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2004
Posts: 842 |
I'll prolly get flamed for this but meh.
$key identifier which returns either $true of $false depending on if a function key was pressed. (Including shift+fk or ctrl+fk)
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
How would it work though? If I hit F1 when I start mIRC, will $key be $true until I close mIRC? Or did you have something else in mind?
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2004
Posts: 842 |
It was something like
/F2 {
if ($key == $true) {
if ($snick($chan,1)) { .ignore -w $snick($chan,1) 1 }
}
}
Which would stop people calling it as /F2 or $F2 (if that makes sense), meaning it would only work if F2 was pressed.
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Oh I see. I agree this would be nice
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
I'm confused wouldnt it be $true if it was pressed anyway?
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2004
Posts: 842 |
If you had that code added, the did /F2 it would see if the F2 key was pressed, if is true then it does what its suppost to do, otherwise it does nothing.
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
I think he means it would only be $true if the alias was called by a user hitting a key on the keyboard, rather than calling it as /F1
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
What about $isid or do I have the wrong concept?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
$isid checks if it is being called as an $identifier, but he wants something to determine if an F* alias was called because a user hit the key.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Ahh you are right I don't know what I was thinking. Good idea.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
So in theory if this was added lets say...
alias f1 {
if ($key) do something when key is pressed.
else { perform a command from command }
}
If this was added for all Function Key variants we could have 72 fkeys? Well, not 72 fkeys. But can perform 72 different things, right?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Yeah, but 36 of them would only be executed when called as /F1, /SF6, /CF12, etc.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Yep, that's what I mean. 36 by by using the keys. And 36 by the command (/sf1).
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
f1 {
if ($key) { echo F1 key pressed }
else { echo F1 called as an alias }
}
f6 { f1 } What displayes if i press F6? (and why)
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
haha, but who would honestly do that though? It's a waste of time and a waste of a function key.. :tongue:
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
That was a simplified example (as well you know it ) how pointless was the F1 alias for that matter. But the example shows how a problem could occur, the F6 function might need to run F1 fucntion as part of that it does. Actually i dont really see the point of it, I mean if its simply do one thing or the other based on if the key is pressed, why not have F1 { echo F1 key pressed } ~F1 { echo ~F1 function called } I mean if your gonna type something at the keyboatrd like /F1 whats the difference in what you type, you might as well type /BOBTHEMONKEY Have i missed something?
|
|
|
|
Joined: Dec 2002
Posts: 83
Babel fish
|
Babel fish
Joined: Dec 2002
Posts: 83 |
There is $keyval where you can get the ASCII code and define with a if ($keyval isnum ASCII_F1-ASCII_F12)
Last edited by dunkelzahn; 12/05/06 11:21 AM.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
There could be a command to switch on/off/change the $key value (depending on what $key ultimately returns).
f1 {
if ($key) { ; [color:red]if ($key == F1) {[/color]
;do something here
;do something else
}
}
f6 {
key on ;[color:red]key F1[/color]
f1
}
Alternate format in red-genius_at_work
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2004
Posts: 842 |
ok ... better idea
$key - Returns either $true or $false depending on if a function key was pressed. $keyname - Returns the name of the function key pressed. e.g. F1, CF1 etc.
or what genius_at_work said, whichever method is fine.
Last edited by Jigsy; 12/05/06 02:43 PM.
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
I think $key should be $true in that example. There's many reasons for aliasing function keys Nothing wrong with F1 and F6 doing the same thing.
|
|
|
|
|