mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
* $input: cannot use in an event #230249 02/03/11 09:54 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Hello,

How can i use the $input identifier on an event?

- Thanks!

Re: * $input: cannot use in an event [Re: westor] #230250 02/03/11 10:10 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
$input is not meant for an event. Events are things that are going to happen whether or not you are there and aren't going to sit around and wait for you to type something. That said, there are ways around this. For example, using a timer...

Code:
.timer 1 1 echo -a This is my input: $!input(Press OK or Cancel)


Note that you do need the ! in there to prefer $input() from being done until after the timer triggers.


Invision Support
#Invision on irc.irchighway.net
Re: * $input: cannot use in an event [Re: Riamus2] #230251 02/03/11 10:14 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
The $$input(Press OK or Cancel) or $$?"Press OK or Cancel" is good for your own use, not other people who trigger it anyway. The $ should be made double so it won't trigger if no string is supplied.

Re: * $input: cannot use in an event [Re: Riamus2] #230252 02/03/11 10:20 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
if i wanna do this?

var %t = $input(lalala,oid,test)

does not work on sockclose event!

Re: * $input: cannot use in an event [Re: westor] #230253 02/03/11 10:21 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You can also do is as:
Code:
//.timer 1 1 noop $input(Press OK or Cancel) | echo -a This is my input: $!

Last edited by Tomao; 02/03/11 10:25 PM.
Re: * $input: cannot use in an event [Re: Riamus2] #230254 02/03/11 10:25 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Pardon me, Riamus2, your example does work. I didn't mean to prove your wrong otherwise.

Re: * $input: cannot use in an event [Re: Tomao] #230255 02/03/11 10:26 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Yes but i have an var , check my code

ON *:SOCKCLOSE:mysock: {
var %ask = $input(Test,yidb,Asking)
if (%ask == $true) { .. }
elseif (%ask == $false) { .. }
}

* $input: cannot use in an event

Last edited by westor; 02/03/11 10:26 PM.
Re: * $input: cannot use in an event [Re: westor] #230256 02/03/11 10:28 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Did you place a
Code:
sockclose $sockname
under your sockread event? If the socket has been closed already, the sockclose event won't get triggered.

Re: * $input: cannot use in an event [Re: Tomao] #230257 02/03/11 10:32 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
no i haven't put an /sockclose command into the sockread just /sockmark

Re: * $input: cannot use in an event [Re: westor] #230258 02/03/11 10:37 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
how can i make it work the sockclose event with the /var, ?

Last edited by westor; 02/03/11 10:38 PM.
Re: * $input: cannot use in an event [Re: westor] #230259 02/03/11 10:54 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
on *:sockclose:mysock: { 
  .timer 1 1 echo -a $!iif($input(Test,yidb,Asking),$!,$!)
}
As Riamus said, you need to use a timer like as shown below. If the yes button is pressed, it'll return $true, else it returns $false

Re: * $input: cannot use in an event [Re: Tomao] #230260 02/03/11 10:59 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
.timer 1 1 echo -a $!iif($input(Test,yidb,Asking),This will be true when yes button is pressed,This will be false when no button is pressed)
Now, all you have to do is replace 'This will be true...' and 'false' with the command you want to trigger.

Of course, replace echo -a with the command.

Last edited by Tomao; 02/03/11 11:01 PM.
Re: * $input: cannot use in an event [Re: Tomao] #230261 02/03/11 11:01 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
i changed the echo with var and not working
Code:
    .timer 1 1 var %ask $!iif($input(%m,yidb,Information),$!,$!)


%m = my message

Last edited by westor; 02/03/11 11:02 PM.
Re: * $input: cannot use in an event [Re: westor] #230262 02/03/11 11:08 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
//.timer 1 1 echo -a $!iif($input(%m,yidb,Information),$!,$!)


Well, I don't know why a variable has to be used...

Last edited by Tomao; 02/03/11 11:10 PM.
Re: * $input: cannot use in an event [Re: Tomao] #230263 02/03/11 11:15 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
* Invalid format: $iif

