mIRC Home    About    Download    Register    News    Help

Print Thread
Need some help completing this section #136053 22/11/05 10:08 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 on op:text:!add network*:*:{ 
  if !$3 { 
    .hadd -m Networks $network $server 
  } 
  elseif !$4 {      .msg $nick Usage !add network <network> <server>    } 
  else { 
    .hinc -m Networks $3 
    .hadd -m Networks $+($3,.,$hget(Networks,$3)) $4 
    .msg $nick Network $3 with server address $4 has been added 
  } 
} 
on op:text:!add room*:*:{ 
  if $target == $chan { 
    if !$3 {      .hadd -m $network $chan    } 
    else { 
      .hadd -m $iif(!$4,$network,$3) $iif(!$4,$3,$4) 
    } 
  } 
  elseif !$3 { 
    .msg $nick Usage: !add room (network) <channel> 
    .msg $nick (network) is optional 
  } 
  else { 
    .hadd -m $iif(!$4,$network,$3) $iif(!$4,$3,$4) 
  } 
} 
 
So far, so good, what I need now is
A) a method to check if the network used in the second code is in the hash table from the first code.
If it isn't there and I'm connected to that network, then the information from $network & $server is to be added to the Networks hash table automatically.
If it isn't there & I'm not connected to the network, then the person that entered the information is to be asked for a server address for that network.

B) If I'm not connected to the network, as referenced in A, then I'm to connect to that network and the channel specified in the second code.

C) If I am already connected to that network, then I need to check if I'm in the room specified on that network.

Hope this all makes sense and that someone can help me with this conundrum.

Re: Need some help completing this section #136054 22/11/05 07:20 PM
Joined: Oct 2005
Posts: 54
B
benjy355 Offline
Babel fish
Offline
Babel fish
B
Joined: Oct 2005
Posts: 54
I can most likely help you no problem, all I need to know is what the hell is the script supposed to do?
In a wild guess I'm thinking it's a hash table of networks your connected to... But I can't help unless I know what it does :P


Chat NSN
My Server: sleepystickman.ircxpro.com
Re: Need some help completing this section #136055 23/11/05 12:18 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The Networks hash table maintains the network names and server addresses for the networks that my bot connects to. The !add network command allows ops to add a new network for the bot to connect to. The !add room command adds a room/channel for the bot to join on a particular network.
When the bot connects to a network a hash table based on the name of the network is generated.

For lack of a better comparison, basically a hash table form of the servers.ini file, but with the bot auto-connecting to each network and auto-joining each room as associated with the network that the bot connected to.

Hope this helps.