mIRC Home    About    Download    Register    News    Help

Print Thread
queue question #158694 08/09/06 12:17 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
im using a que like this

Code:
alias que {
  if (!$hget(que)) { 
    .hmake que 1
    hadd que 1 1
    .timerQue -m 0 1000 queStack 
  }
  hadd que $calc($hget(que,0).item + 1) $$1-
}

alias queStack {
  hinc que 1
  if ($hget(que,1) <= $hget(que,0).item) $hget(que,$hget(que,1))

  else { 
    .timerQue off 
    .hfree que 
  }
}

alias queStop {
  if ($hget(que)) .hfree que 
  .timerQue off
}


but if do something like

/que $($iif($sock(test), echo -a yes, )
does work, even though the socket is open.

Re: queue question #158695 08/09/06 01:20 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I fail to see the problem.

The item after the first comma in a $iif statement is what is returned if the condition in the $iif is true.
Using your command, if $sock(test) is true then echo Yes
So if the socket test is active, you should see Yes
Which is exactly what you are seeing (according to the line
Quote:
does work, even though the socket is open.

Re: queue question #158696 08/09/06 04:14 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
try this...
Code:
alias queStack {
  hinc que 1
  if ($hget(que,1) <= $hget(que,0).item) $eval( $hget(que,$hget(que,1)) ,2)
  else { 
    .timerQue off 
    .hfree que 
  }
}


* I dont know why you were using $( with out a closing brace so i assumed it wasnt ment to be there, whcih would make sence if u used /que from the editbox
/que $iif($sock(test), echo -a yes,)
/que $iif($sock(test), echo -a yes, echo -a no)

* if your doing it from a script or using // then it would need to be like this
//que $l( $iif($sock(test), echo -a yes,) ,0)
//que $l( $iif($sock(test), echo -a yes,echo -a no) ,0)

* i assume you are trying to queue up the command in $iif($sock(test), echo -a yes,)

The problem you were having is there is only one evaluation of $hget(que,$hget(que,1)) in your code this replaces it with its contents value.
Thats all fine if the value is say echo -a the sky is blue becuase its evaluated to that and thats it.
If however the value was echo -a the time is $time you well see just that the "$time" not 12:00:00
So when u do a $iif( etc etc ect ), mirc goes I have no COMMAND called $iif it must be a server side command, ill send it to the server
You well note i said COMMAND, becuase since its not going to evaluate $iif() it doesnt see it as an $IDENTIFIER

Re: queue question #158697 08/09/06 11:19 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
thanks, awesome reply.
but i got another problem:

alias rsock return ROOM. $+ $$1

que $Iif($rsock(%room), sockwrite -n $rsock(%room) WHOIS pyscho)

gives me: * /sockwrite: 'ROOM.TEST' no such socket

and there is a socket room.test and im in it, :S

Re: queue question #158698 09/09/06 03:09 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
* if your doing it from a script or using // then it would need to be like this
//que $l( $iif($sock(test), echo -a yes,) ,0)
//que $l( $iif($sock(test), echo -a yes,echo -a no) ,0)


Just like to make a late repair to this, those $l( should have been $!(