mIRC Homepage
Posted By: sparta $readini problem - 10/07/07 06:39 PM
I use this in my script.

join $readini(system\aj\autojoin.ini,$network,channel)

that working just fine as long as i dont add any key to the channel. the ini looks like this:

[NETWORK]
channel=#open,#keyed key

if i do: //echo -> $readini(system\aj\autojoin.ini,$network,channel)

it return:
-> #open,#keyed key

so long everything working as it should, you see the key in the echoed line, but when i try to make it join the channel with the key, then the server tells me i need the key, how ever the key is there, if i change the line so it looks like:

[NETWORK]
channel=#keyed key,#open

then it join the keyed channel, but not #open , the space in the file cosing the script to halt for some reason. I have been testing the code, been looking in debug, and what i can see the key and the other channel is sent to the server:

-> irc.server.org JOIN #keyed key,#open

but it wont join #open , i asked in a irc channel, but i didnt understand what they said so i need someone to explain to me how i can solve this.

Need to add:
if none of the channels have a key, then it working as it supposed to:

[NETWORK]
channel=#open1,#open

it joins #open1 and #open

so it must have to do with the space between the channel and the key, been trying to solve this for 3 hours now, still no luck with it. need help, and if possible a good explanation to how i can fix it.
Posted By: CitizenKane Re: $readini problem - 10/07/07 06:49 PM
Does this work?
Code:
/var %chans = $readini(system\aj\autojoin.ini,$network,channel)
while ($numtok(%chans,44) > 0) {
  /join $gettok(%chans,1,44)
  %chans = $deltok(%chans,1,44)
}
Posted By: qwerty Re: $readini problem - 10/07/07 06:50 PM
The problem is that the format for joining multiple channels, some of them containing keys, is like:

/join #chan1,#chan2,#chan3,#chan4 key1,key2,key3,key4

If for example chans 3 and 4 don't have keys, the format would be:

/join #chan1,#chan2,#chan3,#chan4 key1,,,key4

So what you can do is extract the channels with their keys from $readini() and rearrange them into the above format, storing the result in a %var, then call /join %var. Alternatively, you can change the way you store channels in the .ini. Token identifiers will probably help you a lot in achieving either.
Posted By: Old Re: $readini problem - 10/07/07 06:52 PM
*EDIT* Or those posts work :P
Posted By: Horstl Re: $readini problem - 10/07/07 06:59 PM
At least on unreal ircd, "/helpop join" replies:
Syntax: JOIN <chan>,<chan2>,<chan3> <key1>,<key2>,<key3>

So the problem seems to be that you try to use a syntax
JOIN <chan1> <key1>,<chan2>
or
JOIN <chan1>,<chan2> <key1> (mean: you provide the key for chan2, but the ircd thinks you are sending the key for chan1)

You could solve this problem by loopig the parts of the $readini return.
Code:
alias autojoin {
  var %chanstring = $readini(system\aj\autojoin.ini,$network,channel), %nr = 1
  while ($gettok(%chanstring,%nr,44)) { 
    join $ifmatch
    inc %nr
  }
}

Posted By: sparta Re: $readini problem - 10/07/07 07:18 PM
thnx, CitizenKane. your code worked, same with Horstl, i will try understand what the code does and how it sends the output on /join #channel key . have been looking for a tutorial on the net that explained this, but couldent find any. maybe something to do for the one that have time and know how it works wink
© mIRC Discussion Forums