mIRC Homepage
Posted By: sparta space removal problem - 18/06/07 09:45 AM
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.
Posted By: SladeKraven Re: space removal problem - 18/06/07 11:55 AM
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 }
}
Posted By: sparta Re: space removal problem - 18/06/07 12:00 PM
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
Posted By: SladeKraven Re: space removal problem - 18/06/07 12:03 PM
Paste your script so I can test it, right now I'm only working with an alias. Only paste the On Text/Action event.
Posted By: starbucks_mafia Re: space removal problem - 18/06/07 12:41 PM
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
Posted By: sparta Re: space removal problem - 18/06/07 06:28 PM
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..
© mIRC Discussion Forums