mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2009
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Apr 2009
Posts: 10
Hi,

I would like to set up a script that autojoins rooms from a saved hashtable. The rooms would be on different server so the hash table would be the channel name and the data would be the serverip it is on.

e.g #brooklyn11218 - 199.9.250.7

I for the life of me can't figure out how to get it to go down the items in the hash table and join the rooms.

I'd like to do it on start up or on connect, whichever is easier. Any ideas?

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
on *:start:{
  if !$hget(auto-join) { .hmake auto-join 100 }
  if $exists($scriptdirauto-join.hsh) { .hload auto-join $scriptdirauto-join.hsh }
  var %a = 1, %b = $hget(auto-join,0).item
  while %a <= %b {
    .scon -at1 check_network $!serverip %a
    inc %a
  }
}
alias -l check_network {
  if $1 == $hget(auto-join,$2).data {
    .join $hget(auto-join,$2).item
  }
}

Amend the hash table name as appropriate. Please note that this is just written up quickly, and probably isn't the most efficient method of doing it.

Joined: Apr 2009
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Apr 2009
Posts: 10
Thank you Russel for your help. Also thank you for your help in my other thread, it is greatly appreciated.

Ok, i edited where i saw things needed to be edited, A lot of the code was beyond my level, so i was a bit confused and most likely screwed it up, which is why it isn't working for me. Here is the complete script i have: please let me know where i went wrong.

Code:
on *:join:#: {
  if ($nick == $me) {
    /hadd auto-join $chan $serverip
  }
}

on *:start:{
  if !$hget(auto-join) { .hmake auto-join 100 }
  if $exists(auto-join.hsh) { .hload auto-join auto-join.hsh }
  var %a = 1, %b = $hget(auto-join,0).item
  while %a <= %b {
    .scon -at1 check_network $!serverip %a
    inc %a
  }
}
alias -l check_network {
  if $1 == $hget(auto-join,$2).data {
    .join $hget(auto-join,$2).item
  }
}

on *:exit: {
  /hsave -o auto-join auto-join.hsh
}

Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Try this:

Code:
on ME:*:join:#: hadd -m auto-join $chan $serverip

on *:start:{
  if !$hget(auto-join) { .hmake auto-join 100 }
  if $exists(auto-join.hsh) { .hload auto-join auto-join.hsh }
}

on *:connect:{
  var %a = 1, %b = $hget(auto-join,0).item
  while %a <= %b {
    .scon -at1 check_network $!serverip %a
    inc %a
  }
}

alias -l check_network {
  if $1 == $hget(auto-join,$2).data {
    .join -n $hget(auto-join,$2).item
  }
}

on *:exit: hsave -o auto-join auto-join.hsh

Joined: Apr 2009
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Apr 2009
Posts: 10
IT WORKED! thanks so much the both of you! ^_^


Link Copied to Clipboard