Re: * $input: cannot use in an event [Re: westor] #230264 02/03/11 11:21 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
I had asked for this before and someone has gave me an $safe alias code or something like this. but i can't find his post!

Re: * $input: cannot use in an event [Re: westor] #230265 02/03/11 11:27 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
on *:sockclose:mysock: {
  var %ask $!iif($input(%m,yidb,Information),$!,$!)
  .timer 1 1 echo -a %ask
}
Why do you need a safe alias? I mean, the $input is self-triggered, not like any one is going to exploit it.

Last edited by Tomao; 03/03/11 01:14 AM.
Re: * $input: cannot use in an event [Re: westor] #230269 03/03/11 01:42 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I don't see why you need an input box to pop up when the sock closes. It will close regardless. If I want to have it automatically reconnect I have a switch for reconnect. If switch is true it will reconnect, otherwise it wont.

For messages there is the $tip function that works nicely. Or you can create a dialog for messages.

Re: * $input: cannot use in an event [Re: Tomao] #230270 03/03/11 02:08 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
@Tomao: I can't test it right now, but I'm pretty sure what you have in your most recent post won't work. $input cannot be used in an event. You can put the $input on a timer to get around that issue, but you haven't done so. You put the timer on the echo line instead.

Also, you are echoing within 1 second of displaying the $input (even if it did work) and it's unlikely anyone will click touch that input box within that time period.

This should work fine if you want the value set as a variable (use whatever params you need). Though you cannot use echo (even on a timer) with this method because you don't know how long it will take before someone presses something.
Code:
.timer 1 1 var %input = $!input(Please click something)


Instead, you could use an alias...
Code:
.timer 1 1 $!iif($input(Please click something),clickedok,clickedcancel)
alias clickedok { echo -a clicked ok }
alias clickedcancel { echo -a clicked cancel }


I believe that's what Tomao was doing with $! in the $iif().

@westor: Please explain why you think you need an $input box here. It is almost guaranteed that $input isn't what you should really be using regardless of any workarounds that can be used to make it work. What exactly are you trying to accomplish with $input ? As mentioned, you can easily include a real dialog, or a $tip or some other method of communication here instead of $input and it would be better.

Last edited by Riamus2; 03/03/11 02:29 PM.

Invision Support
#Invision on irc.irchighway.net
Re: * $input: cannot use in an event [Re: Riamus2] #230271 03/03/11 02:20 PM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Originally Posted By: Riamus2
@Tomao: I can't test it right now, but I'm pretty sure what you have in your most recent post won't work. $input cannot be used in an event. You can put the $input on a timer to get around that issue, but you haven't done so. You put the timer on the echo line instead.

Also, you are echoing within 1 second of displaying the $input (even if it did work) and it's unlikely anyone will click touch that input box within that time period.

And, I'm just wondering... why are you using $iif() there? You true/false are exactly the same, so it doesn't do anything that I can see.

This should work fine if you want the value set as a variable (use whatever params you need). Though you cannot use echo (even on a timer) with this method because you don't know how long it will take before someone presses something.
Code:
.timer 1 1 var %input = $!input(Please click something)


Instead, you could use an alias...
Code:
.timer 1 1 $!iif($input(Please click something),clickedok,clickedcancel)
alias clickedok { echo -a clicked ok }
alias clickedcancel { echo -a clicked cancel }


@westor: Please explain why you think you need an $input box here. It is almost guaranteed that $input isn't what you should really be using regardless of any workarounds that can be used to make it work. What exactly are you trying to accomplish with $input ? As mentioned, you can easily include a real dialog, or a $tip or some other method of communication here instead of $input and it would be better.


man i have built an auto-update script and putted an $input identifier on the SOCKCLOSE event so when the download file completes then ask for updating or not that i wanna make and i thing the $input identifier.

also this code does not working

Code:
.timer 1 1 var %input = $!input(Please click something)

Last edited by westor; 03/03/11 02:25 PM.
Page 1 of 2 1 2