mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2014
Posts: 32
P
Panda Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Nov 2014
Posts: 32
I've been bashing my head against a brick wall with this all night and I still can't figure what I'm doing wrong.

The snippet is as follows:

Code:
menu status,channel {
  Remove Highlight
  .$submenu($HighlightWordList($1))
}

alias HighlightWordList {
  var %HighlightWord.Total $ini($scriptdirHighlights.ini,0) | var %HighlightWord.Count 1
  while (%HighlightWord.Count <= %HighlightWord.Total) {
    if ($1 == %HighlightWord.Count) return $ini($scriptdirHighlights.ini,%HighlightWord.Count):remini $scriptdirHighlights.ini $ini($scriptdirHighlights.ini,%HighlightWord.Count)
    inc %HighlightWord.Count
  }
}

And an example of the Highlights.ini, that the snippet is working on, is here:

Code:
[Testing]
PartialMatch=OFF

[Help]
PartialMatch=OFF

[mIRC]
PartialMatch=OFF

For some reason, each menu item is being appended with "C" which I'm guessing is the drive letter but I have no idea how or why its getting in there.

Also, I can't get it to delete a topic. I managed to mess it up so that it wiped the Highlights.ini file completely (but I can't remember how I managed that particular level of #fail lol).

Please, can someone help me to figure this out? I'd really appreciate it smile

Thanks

Panda

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
You seem to have a basic misunderstanding of how $submenu works, here you go:

Code:
menu status,channel {
  .Remove Highlight
  ..$submenu($HighlightWordList($1))
}

alias HighlightWordList {
  var %file = $scriptdirHighlights.ini
  if ($ini(%file,$1)) return $+($v1,:,remini %file $v1)
}

Joined: Nov 2014
Posts: 32
P
Panda Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Nov 2014
Posts: 32
Wow ... ok thank you.

It was my first attempt at using $submenu, and obviously you were correct in saying that I had a basic misunderstanding. I thought I had to include a loop when it would have done it anyway ...

I see a lot more reading on my horizon ... smirk

Thanks so much for your help @Loki12583

Panda

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
You need to wrap that whole section in if ($1 isnum) { } because it also passes $1 == begin and $1 == end.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard