mIRC Home    About    Download    Register    News    Help

Print Thread
#129030 01/09/05 08:37 AM
Joined: Sep 2005
Posts: 5
K
krisd Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Sep 2005
Posts: 5
any help is appreciated.

e.g. <nick> dog chased cat.CAT-cat but lost it

here's the remote code for on text trigger

on *:text:*dog*cat*:#pets:{

on above i want to strip text cat.CAT-cat and put it in a variable "animal" to call it in the command using variable "animal".

how do i do that

thanks

#129031 01/09/05 09:44 AM
Joined: Jul 2005
Posts: 25
U
Ameglian cow
Offline
Ameglian cow
U
Joined: Jul 2005
Posts: 25
My eng. is very bad,i don't understand you, but i hope this code is right code confused :tongue:

Code:
on ^*:text:*:#pets:echo #pets $+(&lt;,$nick,&gt;) $animal($1-) | haltdef
alias animal {
  var %i = $gettok(%animals,0,44),%m = $strip($1-)
  while (0 &lt; %i) {
    if ($istok(%m,$gettok(%animals,%i,44),) set %m $replace(%m,$gettok(%animals,%i,44),Animal!)
   dec %i
  }
  return %m
}
alias ani.add {
 var %k = %animals
 set %animals $addtok(%k,$1,44)
}
alias ani.del {
  var %k = %animals
  set %animals $remtok(%k,$1,44)
}


to add: /ani.add "animal" (e.g: /ani.add cat )
to del: /anidel "animal" (e.g: /ani.del dog )

#129032 01/09/05 03:42 PM
Joined: Sep 2005
Posts: 5
K
krisd Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Sep 2005
Posts: 5
thanks for helping much appreciated.

what i want is

<nick> where is cat.dog.buffalo says krisd
<nick> where is mouse.pig.snake says krisd
<nick> where is horse.cow.elephant says krisd

now on text "where" i want to assign the word before "says" to a variable "animal" and use %animal..

words before "says" are in this case
1 cat.dog.buffalo
2.mouse.pig.snake
3. horse.cow.elephant

it could be any word before "says"
thank you.

#129033 01/09/05 05:10 PM
Joined: Jul 2005
Posts: 25
U
Ameglian cow
Offline
Ameglian cow
U
Joined: Jul 2005
Posts: 25
is this?
Code:
on *:text:*says*:*:var %k %animals | set %animals $addtok(%k($gettok($1-,$calc($findtok($1-,says,1,32) - 1),32),32)

#129034 01/09/05 06:28 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try this:

Code:
on *:text:where *:*: {
  if ($istok($1-,says,32)) {
    set %animal $gettok($1-,$calc($findtok($1-,says,32) - 1),32)
  }
}


That will store whatever "word" (anything separated by spaces is a word in this case) is before "says" into %animal. It will set the variable as long as the first word is "where" and if "says" is a word in the sentence.

If you need help doing something with multiple animals, like you showed, after the variable is set, just ask.


Invision Support
#Invision on irc.irchighway.net
#129035 03/09/05 01:28 AM
Joined: Sep 2005
Posts: 5
K
krisd Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Sep 2005
Posts: 5
thank you works very nicely

but when i use this format

<nick> where is buffalo.dog.cat/cat.dog.buffalo says krisd

it returns the complete string buffalo.dog/cat.dog.buffalo

i want to be able to get the 2nd one i.e. cat.dog.buffalo after /

Also how to get one word after says to put in variable

%seeker

Thank you again

#129036 03/09/05 11:03 AM
Joined: Jul 2005
Posts: 25
U
Ameglian cow
Offline
Ameglian cow
U
Joined: Jul 2005
Posts: 25
you can use $gettok() ...

$gettok(buffalo.dog/cat.dog.buffalo,2,47) returns cat.dog.buffalo

#129037 03/09/05 12:24 PM
Joined: Sep 2005
Posts: 5
K
krisd Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Sep 2005
Posts: 5
need to get it dynamicly like Riamus2 above.

his code works great.

just need the above to complete

Thanks

#129038 03/09/05 12:40 PM
Joined: Jul 2005
Posts: 25
U
Ameglian cow
Offline
Ameglian cow
U
Joined: Jul 2005
Posts: 25
Code:
on *:text:where *:*: {
  if ($istok($1-,says,32)) {
    set %animal $gettok($gettok($1-,$calc($findtok($1-,says,32) - 1),32),2,47)
  }
}

Last edited by UOnur; 03/09/05 12:41 PM.
#129039 06/09/05 12:19 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
And, to get your word after "says":

Code:
on *:text:where *:*: {
  if ($istok($1-,says,32)) {
    set %animal $gettok($gettok($1-,$calc($findtok($1-,says,32) - 1),32),2,47)
    set %seeker $gettok($1-,$calc($findtok($1-,says,32) + 1),32)
  }
}


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard