mIRC Home    About    Download    Register    News    Help

Print Thread
space removal problem #179129 18/06/07 09:45 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I use this code to return timestamp in my theme:
Code:
alias tstmpt {
  if (%tstmp == 1) { return %tleft $+ $time( $+ %tsform $+ ) $+ %tright }
}

and it woking just fine as long as timestamp is enabled, how ever if i disable timestamp, then i get a space i want to be removed.

Example:

[11:36] ° Nick testar

No space infront of [11:36]

how ever if i disable timestamp it looks like

Example:

° Nick testar

You see the space, and i cant return $+ to remove it.
Code:
alias tstmpt {
  if (%tstmp == 1) { return %tleft $+ $time( $+ %tsform $+ ) $+ %tright }
  if (%tstmp == 0) { return $+ }
}

So how do i solve this?

;------- Edit

%tleft [
%right ]
%tsform mm:nn

so you see the %var's i use.

Last edited by sparta; 18/06/07 09:50 AM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: space removal problem [Re: sparta] #179134 18/06/07 11:55 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You do like making life hard for yourself don't you. eek

Why don't you just do:

/timestamp on mm:ss

Code:
alias tstmpt {
  if (%tstmp == 1) { return $timestamp }
}

Re: space removal problem [Re: SladeKraven] #179136 18/06/07 12:00 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
cos everything is editable, including the brackets in [ ], and also the color are editable, and i dunno how to remove that extra space if timestamp is off, if i add $+ manualy it working ok, but not if i reurn $+ with a alias.. smirk


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: space removal problem [Re: sparta] #179137 18/06/07 12:03 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Paste your script so I can test it, right now I'm only working with an alias. Only paste the On Text/Action event.

Re: space removal problem [Re: sparta] #179142 18/06/07 12:41 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Well I still don't understand why you don't use /timestamp -f timestamp-format - you can change the surrounding brackets and insert colours if you want (although you'll have to re-add them in using on start since mIRC won't store the colours).

If you still want to do it with a script however, the problem isn't in the code you've given. You'll need to show an example of the code calling that alias.

As a side note that alias can be written as:
Code:
alias tstmpt {
  if (%tstmp) { return %tleft $+ $time(%tsform) $+ %tright }
}

No need for the extra $+'s


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: space removal problem [Re: starbucks_mafia] #179161 18/06/07 06:28 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on ^*:text:*:#: {
  haltdef
  set -u4 %tnick $nick
  set -u4 %tmsg1 $1-
  set -u4 %ttchn $chan
  stcolo
  echo $chan $tmsg
}
alias stcolo {
  if ($regex(%tmsg1,$iif($len($color(background)) == 1,$+(/,$chr(3),$chr(40),0,$color(background),$chr(124),$color(background),$chr(40),(?=[^\d]),$chr(41),$chr(41),/g),$+(/,$chr(3),$color(background),/g)))) { set %tmsg $regsubex(%tmsg1,$iif($len($color(background)) == 1,$+(/,$chr(3),$chr(40),0,$color(background),$chr(124),$color(background),$chr(40),(?=[^\d]),$chr(41),$chr(41),/g),$+(/,$chr(3),$color(background),/g)),$chr(3) $+ $color(normal text)) }
  else { set %tmsg %tmsg1 }
}
alias tmsg {
  return $nnick %tmsg
}
alias nnick_ {
  if (%metheme == Close) { return $tstmp $lef $+ $opv_ $+ %tnick $+ $rig }
  else if (%metheme != Close) { return $tstmp $lef $opv_ $+ %tnick $rig }
}
alias lef {
  return $chr(3) $+ %bcp $+ $readini($mircdirsystem/theme.ini, nbrackets, left) $+ $chr(3)
}
alias rig {
  return $chr(3) $+ %bcp $+ $readini($mircdirsystem/theme.ini, nbrackets, right) $+ $chr(3)
}
alias tstmp {
  if (%tstmp == 1) { return $chr(3) $+ %bcp $+ $readini($mircdirsystem/theme.ini, tbrackets, left) $+ $chr(3) $+ $chr(015) $+ $time( $+ %tsform $+ ) $+ $chr(3) $+ %bcp $+ %tright $+ $chr(3) }
}

This is all the code i use.

;---------- Edit

No one that have any suggestions? and add the colors everytime arent bether then the way i use my timestamp..

Last edited by sparta; 18/06/07 07:28 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }