mIRC Homepage
Posted By: dmmrs Working with a channel topic - 11/01/05 08:32 AM
One more question smile

Ive got a script that works with the channel topic, basically if soemone types something like:

!addwebsite xxxxxxxx

Then it appends xxxxxxx (NICKNAME) to the topic. However, when the topic is full, it won't append anything, obviously. How do i get my script to see if the topic is full first, then if it is, it auto makes enough space by deleting word(s) at the start of the topic?

Any help appreciated.
Posted By: Daedalus Re: Working with a channel topic - 11/01/05 10:33 AM
Use $chan(#channel).topic
Posted By: dmmrs Re: Working with a channel topic - 11/01/05 01:59 PM
That is what I am using, however, i need a way for it to see if the topic is full already, and if so, then to delete say the first 2 or specified words smile
Posted By: Iori Re: Working with a channel topic - 11/01/05 02:40 PM
You need first to save the maximum topic length (from raw 005) when you connect, then check $len of topic against that value .
Code:
raw $005:/TOPICLEN=(\d+)/:set %topiclen. $+ $cid $regml(1)
on @*:text:!addwebsite &:#:{
  tokenize 32 $chan(#).topic $2 ( $+ $nick $+ )
  while %topiclen. [ $+ [ $cid ] ] < $len($1-) { tokenize 32 $3- }
  topic # $1-
}
on *:start:unset %topiclen.*
© mIRC Discussion Forums