mIRC Homepage

Accronyms and coloured text

Posted By: BritishGent

Accronyms and coloured text - 23/06/07 10:46 PM

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
Posted By: Bekar

Re: Accronyms and coloured text - 23/06/07 11:27 PM

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.
Posted By: Riamus2

Re: Accronyms and coloured text - 24/06/07 12:35 AM

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.
© 2022 mIRC Discussion Forums