mIRC Home    About    Download    Register    News    Help

Print Thread
#239942 07/12/12 08:11 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
I have this query control script that opens a dialog when i get a query request.
But when the dialog is open and i can't accept or deny for some reason when i get a second and third and so on request i get an error saying: dialog name in use.
When i started using mirc i had a script that showed me the first request and on closing that request or accept/deny it opend a second and third and so on request dialog.
Same thing as in using $input.
But i'm sure it was a dialog because of the info the script showed(name, comchans, message).
How can i make my script use multiple dialog.
Here is the code i have:

Code:
on 1:OPEN:?:*:{
  set %query.nick $nick
  set %query.address $address($nick,1)
  set %query.text $1-
  close -m $nick
  .msg $nick Query Control: Please wait as I decide to accept or deny your query request.
  query.decide
}
alias -l query.decide {
  dialog -m Query Query
}
dialog Query {
  title "Query"
  size 300 250 200 50
  option dbu
  text "Nick:", 2, 5 12 12 10, nowrap
  text "Text:", 3, 5 22 12 10, nowrap
  edit %query.nick %query.address, 4, 20 10 170 10, read
  edit %query.text, 5, 20 20 170 10, read
  button "Accept", 6, 25 32 40 15
  button "Decline", 7, 75 32 40 15
  button "Ignore", 8, 125 32 40 15
}
on 1:dialog:Query:*:* {
  if ($devent == sclick) {
    if ($did == 6) {
      dialog -x Query Query
      query %query.nick
      echo -t %query.nick < $+ %query.nick $+ > %query.text
      .msg %query.nick Query Control: Your query has been accepted.
      unset %query.*
    }
    if ($did == 7) {
      dialog -x Query Query
      .msg %query.nick Query Control: Your query has been denied.
      unset %query.*
    }
    if ($did == 8) {
      dialog -x Query Query
      ignore -p %query.nick
      .msg %query.nick Query Control: Your query has been denied and you have been ignored.
      unset %query.*
    }
  }
}


If you have any questions please ask.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
When you create a dialog, you name it. In your case, you're naming it Query. You can only have one dialog with the same name open at the same time. You would need to create the dialog using a different name. Note your /dialog -m command. You can change the name there and avoid the problem.

One example:
//dialog -m $nick Query

That will name the dialog using $nick and open the Query dialog. As long as you don't want multiple dialogs for that nick open, you're fine. You can name it different ways... just as long as the name is not the same as one that is already open.

Just keep in mind that you are using variables that are static instead of dynamic. If you have more than one dialog open, you will be overwriting those variables. For that matter, you're overwriting them already. You'll need dynamic variables.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
thank you Riamus2

Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
I haven't tested it but knowing you i'm sure it will work.
If i'm understanding this corrent this will have in case of more then 1 query request also have more dialogs open.
If that is true is there a way to hide the dialogs from the second and third and so on request until the one infront of them is closed?
like:

request 1 open - request 2 and 3 hidden
request 1 closed and request 2 opens - request 3 stays hidden
request 2 closed and request 3 opens and so on in case of more requests

or is there a way to get more info into an $input like
the message and the channel other then using the combobox?

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
You can also use "if ($dialog(table-name))" to check if a dialog is created (open).

or you can check if not created "if (!$dialog(table-name))"
Code:
if (!$dialog(table-name)) { dialog -m table-name table-name }

This will only trigger if the dialog name dont exist.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It sounds like what you want to do is make a single dialog that shows query requests. Just make a list where you show every request in the dialog and then select the one to accept/deny and click a button to do that. Then you have only one dialog to worry about.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
I couldn't get the dialog working like ik wanted so i had a look at $input.
I found a small snippet for query but that had only "yes" and "no" on the query request.
The only info was the time of the request and the name who requested the query with you.
Credit to xelent who made this.
I added a spam filter, a away message, comchans and message of what is being said at the request.
Any comment of what is wrong or can be better is welcome.
Here is what i made of it:

Code:
on *:OPEN:?: {  if ($away) { notice $nick Sorry, but $me is away. | close -m $nick }
  elseif (porn isin $strip($1-) || http:// isin $strip($1-) || www isin $strip($1-) || $chr(35) isin $1-) {  .msg $nick Go spam somewhere else ..... you r ignored.  | .ignore -p $nick | close -m $nick } 
  else {
    .msg $nick Query Blocker - Please Be Patient untill i accept or decline
    set %querytext. [ $+ [ $nick ] ] $1-
    var %x 0
    var %y $comchan($nick,0)
    while (%x < %y) {
      inc %x
      var %a %a $+ $chr(32) $+ $comchan($nick,%x)
    }
    .timer 1 0 acceptq $timestamp $nick $date %a %querytext. [ $+ [ $nick ] ]
  }
}

alias acceptq {
  var %sp = $crlf $+ $crlf
  set %acc $input( $3 $1 $+ %sp $+ Comschan: $4 $+ %sp $+ Message: $5- ,yqdv,Accept Query from $+($2,?))
  acceptqcheck $1 $2
}

alias acceptqcheck {
  if ( %acc == $yes ) {
    .msg $2 Request Accepted
    window -a $2
  }
  if ( %acc == $no ) {
    .msg $2 Request Declined
    .ignore -p $2
    window -c $2
  }
  unset %acc
  unset %querytext. [ $+ [ $nick ] ]
}


Link Copied to Clipboard