Skip to content
General IRCd

Another N00b Question From Me

A TG007 community discussion started by Daniel_gr.

Discussion 21 posts
Page 1 of 2
Open
Topic #9694 · 21 published posts · 6,399 views

heres another on text question for you

 

heres the sentence

<+FFBot> [New Shit] blah blah blah

 

the [New Shit] part is the only constant

i tried isin , i tried iswm.

either im doing something wrong or the [ is throwing me off

i just want a trigger to activate on the new shit part so i can echo it to another window

 

edit: the full format is in the form of [New Shit] name [description] @ link

i asume i have to learn regex to get the seperate parts of the sentence so i can store am in a dbase or hash table i asume??

Edited Feb 19, 2008 10:23 AM by Daniel_gr

did you try with $chr(91) and $chr(93) ?

i tried that, but i think im doing something wrong

i kept getting this error : * /if: insufficient parameters

so i gave up for now till i have more time. or a better suggestion

you need to use the $chr for [ and ]

 

if ($chr(91) $+ * $+ $chr(93) iswm $1-)

 

 

etc

My code does NOT have bugs. It just develops random features.

you need to use the $chr for [ and ]

 

if ($chr(91) $+ * $+ $chr(93) iswm $1-)

 

 

etc

I think Ozzy is poised for a mIRC comeback! :P:offtopic:

i certainly hope so, i can use an insomniac that i can bug often :P

 

 

ill try the code later, as im off for food etc now

why don't you post your code ?

 

im going to feel real stupid i bet.

 

my code :

on *:text:*:* {
if ($chr(91) $+ * $+ $chr(93) iswm $1-)
echo @info $1-
}

 

the error:

* /if: insufficient parameters (line 2, script2.mrc)

 

im probably doing something reall easy, wrong

 

you need to put the echo on the same line.

 

If you actually enclosed your commands in brackets this would have been pretty apparent.

 

You were also missing the last colon in the on event.

 

if (this matches) { do this }

 

on *:text:*:*:{
if ($+($chr(91),*,$chr(93),*) iswm $1-) { echo @info $1- }
}

you need to put the echo on the same line.

 

If you actually enclosed your commands in brackets this would have been pretty apparent.

 

You were also missing the last colon in the on event.

 

if (this matches) { do this }

 

on *:text:*:*:{
if ($+($chr(91),*,$chr(93),*) iswm $1-) { echo @info $1- }
}

 

told you guys i was gona feel real stupid

ok. so im not really well at the moment and cant really concentrate..

 

thanks all you guys, it works now

 

now off to learn regex to catch the specific parts of that line :P

 

edit: i had a friend say those lines for testing purpose. and it worked fine.

however when the bot finally came with a line it didnt work.

is it possible that the color makes it not work?? the bot uses red text for the "[New Shit] part, and other colors for the other parts

Edited Feb 19, 2008 9:17 PM by Daniel_gr

It should work fine. If it still gives you the insufficient parameters error, add else halt to it.

It should work fine. If it still gives you the insufficient parameters error, add else halt to it.

 

it works fine, when someone else says the trigger,

but when the bot says it it doesnt respond

only difference between the 2 is is that the bot uses a red color.

 

and i changed the * in the if for 'New Shit' (without the ' ) cause there are some other responses on the server that use []

Tools > Options > IRC menu > Messages submenu > Strip codes from bold and color.

 

Just a wild guess.

 

Also, for the server messages that come in, this might work

on *:text:*:*:{
if ($+($chr(91),*,$chr(93),*) iswm $1-) && ($nick == FFBot) { echo @info $1- }
}

Edited Feb 19, 2008 11:46 PM by X-Fusion

You dont see your own text.

Huh?

it works fine, when someone else says the trigger,

but when the bot says it it doesnt respond

 

You dont see your own text.
Edited Feb 20, 2008 2:59 AM by Travis

the bot is not me.

if i was the bot. i would have had it echo to the info screen at the same time id send the msg :P

 

i added your code btw, and tried with the old one: it picks up on texts that look like this : [ blah blah blah]

but somehow it still doesnt pick up on the [New Shit]

 

only difference i see between what it picks up and what it doesnt is the space between [ and the text

Edited Feb 20, 2008 8:22 PM by Daniel_gr
you need to use the $chr for [ and ]

 

if ($chr(91) $+ * $+ $chr(93) iswm $1-)

 

 

etc

 

No you don't.

 

//if ([*] iswm [x]) { echo -a WEJKDIKSDJH }

from mirc help file

The [ ] evaluation brackets

 

If you want greater control over the order of evaluation of identifiers, you can use the [ ] brackets. Identifiers within these brackets will be evaluated first, from left to right. You can nest brackets.

 

/say % [ $+ [ $1 ] ]

 

You can also force a previously evaluated identifier to be re-evaluated by using extra [ ] brackets.

 

/set %x %y

 

/set %y Hiya!

 

/echo [ [ %x ] ]

 

this is why you need to use chr codes

 

if ($chr(91) $+ * $+ $chr(93) iswm $1-)

 

or someone could slip in some code into an echo (not in this case)

 

so its good practice to use the $chr when you dont want to use the [ ] evaluation brakets

 

My code does NOT have bugs. It just develops random features.

I have found I only need to use the $chr for the opening bracket.

 

menu item $chr(91) * ]:command