mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Hello,

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

- Thanks!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
$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
Joined: Jul 2007
Posts: 1,129
T
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.

Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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? -> https://irc.chathub.org <-
Joined: Jul 2007
Posts: 1,129
T
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.
Joined: Jul 2007
Posts: 1,129
T
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.

Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2007
Posts: 1,129
T
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.

Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
no i haven't put an /sockclose command into the sockread just /sockmark


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
how can i make it work the sockclose event with the /var, ?

Last edited by westor; 02/03/11 10:38 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2007
Posts: 1,129
T
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

Joined: Jul 2007
Posts: 1,129
T
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.
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2007
Posts: 1,129
T
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.
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
* Invalid format: $iif


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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? -> https://irc.chathub.org <-
Joined: Jul 2007
Posts: 1,129
T
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.
Joined: Jan 2007
Posts: 1,156
D
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.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
@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
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Page 1 of 2 1 2

Link Copied to Clipboard