mIRC Home    About    Download    Register    News    Help

Print Thread
#179514 23/06/07 10:46 PM
Joined: Oct 2006
Posts: 82
B
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 82
Hi there all cool

I seem to have a slight dilema.....

I have written a small script to colour my text:

Code:
on *:INPUT:*:{
  if (%colourtxton == 1) && ($left($1,1) != /) {
    say 4 $1- 
    halt
  }
  elseif (%colourtxton == 2) && ($left($1,1) != /) {
    say 12 $1- 
    halt
  }
}

menu channel {
  -
  Text colourer
  .Red:{
    set %colourtxton 1
  }
  .Dark Blue:{
    set %colourtxton 2
  }
  .COLOUR OFF:{
    unset %colourtxton
  }
  -
}


this works, but not as i want.

without it turned on the line begins normally.

example when turned off:

[23:38] <[Shadow^Dwella]> now this is the test 3Larfing Out Loudly

example when turned on:

[23:42] <[Shadow^Dwella]> now this is the test 3Larfing Out Loudly
[23:42] <[Shadow^Dwella]> 12 now this is the test lol

both examples are whilst my accronyms script is enabled, this is called "colour talkers" and as you can see when colour text is active it makes a space at the very beginning and repeats all text input, does anyone know of a way i can eliminate those to errors?

Thanks in advance smile


Never ASSUME!!!

As it often makes and ASS out of U and ME!!
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
You need to compile all your ON INPUT events into one routine, instead of having multiple ON INPUT events.

mIRC has the ability to trigger a given event in every script file you have loaded, thus it can do exactally what you're describing.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
on *:INPUT:*:{
  if (%colourtxton == 1) && ($left($1,1) != /) {
    say 04 $+ $1- 
    halt
  }
  elseif (%colourtxton == 2) && ($left($1,1) != /) {
    say 12 $+ $1- 
    halt
  }
}


Use $+ to combine things without spaces, and always use 2 digits for colors (even if the color number is under 10). Otherwise, it may combine numbers if the first character in the text is a number and you'll have the wrong color.

For the halting (so you only see the changed text), it's set up correctly. However, other on INPUT scripts may break the halting ability of the script. For example, using on &*:input: may prevent you from being able to halt the event. As mentioned, you can insert your on INPUT script into another on INPUT script to help fix the problem.

Last edited by Riamus2; 24/06/07 12:40 AM.

Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard