mIRC Home    About    Download    Register    News    Help

Topic Options
#187624 - 09/10/07 07:28 AM * Invalid format: $instok
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
As topic say i have problem with $istok, the problem are in this line:

%lchannel.list = $instok(%lchannel.list, $+($chan(%count1), , , 1, 33)

and i cant find out what cosing it, been testing back and forward to find out what cosing it, someone that can spot it and explain? thnx smile
Code:
alias get_channel_list {
  if ($1 isnum && $1 < 10 && $gettok(%lchannel.list, $1, 33)) {
    var %_chan =  $v1
    return . $+ $1 $+ . $gettok(%_chan,1 , 58) $+ : join %_chan
  }
  else {
    if ($1 == 1) { 
      return No channels in list: noop
    }
  }
}
alias chan_addlist {
  var %count1 = $chan(0)
  while (%count1) {
    if ($chan isin %lchannel.list) { return }
    %lchannel.list = $instok(%lchannel.list, $+($chan(%count1), , , 1, 33)
    %lchannel.list = $deltok(%lchannel.list, 9-, 33)
    dec %count1
  }
}
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#187627 - 09/10/07 08:08 AM Re: * Invalid format: $instok [Re: sparta]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
If you're trying to insert the comma character (which is what it looks like), then you have to use $chr(44) in the $instok for the character you're inserting, as that identifier uses commas to separate the various options.

Code:
%lchannel.list = $instok(%lchannel.list, $+($chan(%count1), $chr(44) , 1, 33)


Top
#187628 - 09/10/07 08:41 AM Re: * Invalid format: $instok [Re: RusselB]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
Still same problem:

* Invalid format: $instok

so dunno, tested with your line, then tryed to edit it a bit, but no go..
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#187631 - 09/10/07 10:06 AM Re: * Invalid format: $instok [Re: sparta]
Rand Offline
Fjord artisan

Registered: 28/02/05
Posts: 342
You shouldn't be using "!" as your token separator/delimiter. A channel name CAN contain "!". There's no point in adding a comma, only to use "!" as the delimiter. I'd advise you to use chr 44 and avoid that entire mess.

Doing it your way, we'd do it like this:
var %lchannel.list = $instok(%lchannel.list,$+($chan(%count1),$chr(44)),1,33)

You can clean that up by doing it like:
var %chan = $+($chan(%count1),$chr(44))
var %lchannel.list = $instok(%lchannel.list,%chan,1,33)

Making things readable is generally a good thing, especially when other people (like us) read over your code.

PS: If you were to do it the way it should be done, as in, if you used a comma, or space character as the delimiter, you wouldn't need to do the $+() stuff:
var %lchannel.list = $instok(%lchannel.list,$chan(%count1),1,44)

Top
#187632 - 09/10/07 10:36 AM Re: * Invalid format: $instok [Re: Rand]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
I took your advice, how ever i still have one problem, it only return the first channel in the list, the var looks like:

%lchannel.list #test,#bla,#moo

and what i get it the submenu is

1. #test

after that nothing more. How come?

; edit

But it join all channels in the %var.
Code:
alias get_channel_list {
  if ($1 isnum && $1 < 10 && $gettok(%lchannel.list, $1, $chr(44) )) {
    var %_chan =  $v1
    return . $+ $1 $+ . $gettok(%_chan,1,44) $+ : join %_chan
  }
  else {
    if ($1 == 1) { 
      return &No channels in list: noop
    }
  }
}
alias chan_addlist {
  var %count1 = $chan(0)
  while (%count1) {
    if ($chan isin %lchannel.list) { return }
    var %chan = $+($chan(%count1),$chr(44))
    %lchannel.list = $instok(%lchannel.list,$chan(%count1),1,44)
    dec %count1
  }
}


Edited by sparta (09/10/07 10:40 AM)
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#187635 - 09/10/07 11:13 AM Re: * Invalid format: $instok [Re: sparta]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
Look at your code, sparta....

Code:
    return . $+ $1 $+ . $gettok(%_chan,1,44) $+ : join %_chan


Look at what you have it returning. You're using $gettok to only return the first channel. Then you're telling it to join the entire list.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top