mIRC Home    About    Download    Register    News    Help

Print Thread
joining rooms from a list sent by notice #214212 23/07/09 03:55 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
When I DJ, there are certain rooms that I have to be in, and certain rooms that are sponsors or have listeners, but aren't required. Due to the network limiting the number of rooms to 10, I need to use two nicks to be in all of the channels.
The actual channel names can change at almost anytime, thus the owner of the station has set-up a command on her bot to show which channels one needs to be in, and which are optional.

The display from the bot is like
Quote:
[22:59:42] -tune^brat- #Mystic_Radio, #Pleasure&Pain, #spank_inn_steins, #subgirls&oldermasters, #submissives&OlderMasters, (please make sure you are in stiens and both olderMasters) #A`Fun~Sexy`Place, #Krull, #LegLovers, #Drunkard`s_Walk, #Cunt, #Movado_Manor, #The_Spanking_Chair (all of these channels pull listeners, you can go in and see what is happening and use your judgement ...
-
[22:59:42] -tune^brat- (the following are optional they are very small and seldome active but we do have listeners from them) #The_Dork_Fortress, #submissivegift, #Indiana-Kink, #Krull^Dungeon^of^the^Wicked, #Kinbaku-bi, #playhouseofbondage


I have made the following code to handle the problem, and it seems to work ok, so I was just wondering if there might be a better way of doing it.
Code:
on *:notice:*:?:{
  if $nick == tune^brat {
    if $left($1,1) == $chr(35) {
      set %dj.rooms.1 $gettok($1-,1,40)
      set %dj.rooms.1 $remove(%dj.rooms.1,$chr(44))
      set %dj.rooms.1 $replace(%dj.rooms.1,$chr(32),$chr(44))
      set %dj.rooms.2 $gettok($1-,2,40)
      set %dj.rooms.2 $gettok(%dj.rooms.2,2,41)
      set %dj.rooms.2 $remove(%dj.rooms.2,$chr(44))
      set %dj.rooms.2 $replace(%dj.rooms.2,$chr(32),$chr(44))
    }
    else {
      set %dj.rooms.3 $gettok($1-,2,41)
      set %dj.rooms.3 $remove(%dj.rooms.3,$chr(44))
      set %dj.rooms.3 $replace(%dj.rooms.3,$chr(32),$chr(44))
    }
    if DJ* iswm $me {
      .join %dj.rooms.1
      var %dj.rooms.tmp = $calc(10 - $numtok(%dj.rooms.1,44))
      %dj.rooms.tmp = $gettok(%dj.rooms.2,1- $+ %dj.rooms.tmp,44)
      .join %dj.rooms.tmp
      .msg #mystic_radio !turn on
    }
    else {
      var %dj.rooms.tmp = $calc(10 - $numtok(%dj.rooms.1,44))
      %dj.rooms.tmp = $calc(%dj.rooms.tmp - $numtok(%dj.rooms.2,44))
      .join $gettok(%dj.rooms.2,%dj.rooms.tmp,44)
      %dj.rooms.tmp = $calc(-1 * %dj.rooms.tmp)
      %dj.rooms.tmp = $calc(10 - %dj.rooms.tmp)
      %dj.rooms.tmp = $gettok(%dj.rooms.3,1- $+ %dj.rooms.tmp,44)
      .join %dj.rooms.tmp
    }
  }
}

I tried combining some of the various variable settings into one, but I either got an error or the time that it took was noticeably longer than in the current format.

Re: joining rooms from a list sent by notice [Re: RusselB] #214213 23/07/09 08:18 AM
Joined: Aug 2006
Posts: 182
T
Thrull Offline
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 182
You can probably do it easier using Regex, but given that the code works and looks good, I don't see any issues using the code you have.

It would pretty much replace all the setting you're doing, but I doubt it would be noticeably faster.


Yar
Re: joining rooms from a list sent by notice [Re: RusselB] #214222 23/07/09 08:35 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Why not just remove the space?


set %dj.rooms.1 $remove($gettok($1-,1,40),$chr(32))

set %dj.rooms.2 $remove($gettok($gettok($1-,2,40),2,41),$chr(32))


set %dj.rooms.3 $remove($gettok($1-,2,41),$chr(32))