mIRC Home    About    Download    Register    News    Help

Print Thread
#168932 17/01/07 12:11 AM
Joined: Dec 2006
Posts: 37
T
THE_ADZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Dec 2006
Posts: 37
I wrote a color script...One that would change the color of my text to green when /c is typed. Here is is:

ALIASES SECTION
Code:
/c {
  if (%color == on) { set %color off }
  if (%color == off) { set %color on }
} 


REMOTE SCRIPTS
Code:
 on 1:INPUT:#avatarrp: {
  if (%color == off) { /msg #avatarrp $1- | halt }
  if (%color == on) { /msg #avatarrp 9 $1- | halt }
}
 


And well...it's not working right...
It sometimes dosn't put any text at all...
Any ideas? Thanks.

THE_ADZ #168935 17/01/07 12:17 AM
Joined: Dec 2006
Posts: 37
T
THE_ADZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Dec 2006
Posts: 37
Actually...never mind. I fixed it. Combined it into one script:

Code:
 on 1:INPUT:#avatarrp: { 
  if ($1 == /c) {
    if (%color == on) { set %color off | halt }
    if (%color == off) { set %color on | halt }
  }
  if (%color == off) { /msg #avatarrp $1- | halt }
  if (%color == on) { /msg #avatarrp 9 $1- | halt }
}


THE_ADZ #168937 17/01/07 12:25 AM
Joined: Dec 2006
Posts: 37
T
THE_ADZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Dec 2006
Posts: 37
Aaand even better:

Code:
 on 1:INPUT:#avatarrp: { 
  if (/ isin $1) goto 1
  if ($1 == /c) {
    if (%color == on) { set %color off | halt }
    if (%color == off) { set %color on | halt }
  }
  if (%color == off) { /msg #avatarrp $1- | halt }
  if (%color == on) { /msg #avatarrp 9 $1- | halt }
  :1
  /echo $1- has been performed
}
 

THE_ADZ #168938 17/01/07 12:28 AM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
And that works? I was going to suggest ending the font color tag.

9 $1- 

Also, just for a tip. If the variable exists it is on, otherwise, if no variable it is off. Of course vice versa depending on your needs.

on 1:input:#avatarrp:{
if ($1 == /c) { $iif(%color,unset,set) %color $true }
elseif (!%color) { msg #avatarrp $1- | halt }
else { msg #avatarrp 9 $1-  | halt }
}

If I wanted for it to be green by default, I would make it so if (!%color) msg $chan 9 $1- .

Just some ideas. laugh

DJ_Sol #168963 17/01/07 02:20 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You don't need to close the color code or any other control code at the end of a line.

THE_ADZ, just to point out, you don't ever need /'s before commands inside a script except if you're checking to see if one was used in an event. /msg or /quit don't need the /'s.


Invision Support
#Invision on irc.irchighway.net
THE_ADZ #168987 17/01/07 09:05 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
And to add, I would always use double digit color codes:

if (%color == on) { /msg #avatarrp 09 $1- | halt }

Because when you are coloring a number, it will get messed up.
If you just always do double digit color codes, it will not be a problem.

OrionsBelt #168993 17/01/07 11:03 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Good point. Also, just to point out, because you have a color code followed by a space and then the text, you'll always have an extra space before your text. I'd suggest putting $+ between the color code and the $1- so you don't have the extra space.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard