mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
I can't solve this.
please help.

Code:
 
on *:chat:*:{
if (.settrivchan == $strip($1)) {
    if ($right($strip($1),-1) != settrivchan) { msg =$nick Please use 4.settrivchan #chan to set or add a trivia channel to the bot | halt }
    if ($chr(35) !isin $2) { msg =$nick Please use 4.settrivchan #chan to set or add a trivia channel to the bot | halt }
    if ($me !ison $2) { msg =$nick Please make sure I am present in $2 $+ , else you cannot add that channel to the bot | halt }
    var %toadd = $2
    chan.add %toadd
    halt
  }
  if (.setpoint == $strip($1)) { etc etc etc and so the if's go on for a while
 


I had hoped that
Code:
 if ($right($strip($1),-1) != settrivchan)  

would do somekind of checking to see if the command is spelled right.
But it doesn't.
Can anyone tell me what i'm doing wrong ?
and perhaps do it right with a litlle explaining.

Thank you and Greetzz

Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Well, if you want to see if it's spelled right then you should use == and not != :tongue:

Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
Seemt to me I start the code with that.
Code:
 if (.settrivchan == $strip($1)) { 

That is for openening.
Now I want to check if settrivchan is spelled correct and ifnot send a msg how to use the command.
The command starts with a . so i thought that on .settrivchan
Code:
 if ($right($strip($1),-1) != settrivchan) 

would check that.
Perhaps it needs a else or a elseif

Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
Is it possible to let the . be $1 and settrivchan be $2.
But let the command givin be one whole word like .settrivchan
That would make it possible to check $2 (settrivchan)
somewhere in the you then can have:
Code:
 if ($strip($2) != settrivchan) { bla bla } 

I have no idea howto do that.
Perhaps somehow use $+ or [ $+ [ bla bla ]]
I also tryed something like:

Code:
 on *:chat:*:{
 if ($left($strip($1),1) == $chr(46)) {
    if ($right($strip($1),-1) == settrivchan) {
    if ($right($strip($1),-1) != settrivchan) || ($chr(35) !isin $2) { msg =$nick Please use 4.settrivchan #chan to set or add a trivia channel to the bot | halt }
    if ($me !ison $2) { msg =$nick Please make sure I am present in $2 $+ , else you cannot add that channel to the bot | halt }
    var %toadd = $2
    chan.add %toadd
    halt
   }
  }
  if (.setpoint == $strip($1)) { etc etc etc and so the if's go on for a while

but i still can't figure it out.

Joined: Jul 2006
Posts: 13
M
Pikka bird
Offline
Pikka bird
M
Joined: Jul 2006
Posts: 13
hmm?

Explain what you exactly want it to do, and i see if i can help you with some other kind of setting it...


I dont get what you're trying to do...


mark

Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
Code:
on 1:text:?: {
if ( .settrivchan isin $1 ) && ( $me isin $2 ) { 
noop $addtok(%trivchans,#$2,32)
msg $nick #$2 added to channels 
}

elseif ( $me !isin $2 ) { msg $nick hell no! }
}


somethin like that?

btk

Last edited by billythekid; 13/07/06 01:54 PM.

billythekid
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Why not just take advantage of the text match in the event?

Code:
on *:CHAT:.settrivchan:{
  if ((#* iswm $2) && ($me ison $2)) chan.add $2
  else msg =$nick Please make sure I am present in $2 $+ , else you cannot add that channel to the bot 
}

on *:CHAT:.setpoint:{
  if ((#* iswm $2) && ($me ison $2)) ;do stuff
  else ;do other stuff
}

;more onCHAT events here

;this event goes last, all events must be in the same file for this to work
on *:CHAT:*: msg =$nick That is not a valid command


-genius_at_work


Link Copied to Clipboard