mIRC Homepage
Posted By: KingTomato Parsing error in $submenu result - 22/05/06 01:09 AM
Hello,

I almost never post with problems, but this one's puzzling me. I'll start off by saying this is occuring in 6.16, and haven't gotten around to installing 6.17, so it may be fixed. If it is, someone with 6.17 test it, and let me know so I can feel foolish. grin

Anyways, I'm creating a game bot and trying to use a menu system to direct the target of an @input window's text. It uses a simple variable with the value of it's destination, and works--kind of. I'm trying to get the menu to dynamically populate with a list of team names, as to direct text to team-specific. My problem is this: When I try to build the first team, it messes up with the name, and displays the command in the menu item, and attached no command. Check it out:



What I did notice was it seems to be the { character. mIRC wants to parse it as a command beginning, despite it being before a colon. Maybe a bug? Try the following:

Code:
menu channel {
  Demo Dest
  .Blah 1: /echo -a Menu -3
  .Blah 2: /echo -a Menu -2
  .Blah 3: /echo -a Menu -1
  .-
  .$subMenu($broken_submenu($$1))
}

alias broken_submenu {
  if ($1 == begin || $1 == end) return -
  else {
    var %team0 = }JeV{*, %team1 = *JeV*, %teams = 2
    var %team = $calc($1 - 2)
    if (%team < %teams) return %team [ $+ [ %team ] ] : /echo Menu %team
  }
}


Now, make the %team0 }JeV*. It should resolve itself. Seems to be a parse error in the submenu routine. Can anyone confirm?
Posted By: DaveC Re: Parsing error in $submenu result - 22/05/06 02:03 AM
Your $submenu alias seems a bit mucked up since it tries to return on pass "1" %team-1, pass "2" %team0, and pass "3" %team1 and pass "4" $null
I only mention this becuase that confused me for long enough to not pickup on where the problem really is.

Its not in the $submenu part at all, its straight out in the menu, the { causes the menu system to loose it, also appears to cause code to execute what ever directly follows the {
example
menu channel {
Demo Dest
.Blah 1: /echo -a Menu -3
.}JeV{* : /echo -a EXAMPLE1
.}JeV-* : /echo -a EXAMPLE2
.Blah 2: /echo -a Menu -2
}
Posted By: KingTomato Re: Parsing error in $submenu result - 22/05/06 05:10 AM
I apologize, i was incomplete on the demo. I used a different segment code, and recreated that to show off the 'flaw'.

I have team names beginning at -1 up through N teams (-1 is an observer team, and teams begin at 0 on through to how ever many the map has). It still shows the flaw with a brace messing up the menu item . It seems mIRC looks for either a brace or a colon as a starting command point. Further than that, it includes the "command" after the brace in the actual menu output. It appears the execution parser does one thing, and the display parser does another.

I guess my question still remains, is this accepted behavior. imho, mIRC should display everything before the colon as the menu item, and after the colon should be treated as the command element(s).
Posted By: DaveC Re: Parsing error in $submenu result - 22/05/06 07:07 AM
Ahh that clears up the alias, i was kinda suprised when i thought u had made a mistake like that, considering i have seen the quality of your other message code samples. As you say it was just the way your teams are mapped. And yes it shows the pharsing error anyway. And i would agree with you in that its not doing what its ment to do.
And the oddity of that the menu item and the executed code doesnt even match frown

Oh i tried a few things like using $({,) even $!({,) nothing seemed to fix it frown
Also something like .}JeV{* : /echo -a EXAMPLE1 : /echo EXAMPLE2 shows the whole line, it just ignores all the : etc
Posted By: hixxy Re: Parsing error in $submenu result - 22/05/06 04:48 PM
Indeed. For some reason mIRC thinks the { is the start of a code block despite it touching other characters. This is my guess anyway considering if you click on the menu it tries to execute *: (the char directly after {).

Another thing, even if you put a space between whatever's after the * and the :, it tries to execute <whatever>:. If I'm not making much sense, check this example:

Code:
menu status {
  Demo Dest
  .Blah 1: /echo -a Menu -3
  .Blah 2: /echo -a Menu -2
  .Blah 3: /echo -a Menu -1
  .-
  .$subMenu($broken_submenu($$1))
}

alias broken_submenu {
  if ($1 == begin || $1 == end) return -
  else {
    var %team0 = $+($chr(125),JeV,$chr(123),echo), %team1 = *JeV*, %teams = 2
    var %team = $calc($1 - 2)
    if (%team &lt; %teams) return $eval($+(%,team,%team),2) : /echo Menu %team
  }
}


It tries to execute /echo:
Posted By: Khaled Re: Parsing error in $submenu result - 25/05/06 02:24 PM
Thanks I should have this fixed in the new version.
Posted By: OrionsBelt Re: Parsing error in $submenu result - 25/05/06 02:34 PM
/me redirects Khaled to the "Colorcoding in the remote" thread on the "Feuture suggestions" forum.
© mIRC Discussion Forums