mIRC Homepage
Posted By: MercuryD Popup menu for @windows? - 14/10/05 12:07 AM
I'm trying to set up a sort of chat emulation using the window command. The problem I've got right now is that
Code:
menu @Daraolynn {  
option:Action
}

doesn't come up with anything. I have no idea why - Two others who have been helping me and know scripting well insist it should, and are essentially refusing to help me otherwise. Do you have any advice for me?
Posted By: Om3n Re: Popup menu for @windows? - 14/10/05 06:25 AM
That should indeed work fine, assuming you are right clicking in the main area of the custom window (not an editbox or nicklist)
Posted By: MercuryD Re: Popup menu for @windows? - 14/10/05 06:31 AM
Awesome. So it really isn't working just for the sheer reason that it doesn't want to? I could post the script, but it's about 100 lines long, and it seems like an awful lot of extra to post needlessly. Though I'll do it if it seems the only way.
Posted By: ClickHeRe Re: Popup menu for @windows? - 14/10/05 01:14 PM
The only thing I would see is a { problem in the script or something that prevents it from displaying.

Post the code so we can have a look at it. You can strip down the unecessary stuff from it as it will only be shorter and easier to pinpoint the problem.
Posted By: MercuryD Re: Popup menu for @windows? - 14/10/05 01:37 PM
That's the kicker. In a fully stripped down form, that's it. I've checked for bracket issues, and it comes up fine - I've seen the havoc it creates when a bracket is missing, or added.
The code, in its near-entirety (Missing a list of CTCP commands, as I added them afterwards, and I know they're not causing a problem as such)
Code:
ON ^*:QUIT:%Daraolynn: { 
  if ($window(@ $+ %Daraolynn)) { $update_my_window(%Daraolynn) | aline -hp @ $+ %Daraolynn 2 $+ $nick has vanished from this plane. }
}
ON *:TEXT:!Speak*:#Daraolynn: {
  if ($window(@Daraolynn)) {
    if ($2 == %Location) { echo -mt @Daraolynn < $+ $3 $+ > $4- }
    elseif ($2 == %Location $+ SYS) { echo -mt @Daraolynn 7[-] $3- }
  }
} 
ON *:ACTION:!Act*:%Daraolynn: {
  if ($window(@ $+ %Daraolynn)) {
    if ($2 == %Location) { echo -mtc action @ $+ %Daraolynn * $3-  }
  }
}
ON *:INPUT:@Daraolynn: { 
  if ($window(@Daraolynn)) { 
    if ($mid($1,1,1) = $chr(47)) { 
      if ($1 = /me) { describe #Daraolynn !act %Location %character $2- | echo -mtc action @Daraolynn * $nick $2- | halt } 
      if ($1 = /clear) { return }
      if ($1 = /join) { return }
      if ($1 = /nick) { return } 
      if ($1 = /go) { msg #Daraolynn !Moveto $2- | halt } 
      if ($1 = /wallet) { msg #Daraolynn !wallet | halt } 
      else { return }
    }
    else { msg #Daraolynn !Speak %Location %Character $1- | echo -mt @Daraolynn < $+ %Character $+ > %Playername $1- }
  }
}
ON *:CLOSE:@Daraolynn: { msg #Daraolynn %Location $+ SYS %Character has departed the realm. | window -w #Daraolynn | part #Daraolynn | unset %Location | unset %Character }
alias Emulate_window { 
  if ($window(@Daraolynn)) { echo -a 4Error: please close @Daraolynn before trying to run the window emulator again. }
  else { 
    if (!$1) { set %Daraolynn #Daraolynn }
    else { set %Daraolynn $1 }
  }
}
alias update_my_window { 
  ; It has been found that IRC scripts are actually faster than the channel windows themselves can update.  This is
  ; to slow it down a tick in order for everything to work right.  
  .timerUpdateTheWindow $+ $rand(a,z) $+ $rand(1,100) 1 1.2 /update_emulated_window $1 
}
alias update_emulated_window { 
  ; Wipe out all the current list
  dline -l @Daraolynn 1-
  ; Locate all the Ops
  var %i 1 
  while (%i <= $nick($1, 0)) { 
    set %nick $nick($1, %i)
    if (%nick == $null) { inc %i }
    if (%nick isop $1) { aline -l @Daraolynn 7 $+ %nick | inc %i }
    else { inc %i } 
  }
  ; NPC information
  aline -l @Daraolynn 14NPCs
  ; This stuff will have to wait until a bot is made to send a list of NPCs to this client.  Then it can use 
  ; tokens to go through the list.

  var %i 1
  while (%i <= $nick($1, 0)) { 
    set %nick $nick($1, %i)
    if (%nick == $null) { inc %i }
    else { 
      if ((%nick isvoice $1) || (%nick isop $1)) { inc %i }
      else { aline -l @Daraolynn 14  $+ %nick | inc %i }
    }
    else { inc %i } 
  }
  unset %nick
  return
}
alias -l check_nick_in_chan {
  ; This checks to see if the person who changes his/her nick is actually in the emulated channel.
  ; If not, it ignores the change.  If so, it'll show up and update the nick list.

  if (($nick($1, $2) = $null) && ($nick($1, $3) = $null)) { halt }
  else { return } 
}
menu @Daraolynn {
   SNARK:/echo -a This is not finished.
}
alias name.on.list { return $line(@Daraolynn,$sline(@Daraolynn,1).ln,1) }
ctcp *:player_information*:*: {
  set %character.name $2 | set %character.description $3- | dialog -md Character_Information Character_Information | unset %character.description | unset %character.name
}
  

I'm pretty sure I've got a few cases in which there are "%Daraolynn"s still in there from when I first got the script. Many of these commands aren't used in what I'm testing at this point, or haven't been converted yet, so I'll figure that out myself. No need to point those mistakes out unless it's the cause.
The idea is that this will join a channel, hide the channel, create this window, and then, depending on info given from the main bot or other users of the script, either show that info, or not. The main reason it's a custom window instead of just a normal one is that I'm using the listbox to
A) Hide the bot. No particular reason.
B) Make the organization a little better.
C) Allow me to include NPC names as people in the nicklist.
D) I plan on eventually making it so the character name will show up in the box, instead of the user name. Should be easy enough to do - in theory.
Posted By: Riamus2 Re: Popup menu for @windows? - 14/10/05 02:25 PM
Well, I copied that into a remote, typed [color:red]/window -a @daraolynn[/red] and right clicked in the @window and it brought up SNARK. I clicked it and it echoed that it wasn't finished. So, it seems to work fine. I'm not sure why you're having trouble...
Posted By: MercuryD Re: Popup menu for @windows? - 14/10/05 07:27 PM
I think I've figured out the cause of the problem, though I don't know the solution. The /window command includes k0, to remove the @ from the title. However, I tried menu Daraolynn { and got no results, still.
Posted By: Riamus2 Re: Popup menu for @windows? - 14/10/05 07:46 PM
It still works here...

/window -k0 @Daraolynn

Code:
menu @Daraolynn {
  Test: echo -a test
}


Right clicking in the window beings up the menu item. Clicking it echoes the text.
Posted By: MercuryD Re: Popup menu for @windows? - 14/10/05 07:58 PM
You're right... I don't know what was wrong with it. I tried using a window outside the script, and it worked right. The weird thing is, after several days of this problem, when I went back to try it again... It worked fine. Thanks for all the help, though. Maybe my computer's being fickle again.
© mIRC Discussion Forums