|
Joined: Sep 2005
Posts: 5
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
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
|
|
|
|
Joined: Jul 2005
Posts: 25
Ameglian cow
|
Ameglian cow
Joined: Jul 2005
Posts: 25 |
My eng. is very bad,i don't understand you, but i hope this code is right code :tongue: on ^*:text:*:#pets:echo #pets $+(<,$nick,>) $animal($1-) | haltdef
alias animal {
var %i = $gettok(%animals,0,44),%m = $strip($1-)
while (0 < %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 )
|
|
|
|
Joined: Sep 2005
Posts: 5
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
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.
|
|
|
|
Joined: Jul 2005
Posts: 25
Ameglian cow
|
Ameglian cow
Joined: Jul 2005
Posts: 25 |
is this? on *:text:*says*:*:var %k %animals | set %animals $addtok(%k($gettok($1-,$calc($findtok($1-,says,1,32) - 1),32),32)
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Try this:
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
|
|
|
|
Joined: Sep 2005
Posts: 5
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
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
|
|
|
|
Joined: Jul 2005
Posts: 25
Ameglian cow
|
Ameglian cow
Joined: Jul 2005
Posts: 25 |
you can use $gettok() ...
$gettok(buffalo.dog/cat.dog.buffalo,2,47) returns cat.dog.buffalo
|
|
|
|
Joined: Sep 2005
Posts: 5
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Sep 2005
Posts: 5 |
need to get it dynamicly like Riamus2 above.
his code works great.
just need the above to complete
Thanks
|
|
|
|
Joined: Jul 2005
Posts: 25
Ameglian cow
|
Ameglian cow
Joined: Jul 2005
Posts: 25 |
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.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
And, to get your word after "says": 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
|
|
|
|
|