#230250 - 02/03/11 10:10 PM
Re: * $input: cannot use in an event
[Re: westor]
|
Planetary brain
Registered: 13/10/04
Posts: 8327
Loc: MA, USA
|
$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... .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
|
Top
|
|
|
|
#230251 - 02/03/11 10:14 PM
Re: * $input: cannot use in an event
[Re: Riamus2]
|
Hoopy frood
Registered: 07/07/07
Posts: 1129
Loc: United States
|
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.
|
Top
|
|
|
|
#230253 - 02/03/11 10:21 PM
Re: * $input: cannot use in an event
[Re: westor]
|
Hoopy frood
Registered: 07/07/07
Posts: 1129
Loc: United States
|
You can also do is as: //.timer 1 1 noop $input(Press OK or Cancel) | echo -a This is my input: $!
Edited by Tomao (02/03/11 10:25 PM)
|
Top
|
|
|
|
#230254 - 02/03/11 10:25 PM
Re: * $input: cannot use in an event
[Re: Riamus2]
|
Hoopy frood
Registered: 07/07/07
Posts: 1129
Loc: United States
|
Pardon me, Riamus2, your example does work. I didn't mean to prove your wrong otherwise.
|
Top
|
|
|
|
#230256 - 02/03/11 10:28 PM
Re: * $input: cannot use in an event
[Re: westor]
|
Hoopy frood
Registered: 07/07/07
Posts: 1129
Loc: United States
|
Did you place a under your sockread event? If the socket has been closed already, the sockclose event won't get triggered.
|
Top
|
|
|
|
#230259 - 02/03/11 10:54 PM
Re: * $input: cannot use in an event
[Re: westor]
|
Hoopy frood
Registered: 07/07/07
Posts: 1129
Loc: United States
|
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
|
Top
|
|
|
|
#230260 - 02/03/11 10:59 PM
Re: * $input: cannot use in an event
[Re: Tomao]
|
Hoopy frood
Registered: 07/07/07
Posts: 1129
Loc: United States
|
.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.
Edited by Tomao (02/03/11 11:01 PM)
|
Top
|
|
|
|
#230261 - 02/03/11 11:01 PM
Re: * $input: cannot use in an event
[Re: Tomao]
|
Hoopy frood
Registered: 27/12/08
Posts: 1511
Loc: Greece
|
i changed the echo with var and not working
.timer 1 1 var %ask $!iif($input(%m,yidb,Information),$!,$!)
%m = my message
Edited by westor (02/03/11 11:02 PM)
|
Top
|
|
|
|
#230262 - 02/03/11 11:08 PM
Re: * $input: cannot use in an event
[Re: westor]
|
Hoopy frood
Registered: 07/07/07
Posts: 1129
Loc: United States
|
//.timer 1 1 echo -a $!iif($input(%m,yidb,Information),$!,$!) Well, I don't know why a variable has to be used...
Edited by Tomao (02/03/11 11:10 PM)
|
Top
|
|
|
|
#230263 - 02/03/11 11:15 PM
Re: * $input: cannot use in an event
[Re: Tomao]
|
Hoopy frood
Registered: 27/12/08
Posts: 1511
Loc: Greece
|
|
Top
|
|
|
|
#230265 - 02/03/11 11:27 PM
Re: * $input: cannot use in an event
[Re: westor]
|
Hoopy frood
Registered: 07/07/07
Posts: 1129
Loc: United States
|
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.
Edited by Tomao (03/03/11 01:14 AM)
|
Top
|
|
|
|
#230269 - 03/03/11 01:42 PM
Re: * $input: cannot use in an event
[Re: westor]
|
Hoopy frood
Registered: 04/01/07
Posts: 1156
Loc: Seattle
|
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.
|
Top
|
|
|
|
#230270 - 03/03/11 02:08 PM
Re: * $input: cannot use in an event
[Re: Tomao]
|
Planetary brain
Registered: 13/10/04
Posts: 8327
Loc: MA, USA
|
@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. .timer 1 1 var %input = $!input(Please click something) Instead, you could use an alias... .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.
Edited by Riamus2 (03/03/11 02:29 PM)
_________________________
Invision Support #Invision on irc.irchighway.net
|
Top
|
|
|
|
#230271 - 03/03/11 02:20 PM
Re: * $input: cannot use in an event
[Re: Riamus2]
|
Hoopy frood
Registered: 27/12/08
Posts: 1511
Loc: Greece
|
@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. .timer 1 1 var %input = $!input(Please click something) Instead, you could use an alias... .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 .timer 1 1 var %input = $!input(Please click something)
Edited by westor (03/03/11 02:25 PM)
|
Top
|
|
|
|
|
|