mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2010
Posts: 5
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Aug 2010
Posts: 5
is there any way to trigger your own on :text:/:action: etc scripts? For example I have:
Code:
on *:TEXT:trigger:#Channel: {
  if ($nick == mynick) away $2-
}


and want to be able to say trigger and have the script react.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Code:
on *:INPUT:#:{
  if ($1 == trigger) { do stuff }
}

Last edited by FroggieDaFrog; 26/08/10 05:38 AM.

I am SReject
My Stuff
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
I was told that it's more efficient using an alias than an input event for what you're trying to do:
Code:
alias trigger {
 away $$1
}

Joined: Aug 2010
Posts: 5
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Aug 2010
Posts: 5
a simple away script isn't all I'm trying to do, but thanks for the above *:INPUT: help, very useful smile

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It's extremely rare and you really want to trigger something via ON INPUT. You're much better off using a /command to trigger an action from the client; it's cleaner, faster and much easier to maintain.

Why exactly is using an alias not sufficient?


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
If you're using a script that runs commands for other users, like !roll or something, and you want to use it yourself in the same way as others do, it's best to have an alias that handles the action, and trigger both on ON TEXT and ON INPUT.

Code:
on *:text:!rol*:#: if $1 == !roll { roll $nick $2- )
on *:input:!rol*:#: if $1 == !roll { roll $me $2- )

roll .timer 1 0 msg $chan $1 rolled 1d20 and got $rand(1, 20)


That's assuming you want to use it as a visible command. If you do not, an alias is cleaner.


Learning something new every day.

Link Copied to Clipboard