mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#148897 11/05/06 06:29 PM
Joined: Nov 2004
Posts: 842
Jigsy Offline OP
Hoopy frood
OP Offline
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?
#148898 11/05/06 07:04 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
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?

#148899 11/05/06 07:29 PM
Joined: Nov 2004
Posts: 842
Jigsy Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Nov 2004
Posts: 842
It was something like

Code:

/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?
#148900 11/05/06 07:30 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Oh I see. I agree this would be nice smile

#148901 11/05/06 07:30 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I'm confused wouldnt it be $true if it was pressed anyway?

#148902 11/05/06 07:32 PM
Joined: Nov 2004
Posts: 842
Jigsy Offline OP
Hoopy frood
OP Offline
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?
#148903 11/05/06 07:34 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
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

#148904 11/05/06 07:39 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
What about $isid or do I have the wrong concept?

#148905 11/05/06 07:43 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
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.

#148906 11/05/06 07:47 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ahh you are right I don't know what I was thinking. Good idea. smile

#148907 11/05/06 07:54 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
So in theory if this was added lets say...

Code:
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?

#148908 11/05/06 07:56 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Yeah, but 36 of them would only be executed when called as /F1, /SF6, /CF12, etc.

#148909 11/05/06 07:59 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Yep, that's what I mean. 36 by by using the keys. And 36 by the command (/sf1).

#148910 12/05/06 07:04 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
f1 {
  if ($key) { echo F1 key pressed }
  else { echo F1 called as an alias }
}
f6 { f1 }


What displayes if i press F6? (and why)

#148911 12/05/06 07:28 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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:

#148912 12/05/06 07:37 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
That was a simplified example (as well you know it smile ) 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?

#148913 12/05/06 11:16 AM
Joined: Dec 2002
Posts: 83
D
Babel fish
Offline
Babel fish
D
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.
#148914 12/05/06 01:58 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
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).

Code:
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

#148915 12/05/06 02:20 PM
Joined: Nov 2004
Posts: 842
Jigsy Offline OP
Hoopy frood
OP Offline
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?
#148916 13/05/06 08:27 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I think $key should be $true in that example. There's many reasons for aliasing function keys smile

Nothing wrong with F1 and F6 doing the same thing.

Page 1 of 2 1 2

Link Copied to Clipboard