mIRC Homepage
Posted By: Kurdish_Assass1n Script Question - 17/12/06 02:18 AM
I'm thinking that there's a remote event that I can't find, or anything else, that triggers when you hit any key, this is kind of hard to explain...so, i'll try my best:
I'm have the editbox of a channel active and I hit the letter 'e' on the keyboard, and, it goes into the editbox, it would echo 'whatever'.
hope anyone who reads this understands, please let me know if you don't understand, i'll be glad to try and be more specific and even have to get screenshots if I have to.
Thanks!
Posted By: RusselB Re: Script Question - 17/12/06 02:53 AM
only thing that occurs to me, is the ON INPUT event. If this isn't what you're thinking of, please clarify, and (if possible) get screenshots of what you're trying to do.
Posted By: Kurdish_Assass1n Re: Script Question - 17/12/06 03:05 AM
ok, lets say I just typed the letter 'H' and the number '1' came up. The 1 and the H are just examples i'm using, so, like..the first letter i hit, it will perform a command, like echo.
Example:
Posted By: Riamus2 Re: Script Question - 17/12/06 04:40 AM
Here is an examle for you.

Code:
on *:input:*: {
  if ($1 == e) {
    echo -a $2-
    halt
  }
}


If you type: e $calc(5+5)
It will echo in your active window: 10

In other words, it saves you from typing //echo -a

Of course, you could just make an /e alias, but that does mean you have to type / as well.

Anyhow, I think you had more in mind than just saving some typing, so just use this example to get you where you want.
Posted By: Kurdish_Assass1n Re: Script Question - 17/12/06 04:46 AM
ok, basically, this is what i'm trying to do, this is why i'm wanting to know if this is possible..If anyone here has been on MSN , AOL, or Yahoo Messenger, you'll know what i'm talking about. I have this client that this Program uses, called XBConnect, and, what i'm trying to do like, when I hit any letter, it will say 'Nick is typing a message'. so, I'm not looking for something that count's my letters or anything, i'm just wanting to know if someone is typing something.
Basically, i'm trying to make the '......is typing a message' thing that MSN has.
Posted By: bwr30060 Re: Script Question - 17/12/06 05:10 AM
You'd have to script (or otherwise implement) some kind of behind-the-scenes communication between the clients so that whenever you were typing, your script would send a message to the other person, in a format that both parties would use so that the other script knew someone was typing. I'm not sure the best way to go about that. You could use a special CTCP action when you're typing, but that would most likely flood.
Posted By: Kurdish_Assass1n Re: Script Question - 17/12/06 06:08 AM
I know how I would do this, i already have it all planned, except for the first part, i don't know any part of scripting that does what i'm wanting it to do. where it performs a command the first time you hit a key. sort of like KEYDOWN
Posted By: bleach Re: Script Question - 17/12/06 04:22 PM
/help on keydown

türkçe biliyormusun
Posted By: Kurdish_Assass1n Re: Script Question - 17/12/06 04:25 PM
I need this to work for a PM (Private Message) and not a custom window. Please help if you can. Thanks again.
Posted By: Riamus2 Re: Script Question - 17/12/06 04:27 PM
Well, like you know, KEYDOWN is for custom windows. If you want it from the editbox, I'd probably suggest a timer that checks $editbox($active) every second for text.
Posted By: bleach Re: Script Question - 17/12/06 05:28 PM
yea your right. good idea.. he have to check editboxes every milisecs.
Posted By: Kurdish_Assass1n Re: Script Question - 18/12/06 11:35 PM
thanks Riamus2, I'll try that. smile
Posted By: Kurdish_Assass1n Re: Script Question - 20/12/06 05:12 PM
ok, this is what I have come up with, I have used echo for right now so I could test it, what's happening is I don't want to keep on sending messages to the other person saying 'Typing-Message: $true/$false' because I might get killed for flooding. so, is there a way to make this happen only once

Code:
on *:ACTIVE:?: {
  if (*!*@XBConnect.com* iswm $address($active,2)) {
    ;Since it's going to be for Team-XBC ^^
    timercheck -m $+(100,$str(00,6)) 430 check
  }
}
on *:ACTIVE:#: {
  if ($timer(check)) { timercheck off }
  if ($timer(msg)) { timermsg off }
}
alias check {
  if ($len($editbox($active)) == 1) { echo -ag Typing-Message $true }
  ; This stops on two, which is good. ^^
  if ($len($editbox($active)) < 1) { echo -ag Typing-Message: $false }
  ; THis doesn't stop on 0, which is bad ^^
}


Examples:


