mIRC Home    About    Download    Register    News    Help

Print Thread
#147808 24/04/06 04:06 PM
Joined: Jul 2005
Posts: 37
G
gans Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jul 2005
Posts: 37
im trying to log sumthing in bold but the thing is that its reading sum text and it allways starts with bold but it dont allways finish with a bold iv tryed $strip($1-,b) also $remove($1-,bold) and then add bold but its not allways doing it right is there a diff way of doing it this is my code so far
Code:
on $1:TEXT:/\#*\ *[0-9]x /:#: {

  var %pack-num = $1
  var %pack-sent = $2
  var %pack-size = $null
  var %pack = $null

  if ([ == $3) {
    %pack-size = $3 $4
    %pack = $strip($5-,b) $+ [color]
  }
  else {
    %pack-size = $3
    %pack = $strip($4-,b) $+ [color]
  }
  msg #gan-bot %pack-num %pack-sent %pack-size [bold] $+ %pack $+ [bold] TESTING [bold]TESTING[bold]
}
 

what im trying to do is make the %pack bold but it dont seem to work iv tryed loads of ways with ppls help and its confusing every1 iv added at the end of msg [ TESTING TESTING ] its only ment to make the last testing bold but half the time its making the first testing bold

is there a way of telling how manny bold there is in the text?

Last edited by gans; 24/04/06 05:38 PM.
#147809 24/04/06 07:21 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
To add color/bold you don't use 'tags' like you have shown in your code.

For bold, surround the text with: ctrl + b
For color, surround the text with: ctrl + k#
Or use their ascii equivalents.

So to make %pack bold, you could do this:

%pack = $+($chr(2),$strip($4-),$chr(2))

$chr(2) is the ascii equivalent for the bold character.

#147810 24/04/06 07:44 PM
Joined: Jul 2005
Posts: 37
G
gans Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jul 2005
Posts: 37
nice try but its still not doing it right it just dont seem to add bold at the end of them all it works on sum tho and i dont want to $strip it all cous its got colors in it but if i do $strip(text,b) it dont do it right u see what i meen about confusing?

#147811 24/04/06 08:03 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
There should be nothing confusing about it. It's a simple task, and although I did not try to replicate what you are doing, I know it should work. Perhaps you could use the bold/color tags on here to show a real output/input as an example of what you're trying to accomplish.

#147812 24/04/06 08:21 PM
Joined: Jul 2005
Posts: 37
G
gans Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jul 2005
Posts: 37
ok this is my code iv edited it a bit since last time
Code:
on $1:TEXT:/\#*\ *[0-9]x /:#: {
  tokenize 32 $strip($1-,b)

  var %pack-num = $1
  var %pack-sent = $2
  var %pack-size = $null
  var %pack = $null

  if ([ == $3) {
    %pack-size = $3 $4
    %pack = $+($chr(2),$5-,$chr(3),$chr(2))
  }
  else {
    %pack-size = $3
    %pack = $+($chr(2),$4-,$chr(3),$chr(2))
  }
  msg #my-chan %pack TESTING $chr(2) $+ TESTING $+ $chr(2)

and this is the output i get

HOW I WANT IT
[KAOS] Movie Name [XVID] TESTING TESTING

HOW I DONT WANT IT
[KAOS] Movie Name [XVID] TESTING TESTING

it seems to work fine if i dont add a bold at start for sum reason even know im striping all bold out of it thats whats confusing about it

#147813 24/04/06 08:26 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
I get how you want it to look. I was looking more of how is the line formatted that you are grabbing this data from. Though my guess is that there is an unclosed bold code somewhere in that line which in turn causes your output to be incorrect.

I think the better option here would be to strip the text, and re-color/bold it as you need it. That way you have full control over how it looks.

#147814 24/04/06 08:29 PM
Joined: Jul 2005
Posts: 37
G
gans Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jul 2005
Posts: 37
oh ok well its getting it from xdcc bots like

#1 0x [700M] movie

#147815 24/04/06 08:46 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Try it like this, you are free to colorize any bit of text however you want it. The %pack has already been colored red in this example.

I'd give a more detailed example, but I don't know how you're determining the type (xvid/whatever), so I leave that part up to you.

Code:
on $1:TEXT:/\#*\ *[0-9]x /:#: {
  var %text = $strip($1-)
  var %pack-num = $gettok(%text,1,32)
  var %pack-sent = $gettok(%text,2,32)
  var %pack-size = $gettok(%text,3,32)
  var %pack = 04 $+ $gettok(%text,4-,32) $+ 
  msg #my-chan whatever...
}

#147816 24/04/06 09:00 PM
Joined: Jul 2005
Posts: 37
G
gans Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jul 2005
Posts: 37
its not the color im trying to do it allready sets that how it is its just trying to get it bold

#147817 24/04/06 10:07 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
It doesn't matter what you are trying or not trying to do to it. The text, in my code is stripped of all codes. You can make any bits of it bold, colored, underlined, or whatever you want to do to it.


Link Copied to Clipboard