mIRC Home    About    Download    Register    News    Help

Page 1 of 2 1 2 >
Topic Options
#230249 - 02/03/11 09:54 PM * $input: cannot use in an event
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
Hello,

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

- Thanks!
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#230250 - 02/03/11 10:10 PM Re: * $input: cannot use in an event [Re: westor]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, 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...

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

Top
#230251 - 02/03/11 10:14 PM Re: * $input: cannot use in an event [Re: Riamus2]
Tomao Offline
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
#230252 - 02/03/11 10:20 PM Re: * $input: cannot use in an event [Re: Riamus2]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
if i wanna do this?

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

does not work on sockclose event!
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#230253 - 02/03/11 10:21 PM Re: * $input: cannot use in an event [Re: westor]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
You can also do is as:
Code:
//.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]
Tomao Offline
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
#230255 - 02/03/11 10:26 PM Re: * $input: cannot use in an event [Re: Tomao]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
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


Edited by westor (02/03/11 10:26 PM)
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#230256 - 02/03/11 10:28 PM Re: * $input: cannot use in an event [Re: westor]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.

Top
#230257 - 02/03/11 10:32 PM Re: * $input: cannot use in an event [Re: Tomao]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
no i haven't put an /sockclose command into the sockread just /sockmark
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#230258 - 02/03/11 10:37 PM Re: * $input: cannot use in an event [Re: westor]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
how can i make it work the sockclose event with the /var, ?


Edited by westor (02/03/11 10:38 PM)
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#230259 - 02/03/11 10:54 PM Re: * $input: cannot use in an event [Re: westor]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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

Top
#230260 - 02/03/11 10:59 PM Re: * $input: cannot use in an event [Re: Tomao]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.


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]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
i changed the echo with var and not working
Code:
    .timer 1 1 var %ask $!iif($input(%m,yidb,Information),$!,$!)


%m = my message


Edited by westor (02/03/11 11:02 PM)
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#230262 - 02/03/11 11:08 PM Re: * $input: cannot use in an event [Re: westor]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
Code:
//.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]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
* Invalid format: $iif
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#230264 - 02/03/11 11:21 PM Re: * $input: cannot use in an event [Re: westor]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
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!
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#230265 - 02/03/11 11:27 PM Re: * $input: cannot use in an event [Re: westor]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.


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]
DJ_Sol Offline
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]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, 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.
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.


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]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
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)


Edited by westor (03/03/11 02:25 PM)
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
Page 1 of 2 1 2 >