Posted By: Riamus2 Re: Script Question - 20/12/06 10:13 PM
Set a variable and check it before sending the text.
Code:
alias check {
  if ($len($editbox($active)) >= 1) {
    if (%Typing != $true) {
      echo -ag Typing-Message $true
    }
    set -u15 %Typing $true
  }
  else {
    if (%Typing) {
      echo -ag Typing-Message: $false
      unset %Typing
    }
  }
}


This will only display $true once and only $false once. As a note, the way you had the $true part, if you typed 2 letters before it checked, it wouldn't display $true because it wouldn't be == 1.

Note: Although it shouldn't be needed, I put -u15 to unset the %Typing variable just to prevent possible problems. It should unset automatically anyhow, but I like being thorough. smile
Posted By: Kurdish_Assass1n Re: Script Question - 20/12/06 11:38 PM
ok Riamus2, thanks :D, I'll try it..Always coming to my rescue :P, lol
Posted By: Kurdish_Assass1n Re: Script Question - 21/12/06 06:08 PM
ok, thanks Riamus2, what you gave me worked perfectly. I have found another problem though :|

Code:
alias check {
  if ($left($1-,1) != $chr(47)) {
    if ($len($editbox($active)) >= 1) {
      if (%Typing != $true) {
        .msg $active Typing-Message: $true
      }
      set -u15 %Typing $true
    }
    else {
      if (%Typing) {
        .msg $active Typing-Message: $false
        unset %Typing
      }
    }
  }
}

