|
dragonslayere
|
dragonslayere
|
what wrog with this? it suppose to replace every o with a 0.. i always get O Unknown command ------------------------------------------------------------------------ on *:INPUT:*:{ if ( o isin $1- ) { $replace(o,$1-,msg $chan u) halt }
|
|
|
|
Joined: Dec 2002
Posts: 3,015
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,015 |
It would be easier to help if you said what you were trying to do...(you said you wanted to replace o with 0, but what do you want to do with the text you get?) $replace is used like this: I want to replace the e in the word hello with the letter b, so I use this: //echo -a $replace( hello, e, b) on *:INPUT:*: {
if ( o isin $1- ) {
msg $active $replace($1-,o,0)
halt
}
} ^I think that will do what you are trying to.
|
|
|
|
Joined: Dec 2002
Posts: 270
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 270 |
Yeah, but the way i see it, you will have a problem, unless you are already aware of it....but:
on *:input:*:{ if (o isin $1-) { msg $chan $replace($1-,o,0) halt } }
will only send the message IF there is an o within the text, otherwize, the message will never get sent...... you dont need an if condition at all in that:
on *:input:*:{ msg $chan $replace($1-,o,0) }
$replace will be called, and replace only the o's with a 0 , and return everthing else the way it was, and if there are no o's in the text, it will return text exactly, the other way only preformed the /msg IF there was an o in text, dunno if you were 100% aware of this or not, but thought i'd let you know anyway
|
|
|
|
Joined: Dec 2002
Posts: 3,015
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,015 |
You are right that the if statement is not needed, but you are wrong that messages not containing a o will not be sent - the /halt is done only is there is a o in the text, and it is to stop 2 messages being sent (1 message with the replaced text, 1 without) - the /halt will not be done for messages without a so those messages will be sent as normal. In your script there are 2 problems: 1. All of your messages will be sent twice - once with the "o"s replaced, once without. 2. This code: on *:input: *:{ msg $chanWill not work in a query, because $chan will be $null - that is why I used $active. Both of our scripts have 1 flaw though - /commands are filtered too - they shouldn't be. on *:input:*:{
if ( $left($1,1) != / ) {
msg $active $replace($1-,o,0)
halt
}
}
|
|
|
|
Joined: Dec 2002
Posts: 270
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 270 |
lol, yeah ur right, wasn't thinkin of /commands at the time, details :P
|
|
|
|
dragonslayere
|
dragonslayere
|
on *:input:*:{ if ( $left($1,1) != / ) { msg $active $replace($1-,o,0) halt } } --------------------------------------------------------------------------
k it replace the leter but it says halt after it and it repeats the text in unreplaced form too
<q[o_O]p> 00 halt <q[o_O]p> oo <q[o_O]p> 00 halt <q[o_O]p> oo <q[o_O]p> s0 halt <q[o_O]p> so <q[o_O]p> Oh <q[o_O]p> 0 halt <q[o_O]p> s0s halt <q[o_O]p> sos <q[o_O]p> 0s halt <q[o_O]p> os <q[o_O]p> asasa halt <q[o_O]p> asasa <q[o_O]p> sad halt <q[o_O]p> sad
|
|
|
|
Joined: Dec 2002
Posts: 3,015
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,015 |
You have to put in the new lines like it shows it on the forums. I.e on *:input:*:{
if ( $left($1,1) != / ) {
msg $active $replace($1-,o,0)
halt
}
} not on *:input:*:{ if ( $left($1,1) != / ) { msg $active $replace($1-,o,0) halt } }
|
|
|
|
dragonslayere
|
dragonslayere
|
k it works but now how to i make it so it can can more then one letter? cause this won't work --------------------------------------------------------------------------
on *:input:*:{ if ( $left($1,1) != / ) { msg $active $replace($1-,o,0) halt } if ( $left($1,1) != / ) { msg $active $replace($1-,w,\/\/) halt } } -------------------------------------------------------------------------
|
|
|
|
Joined: Dec 2002
Posts: 395
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 395 |
on *:input:*:{
if ($left($1,1) != /) {
msg $active $replace($1-,o,0,[color:green]w,\/\/[/color],[color:blue]e,3[/color],[color:purple]s,5[/color])
halt
}
|
|
|
|
dragonslayere
|
dragonslayere
|
ok thnx now one more thing how do i how can i replace words just words and not letters?
ex: "i am in pian" should come out "ich bin in pain"(w/e the german word is)
and not "ich bin ichn pichan"
the ich replaces evey "i"
|
|
|
|
Joined: Dec 2002
Posts: 270
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 270 |
$replace($1-,i am a pain,ich bin in pain)
|
|
|
|
dragonslayere
|
dragonslayere
|
$replace($1-,i am a pain,ich bin in pain) _________________________________________________
i know that i can do that but what i want to know was how i can do an identifer to see if the the word being replace by itself and reither or not to do the replace..
ex: if i type "i am in" it would replace the "i" because its by itself and not the i in "in"
|
|
|
|
Joined: Dec 2002
Posts: 698
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 698 |
on *:input:*:{
if (/* iswm $1) || !$ctrlenter { return }
var %a = $1-
while $istok(%a,i,32) { %a = $reptok(%a,i,ich,1,32) }
while $istok(%a,am,32) { %a = $reptok(%a,am,bin,1,32) }
;and so on ...
msg $active %a
halt
}
|
|
|
|
dragonslayere
|
dragonslayere
|
|
|
|
|
Joined: Dec 2002
Posts: 698
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 698 |
Yep, sorry, replace this line if (/* iswm $1) || $ctrlenter { return }
|
|
|
|
|