mIRC Home    About    Download    Register    News    Help

Print Thread
#67291 10/01/04 10:04 AM
Joined: Jan 2004
Posts: 2
S
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Jan 2004
Posts: 2
Is there a way to use the on text command with a variable and pass it to the $read command so it will use a wildcard search to search for the variable.

something like this is what i was toying with. but i think its all wrong.

on *:Text:!P $1:#:{
/msg $chan #HelloMe $read(hello.txt, w, *$1*, T)
}

!P is the command and $1 is the variable they will be entering for it to search for.

any suggestions?? One would think this would work, im not really to famillar with mIRC's scripting.

Thanks.

#67292 10/01/04 10:11 AM
Joined: Nov 2003
Posts: 228
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Nov 2003
Posts: 228
Code:
on *:TEXT:!P [color:red]*[/color]:#: {
  msg $chan #HelloMe $read(hello.txt,[color:red] wt, $+(*,$$1,*)[/color])
}

#67293 10/01/04 10:36 AM
Joined: Jan 2004
Posts: 2
S
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Jan 2004
Posts: 2
thanks but theres a prob. when i type in the command and the thing im searching for all it replies with is "#HelloMe" in the channel. when i remove #hellome from the script it does nothing.

on *:TEXT:!P *:#: { msg $chan #HelloMe $read(hello.txt, wt, $+(*,$$1,*))}

#67294 11/01/04 01:16 AM
Joined: Nov 2003
Posts: 228
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Nov 2003
Posts: 228
If you want it to only echo to the channel #HelloMe, remove the $chan, otherwise remove the #HelloMe. I don't see why removing either of them should affect the code other that where the result is displayed.

#67295 11/01/04 06:44 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
on *:TEXT:!P &:#: /msg $chan $read(hello.txt, w, $+(*,$2,*))

Just for the break down:
--
The * in the "!P *" means it is looking for a parameter. Each word in mirc events are sybolized with the identifiers $1, $2, $3, ... etc. For example, if you used:

on *:TEXT:!P*:#:
It could catch !Play, !poke, !and even just !P. The * means any character, including nothing. You may also use a & to mean a whole word. ex:

on *:TEXT:!P &:#:
That means its looking for just one value after the !p. So in this case, your first "Word" if you will (or value) is $1. Your secon is $2, which is the value you are looking for.

After that we use $+(*,$2,*) to surround the value of $2 with a set of asterisks. mIRC understands identifiers as indiviual values, and cannot be "mixed". I.e. $nick. would need to be either $nick $+ . or $+($nick,.)

Hopefully that gives you a better understanding of how it works, rather than just feeding you the information and you use it and learn nothing from it. On a final note, if you want that command to only work with one channel, change the # in the on *:TEXT:!P &:#: part to the name of your channel.


-KingTomato

Link Copied to Clipboard