mIRC Home    About    Download    Register    News    Help

Print Thread
#166092 06/12/06 05:01 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, I have & used in one script to handle some changes in how things work with Inputs. However, I also need it to be used in a second script for Inputs. AFAIK, you can't use it twice... even in different scripts for the same event. Am I wrong? Is there a way around this?

I wrote a cut script that takes what you type and splits it across multiple lines based on whatever line length you choose. The Input event for it starts with:

on &*:input:*: {

... which is the same as the other Input event that uses &. Any suggestions?


Invision Support
#Invision on irc.irchighway.net
Riamus2 #166131 06/12/06 11:38 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Can you combine the two ON INPUT events? I've not used the & as a prefix, so I looked it up in the help file, and according to it, the & prevents an event from running if their was a /halt or /haltdef in a previous script.

RusselB #166134 06/12/06 11:43 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah... the problem is that they aren't really compatible. frown

I'll play around with it some more and see if I can get anything working with the two scripts.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #166136 07/12/06 01:00 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You can use & in two different events (eg B and C, where the file containing B comes before the file with C in load order), as long as B doesn't use /halt. If it does, C will not fire.

I haven't seen your code of course, but I don't see why you can't combine those two events in one. In fact, I'd think combining them would make things easier.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
qwerty #166138 07/12/06 01:31 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, here are the two Input events. I've tried seeing how to combine them and make them both work properly, but it's difficult. And I can't make the original Input text halt without using the &... maybe I'm missing something. I've tried putting mine at the beginning and in the middle and changed various things in both to try and make them work together, but I'm not really having any luck. If you can tell me how to make the real Input halt and only the custom Input display without using the &, that would be ideal. Although the help file clearly says it won't work in Input events, I've tried with ^, without luck, of course. Anyhow, my cut script works great except that it won't coexist with Invision because of the &.

Note that these may not make sense without the rest of the scripts, but these are the events.

**For anyone wanting to use a cut script, this is NOT the full script and will not work by itself**

Cut Script
Code:
on &*:input:*: {
  var %letters = $iif($readini($scriptdir\cutscript.ini,Settings,Characters),$v1,400)
  if ($left($1,1) == / && $istok(//me /me //say /say //msg /msg,$1,32) == $false) { return }
  elseif ($len($1-) > %letters) {
    if ($len($1-) > 930) { echo -a Line too long. mIRC has a limit of characters for inputs, so please keep your text under 930 characters in length. Displaying first 930 characters. }
    var %original = $gettok($left($1-,930),1- $calc($gettok($left($1-,930),0,32) - 1),32)
    var %command = /msg $active
    if ($1 == /me || $1 == //me) { dec %letters $len($me) | var %original = $2- | var %command = $1 }
    elseif ($1 == /say || $1 == //say) { var %original = $2- | var %command = $1 }
    elseif ($1 == /msg || $1 == //msg) { var %original = $3- | var %command = $1 $2 }
    var %loc = 1
    var %original.len $len(%original)
    while (%loc <= %original.len) {
      var %text = $mid(%original,%loc,%letters)
      if ($len(%text) >= %letters) { var %text = $deltok($mid(%original,%loc,%letters),-1,32) }
      if (%loc == 1) { write cut.tmp %command %text  $+ $iif($readini($scriptdir\cutscript.ini,Settings,More),$v1,->) | dec %original.len }
      elseif ($calc(%loc + $len(%text)) < $len(%original)) { write cut.tmp %command $iif($readini($scriptdir\cutscript.ini,Settings,Continued),$v1,<-) %color $+ %bold $+ %underline $+ %text  $+ $iif($readini($scriptdir\cutscript.ini,Settings,More),$v1,->) | dec %original.len }
      else { write cut.tmp %command <- %color $+ %bold $+ %underline $+ %text  $+ $iif($readini($scriptdir\cutscript.ini,Settings,End),$v1,<>) }
      var %loc = $calc(%loc + $len(%text) + 1)
      var %end = $gettok(%text,$gettok(%text,0,15),15)
      if ($left($gettok(%end,$gettok(%end,0,3),3),2) isnum) { var %color =  $+ $v1 }
      elseif ($left($gettok(%end,$gettok(%end,0,3),3),1) isnum) { var %color =  $+ $v1 }
      if ($calc($gettok(%end,0,2) % 2) == 0) { var %bold =  }
      if ($calc($gettok(%end,0,31) % 2) == 0) { var %underline =  }
      if ($gettok(%end,0,2) == 1 && $chr(15) isin %text) { var %bold = $null }
      if ($gettok(%end,0,3) == 1 && $chr(15) isin %text) { var %color = $null }
      if ($gettok(%end,0,31) == 1 && $chr(15) isin %text) { var %underline = $null }
    }
    .play -a play.cut cut.tmp $calc($iif($readini($scriptdir\cutscript.ini,Settings,Delay),$v1,1) * 1000)
    .remove cut.tmp
    halt
  }
}


Invision section
Code:
on &*:input:*:{
  if ($left($active,1) !isin $chantypes) { hadd -m SpamSafe $active 1 }
  if ($gettok($1,1,32) == /who) {
    scanclear
    set -u15 %DOwho [ $+ [ $iNetwork ] ] 1 
    return
  }
  if ($gettok($1,1,32) == /whois) {
    scanclear
    set -u10 %DOwhois [ $+ [ $iNetwork ] ] 1 
    return
  }
  if ($gettok($1,1,32) == /names) {
    scanclear
    set -u10 %DOnames [ $+ [ $iNetwork ] ] 1 
    return
  }
  if ($gettok($1,1,32) == /join) || ($gettok($1,1,32) == /j) {
    unset %CNJC [ $+ [ $iNetwork ] ] [ $+ [ * ] ]
    return
  }
  if ($r.set(Away,Auto.Away) == On) && ($isnum($r.set(Away,Auto.Away.Delay)) == $true) && ($server != $null) { .timerAuto.Away $+ $iNetwork 1 $calc($r.set(Away,Auto.Away.Delay) * 60) auto-away } | w.mirc Wizard Advise 0
  if $ctrlenter == $true { return }
  if $left($1,1) == ! { .timerFSEB $+ $iNetwork -o 1 60 unset %altFxPflag [ $+ [ $iNetwork ] ] | set %altFxPflag [ $+ [ $iNetwork ] ] 1 }
  if $len($1-) < 940 && $active != Status Window { var %IStr = $replace($1-,$chr(36),$chr(36) $+ chr $+ $chr(40) $+ 36 $+ $chr(41),$chr(37), $chr(36) $+ chr $+ $chr(40) $+ 37 $+ $chr(41)) } | else { goto leave }
  if ($ctrlenter != $true) { var %IStr = $AcroAction($replace($1-,$chr(36),§¨©,$chr(37),§¨ª)) } | else { var %IStr = $replace($1-,$chr(36),§¨©,$chr(37),§¨ª) }
  if (($me ison $active) && ($left($gettok(%IStr,1,32),1) != /) && ($right($gettok(%IStr,1,32),1) == :) && ($gettok(%IStr,1,32) != :)) {
    if $ialchan( [ $remove($left($1,-1),$chr(40),$chr(41)) $+ *!*@* ] ,$active,1) != $null { 
      if $r.set(Colors,Speech) == On && $ctrlenter != $true { 
        var %saystr = [ [ $replace($gettok(%IStr,2-,32),$chr(15),$spclr) ] ] 
        say $resp2($ialchan( [ $left($gettok(%IStr,1,32),-1) $+ *!*@* ] ,$active,1).nick) $spclr $+ $replace(%saystr,§¨©,$chr(36),§¨ª,$chr(37)) 
      } 
      else { 
        var %saystr = [ [ $gettok(%IStr,2-,32) ] ] 
        say $resp2($ialchan( [ $remove($left($gettok(%IStr,1,32),-1),$chr(40),$chr(41)) $+ *!*@* ] ,$active,1).nick) $replace(%saystr,§¨©,$chr(36),§¨ª,$chr(37)) 
      } 
      if $r.set(SoundFX,hearOwn) == On { hearownsfx $1- }
      halt 
    }
  }
  if (($active == Status Window) && ($left($gettok(%IStr,1,32),1) != /)) { secho $ts $c(1) $+ [ $+ $c(2) $+ $me $+ 's Note $+ $c(1) $+ ]4 %IStr| halt }
  if (($active == @Fserve.Chat) && ($left($gettok(%IStr,1,32),1) != /)) {
    if ($fserv(0) == 0) { aline -ph @Fserve.Chat $c(1) $+ [ $+ $c(2) $+ No User's Online $+ $c(1) $+ ] | halt }
    else {
      aline -ph @Fserve.Chat < $+ $me $+ > %IStr
      var %fserve-p = 0
      :start-fc
      inc %fserve-p 1
      if ($fserv(%fserve-p) == $null) { unset %fserve-p | halt }
      if (($fserv(%fserve-p).status == waiting) || ($fserv(%fserve-p).status == inactive)) { goto start-fc }
      else { msg = $+ $fserv(%fserve-p) [ $+ $me $+ ] $replace(%ISstr,§¨©,$chr(36),§¨ª,$chr(37)) | goto start-fc }
    }
  }
  if ($strip(%IStr,burc) == !list) && ($r.set(Invision,IsoAds) == On) { 
    set %isoadchan [ $+ [ $iNetwork ] ] $active 
    if ($window( [ @Serve_Ads_ [ $+ [ %isoadchan [ $+ [ $iNetwork ] ] ] ] ] ) != $null) { 
      window -c @Serve_Ads_ [ $+ [ %isoadchan [ $+ [ $iNetwork ] ] ] ] 
    } 
  }
  if ($gettok(%IStr,1,32) == /me) {
    var %saystr =  [ [ $right(%IStr,-3) ] ]
    me $replace(%saystr,§¨©,$chr(36),§¨ª,$chr(37))
    if ($r.set(SoundFX,hearOwn) == On) { hearownsfx $1- }
    halt
  }
  if $r.set(Colors,Speech) == On { 
    if ($left($active,1) != $chr(61)) && ($left($gettok(%IStr,1,32),1) != !) && ($left($gettok(%IStr,1,32),1) != @) && ($ctrlenter != $true) && ($left($gettok(%IStr,1,32),1) != /) {
      var %saystr =  [ [ $replace(%IStr,$chr(15),$spclr) ] ]
      say $spclr $+ $replace(%saystr,§¨©,$chr(36),§¨ª,$chr(37))
      if $r.set(SoundFX,hearOwn) == On { hearownsfx $1- }
      halt
    }
  }
  else { 
    if ($left($active,1) != $chr(61)) && ($left($gettok(%IStr,1,32),1) != !) && ($left($gettok(%IStr,1,32),1) != @) && ($ctrlenter != $true) && ($left($gettok(%IStr,1,32),1) != /) {
      var %saystr =  [ [ %IStr ] ]
      say $replace(%saystr,§¨©,$chr(36),§¨ª,$chr(37))
      if $r.set(SoundFX,hearOwn) == On { hearownsfx $1- }
      halt
    }
  }
  :leave
}


Invision Support
#Invision on irc.irchighway.net
Riamus2 #166159 07/12/06 05:22 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Im not really sure what your on about about the use of the & symbol on the ON INPUT, any on input that preceeded a ON &*:INPUT that /halt or /haltdef 's well cause the & event to not trigger. In some n inputs this is what you would want, in others its not, for example
If u had a script that checked u were on a channel or pm and u didnt enter a command and had said "BLAH" that it would change that to "BLAB" and /MSG that to the channel/pm, then should a script before this have halted the input then you should use the & to stop yours sending the message again (assumption is the other script is processing the text)
If how ever you had say a auto AFK script, that sets a named timer for 10 mins everytime you say something, then you would not include a & becuase this is ment to run regardless of if any other on input halted the input or not, as its only concern is that you actually typed something.

Invision has assumed becuase thats all it can do, that if someone has halted the input before it, it should not attempt to process it.
Some of there code should not be in this event as it appears to deal with away timers so should be tripped regardless of halt(def) in inputs before it.
Code:
if ($r.set(Away,Auto.Away) == On) && ($isnum($r.set(Away,Auto.Away.Delay)) == $true) && ($server != $null) { .timerAuto.Away $+ $iNetwork 1 $calc($r.set(Away,Auto.Away.Delay) * 60) auto-away } | w.mirc Wizard Advise 0


The only real way i think you well be able to make both scripts function correctly is to adjust what you send to the play command file, so you push the actual command to an editbox (rather than execute it) thus letting the ON INPUT deal with it again /EDITBOX -n, this might produce problems of its own, im not sure, maybe you could create a hidden window in which you can push the commands to.

ex, your play file would have looked something like...
/msg #chan a verylong line i have typed ..... has been cut
/msg #chan here and so its come as two lines of text.

so now you want it to look like

/editbox -n @hiddenwindowname /msg #chan a verylong line i have typed ..... has been cut
/editbox -n @hiddenwindowname /msg #chan here and so its come as two lines of text.

(it would be clever to have your ON INPUT specificly ignore any ON INPUT comming through that window as well to ensure no recursive loop that might appear due to un forseen length adjustments of maybe the channel name etc)

The idea is that you caught the input, and your sending it back through a second time, since all of yours well be commands, they can be executed from any window.


DaveC #166175 07/12/06 12:48 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
The problem still lies with making the Input not display to the channel when hitting Enter. The & is the only way I seem to be able to halt that so that I can play around with it. Is there another way to halt the Input event from sending the text to the channel?


Invision Support
#Invision on irc.irchighway.net
Riamus2 #166202 07/12/06 07:23 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
The & does not stop the input going to channel, ill tell you that flat out right now.

try this, on a clean mirc
scrip1.mrc
on *:INPUT:#:{ if (FRED isin $1-) { echo -a BLOCKED BECAUSE OF FRED | haltdef } }

script2.mrc
on &*:INPUT:#:{ if (FRED isin $1-) { echo -a BLOCKED BECAUSE OF FRED (&* copy) | haltdef } }

script3.mrc
on *:INPUT:#:{ if (FRED isin $1-) { echo -a SENDING IN CAPS BECAUSE OF FRED | msg $chan $upper($1-) } }

now go to a channel and say "my name is fred the dog"

it should come back with
BLOCKED BECAUSE OF FRED
SENDING IN CAPS BECAUSE OF FRED

if u got a second client in channel it well also see
<firstclient> MY NAME IS FRED THE DOG

The & blocks only the script its attached to running if that events been previously halted, i would have to assume something is displaying the text to channel in an event that maybe isnt halted?

DaveC #166220 07/12/06 10:21 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
See, that is what I would assume as well (that & wouldn't block it from sending to the channel). However, there are many people using this Cut Script and I used & to prevent the text from appearing in the channel and it works for all of them. Only the "cut" version is being sent to the channel... not the original. Without the &, the original *and* the "cut" version are being sent.

The script is on my site, but the site is having issues... if you want, I'll pastebin the entire cut script for you to look at.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard