mIRC Home    About    Download    Register    News    Help

Print Thread
i need help with something else #146072 31/03/06 01:26 AM
Joined: Mar 2006
Posts: 19
A
adamb53 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2006
Posts: 19
my script:

Code:
on *:TEXT:*:#:{
  if ($1 == ) {
    /notice $nick
  }
  else {
    if ($1 == @) {
      /msg $chan
    }
    halt
  }
}


how do i make it so everytime some1 says anything i wont have to put that in, like say i put that, then when some1 says like !clan it brings something up, but then when someone type !links it will bring something else up but using that same code...

Re: i need help with something else #146073 31/03/06 02:24 AM
Joined: Mar 2005
Posts: 420
X
xDaeMoN Offline
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
You almost got it.

Code:
 
On *:TEXT:*:#: {
 if ( $1 == !clan ) {
   your stuff here...
 }
 elseif ( $1 == !links ) {
   your links stuff here...
 }
 elseif ( $1 == @stuff ) {
   your stuff here..
 }
}


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Re: i need help with something else #146074 31/03/06 02:29 AM
Joined: Aug 2004
Posts: 5
V
Vulcan Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
V
Joined: Aug 2004
Posts: 5
though i am not entirely sure what it is your trying to do. i'll show you an easier way to do what you showed atleast.

Code:
on *:TEXT:*:#:{
  set %send.method $iif($left($1,1) == @,msg $chan,notice $nick)
  %send.method whatever you want to be sent out.
}


if your trying to make it do different things. you can put if statements in to check to see if someone said one of the triggerers.

ex.

Code:
on *:TEXT:*:#:{
  set %send.method $iif($left($1,1) == @,msg $chan,notice $nick)
  if ($right($1,1) == links) {
    if ($2 == home) { %send.method http://www.google.com | unset %send.method }
    if ($2 == mirc) { %send.method http://www.mirc.com | unset %send.method }
  }
}


if i completely missed what you were tryin to do im sorry im just a little tired...im just trying to be helpful.

Re: i need help with something else #146075 31/03/06 02:29 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
first off, it's impossible for you to have a match on the on text event without having something in $1, so your first if statement is irrelevant, since it'll never be run (due to the fact that $1 will never be empty & that you have the comparison done incorrectly.

Using the wildcard matchtext, as you currently have it, for multiple possible matches is to have multiple if/elseif/else statements.

You should also give a thorough read of the help file /help if

Re: i need help with something else #146076 31/03/06 04:33 AM
Joined: Mar 2006
Posts: 19
A
adamb53 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2006
Posts: 19
ok well im guessing my code is wrong with what i am trying to do so lemme try to explain it more:

i want it so there is 1 bulk of code in the beggining that says if they have "!" then notice the nick and if it is "@" then msg the chan, and after that jus like have it so it is set to, if the person type the symbole and a word like home, it will do the send type, but after that in the same code make it so if they type the symbole and clan it will send something else in the style types... so i wouldnt have to type something like

on *:TEXT:!clan:#:/notice $nick....
on *:TEXT:@clan:#:/msg $chan...

everytime or have to type something else each time... i want it so ther eis 1 code for multiple words.... i tried the

Code:
on *:TEXT:*:#:{
  set %send.method $iif($left($1,1) == @,msg $chan,notice $nick)
  if ($right($1,1) == links) {
    if ($2 == home) { %send.method http://www.google.com | unset %send.method }
    if ($2 == mirc) { %send.method http://www.mirc.com | unset %send.method }
  }
}  


one but it didnt work

Re: i need help with something else #146077 31/03/06 05:35 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Well, your $right($1,1) only returns the last character from $1, so it'll never be links (which is 5 characters).

You have the right idea for doing the combinations, also, there's no need for the unset commands that you have as %send.method will be set to the new setting next time the command is called.

Re: i need help with something else #146078 31/03/06 05:40 AM
Joined: Mar 2005
Posts: 420
X
xDaeMoN Offline
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
$right($1,1) should be $right($1,-1) then I would suggest using a local variable instead a global so you don't have to unset it everytime.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Re: i need help with something else #146079 01/04/06 03:33 AM
Joined: Mar 2006
Posts: 19
A
adamb53 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2006
Posts: 19
is this right in any way? i cant figure out how to work variables 100% yet...

Code:
/var $msg == {if ($1 == !) /notice $nick }{elseif ($2 == @) /msg #}

Re: i need help with something else #146080 01/04/06 03:39 AM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
var %msg
if ($1 == !) %msg = notice $nick
elseif ($1 == @) %msg = msg $chan


OR

Code:
var %msg = $iif($1 == !,notice $nick,$iif($1 == @,msg $chan))

Re: i need help with something else #146081 01/04/06 04:12 AM
Joined: Mar 2006
Posts: 19
A
adamb53 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2006
Posts: 19
what does $iif mean

Re: i need help with something else #146082 01/04/06 04:16 AM
Joined: Mar 2006
Posts: 19
A
adamb53 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2006
Posts: 19
and how would you use that in the script? like this?:

Code:
on *:TEXT:*:#:{
if ($2 == blah) %msg blah blah


i am still trying to learn all about scripting, i am jumping around a bit but i am getting there

Re: i need help with something else #146083 01/04/06 04:17 AM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
$iif() is a different way if doing an if-else statement:

$iif(<statement>,<what to do if the statement is true>,<what to do if the statement is false>)