I added the second line..
if ($left($1-,1) != $chr(47)) {
but, it acts like the if statement is true, which it isn't, CHR 47 = / I don't want it to say i'm typing a message if I'm using / at the beginning.
Posted By: genius_at_work Re: Script Question - 21/12/06 09:34 PM
What is the value of $1- ?

Looking at the rest of the code, the only value I can see being used is the result from $editbox($active). Unless you are sending some value when you call /check, $1- will be $null which is indeed != $chr(47).

-genius_at_work
Posted By: Riamus2 Re: Script Question - 21/12/06 11:05 PM
Originally Posted By: genius_at_work
What is the value of $1- ?

Looking at the rest of the code, the only value I can see being used is the result from $editbox($active). Unless you are sending some value when you call /check, $1- will be $null which is indeed != $chr(47).


Yeah, use this:
if ($left($editbox($active),1) != $chr(47)) {
Posted By: Sais Re: Script Question - 21/12/06 11:08 PM
I would go further:
Code:
var %text = $editbox($active)
if ($len(%text) >= 1) && ($left(%text,1) != $chr(47)) {


Note that I reversed the conditions, too.

Also looked like there was a space missing between one of the ) { pairs (in the OP).
Posted By: Kurdish_Assass1n Re: Script Question - 21/12/06 11:11 PM
ok, got it working, thanks guys. But, I found yet another problem with my script, I'm almost done with it though.

Code:
Code:
on ^*:TEXT:*:?: {
  if (Typing-message: $false == $1-2) {
    mtitle $titlebar
    echo -a Testing
    haltdef
  }
  if (Typing-message: $true == $1-2) {
    mtitle $titlebar ------------------------------- $active Is Typing A Message. --------
    echo -a Testing-1
    haltdef
  }
}

ok, it does every command here, the haltdef, the echo -a Testing[-1], but, it does not do the mtitle part, but, when I use it just normally type it, it works, so, the alias 'mtitle' isn't messed up, but, it's not working for some reason, why is that?
Also, sorry for making so many posts/threads on this topic.


-------------------------------------------

Full Code Just In Case:
Code:
on *:ACTIVE:?: {
  if (*!*@XBConnect.com* iswm $address($active,2)) {
    .timercheck -m $+(100,$str(00,6)) 430 check
  }
}
on *:ACTIVE:#: {
  if ($timer(check)) { .timercheck off }
}
alias check {
  if ($left($editbox($active),1) != $chr(47)) {
    if ($len($editbox($active)) >= 1) {
      if (%Typing != $true) {
        .msg $active Typing-Message: $true
      }
      set -u15 %Typing $true
    }
    else {
      if (%Typing) {
        .msg $active Typing-Message: $false
        unset %Typing
      }
    }
  }
}

on ^*:TEXT:*:?: {
  if (Typing-message: $false == $1-2) {
    mtitle $titlebar
    echo -a Testing
    haltdef
  }
  if (Typing-message: $true == $1-2) {
    mtitle $titlebar ------------------------------- $active Is Typing A Message. --------
    echo -a Testing-1
    haltdef
  }
}

alias mtitle { dll " $+ $scriptdirmtitle.dll $+ " mtitle $1- }
alias mtitlebar { return $dll( " $+ $scriptdirmtitle.dll $+ " , mtbar , 0 ) }
alias mChan { if ($1 ischan) { mSet $1 Channel: -[ $+ $1 $+ ]- Population: -[ $+ $nick($1,0) $+ ]- Modes: -[ $+ $iif( $chan($1).mode , $chan($1).mode , n/a ) $+ ]- Topic: -[ $+ $iif( $chan($1).topic , $ifmatch , none) $+ ]- } }
alias mSet { if ($1 ischan) { dll " $+ $scriptdirmtitle.dll $+ " mchan $window($1).hwnd $strip($2-) } }

alias mtabout { dll " $+ $scriptdirmtitle.dll $+ " mtabout }
on :*:load: {
  if ($version < 5.9) { echo $colour(info) -s *** mtitle cannot be used, you need mIRC 5.9 or higher | unload -rs $script | return }
  echo $colour(info) -s *** mtitle v1.3 by Kintar0 
  echo $colour(info) -s *** mtitle successfully loaded...
  .timer 1 1 mtabout
}
Posted By: Riamus2 Re: Script Question - 21/12/06 11:17 PM
Originally Posted By: Sais
I would go further:
Code:
var %text = $editbox($active)
if ($len(%text) >= 1) && ($left(%text,1) != $chr(47)) {


Note that I reversed the conditions, too.

Also looked like there was a space missing between one of the ) { pairs.


Yeah, I just posted the code to replace what he said without redoing (or looking at) what I had originally posted. smile

I didn't notice a missing space, but maybe I'm blind. wink
Posted By: Riamus2 Re: Script Question - 21/12/06 11:17 PM
I'm not sure of the problem with the mtitle thing. Sorry.
Posted By: Kurdish_Assass1n Re: Script Question - 21/12/06 11:21 PM
ok Riamus2, thanks, anyone else wanna give it a try? Please?? smile
Posted By: Kurdish_Assass1n Re: Script Question - 22/12/06 03:59 PM
wow, just found something out, I re-read /titlebar in the help file, and, it said this:
Quote:

/titlebar [@window] <text>

Sets the main application titlebar. If you specify a custom @window name, then the titlebar for that custom window is changed.

lol, everyone who said use '/titlebar' on IRC, i said, it's for custom windows, they would say 'o, you're right' lol, thanks guys.
Posted By: Kurdish_Assass1n Re: Script Question - 22/12/06 05:40 PM
ok, I'm back again, this will probably be my last post, everything on it is correct, just found a little problem that may be a little annoying.

Code:
alias check {
  if (*!*@XBConnect.com isin $address($active,2)) {
    if ($left($editbox($active),1) != $chr(47)) {
      if ($len($editbox($active)) >= 1) {
        if (%Typing != $true) {
          .msg $active Typing-Message: $true $me
        }
        set -u15 %Typing $true
      }
      else {
        if (%Typing) {
          .msg $active Typing-Message: $false $me
          unset %Typing
        }
      }
    }
  }
}
on ^*:TEXT:*:?: {
  if (Typing-message: $false == $1-2) {
    titlebar $xbv
    haltdef
  }
  if (Typing-message: $true == $1-2) {
    titlebar $xbv -][*][-][*][-][*][--=[ $3 Is Typing A Message. ]=--][*][-][*][-][*][-
    haltdef
  }

ok the .msg and the haltdef part, it doesn't show for now, but, once you check the log, all you see is 'Typing-Message: $false/$true $me' and it may get annoying for logging PMs, is there a way to not log the 'Typing........' part?

Here's an example of a log:
Quote:

[11:11:29] <Kurdish_Assass1n> yo
[11:11:30] <Kurdish_Assass1n> u there?
[11:12:28] <[Reaper]> Typing-Message: $true
[11:12:28] <[Reaper]> yeaq
[11:12:29] <[Reaper]> Typing-Message: $false
[11:12:39] <[Reaper]> Typing-Message: $true
[11:12:40] <[Reaper]> yea*
[11:12:40] <[Reaper]> Typing-Message: $false
Posted By: Riamus2 Re: Script Question - 22/12/06 09:33 PM
That is interesting that the log still logs that. Maybe it's a bug that it is logging halted text. I don't think it's supposed to. You might want to find out if it is a bug or not.

The only workaround I can think of is to not use mIRC's logging feature, but to use your own.
Posted By: Kurdish_Assass1n Re: Script Question - 23/12/06 12:25 AM
ok, i think it's fixed, hopefully it is, but, i don't see it as much anymore, i'll let anyone know if it still does this, thanks.
© mIRC Discussion Forums