my script that I had made is not working and was hoping you could all help me out, This is being used in my Twitch.tv IRC bot, i was hoping to rewrite the users whisper after "42" but $2 is not working for me!
Example: "User1: 42 abc" I whisper another user "Me: you whispered, abc"
Thanks guys! <3
on $*:PARSELINE:in:*WHISPER*42*:{
PRIVMSG #channel /w User1 you whispered, $2.
}
after hours of trying to understand what you have posted try this:
on $*:PARSELINE:in:/NOTICE.+:42/i:{
tokenize 32 $parseline
PRIVMSG #channel /w User1 you whispered, $+($5-,.)
}
only use "$" when there is a regex match on "matchtext"
this PARSELINE event, will look for word "NOTICE" ignoring for case sensitive
if in your network, notice events are known for "whisper" just change the word
in case this doesnt work, please replace your PARSELINE event with this one
on *:PARSELINE:*:*:echo $parsetype $parseline
and paste what you got
Related
in my MIRC script, it is set up to read a text file, in these text files there is the symbol " | " followed by a space on both ends, it seems to read everything before " | " just fine, but cuts it off right at the first space. Any help is appreciated.
I am using
msg $nick $read(test.txt, n, 1)
to read the text file.
EDIT:: I have tried all switches which result in the same thing.
EDIT:: It also tells me in the server window "Unknown Command"
EDIT:: After making a new pastebin uploading script, it still seems to get that issue? It will completely just cut off the rest of the text after a "&" or " | "
The symptoms is matching to a scenario which $read was evaluated to a command and the result will take the separators as set of commands to be executed.
This can be due to aliases or events.
Try the first /play command, which will play the file from the 3rd line to see if it behaving as the line we expect it to be or instead each line as a set of commands, separated by /
Then perform the 2nd /play command to view how it should been send to the server.
This is design to see where the problem lie.
/play -axl3 echo test.txt
/play -exl3 test.txt
The output should be the same and as we expect it with the line being displayed including |.
This will make sure the problem is to blame upon other corrupt aliases or events.
We will perform the following and after each step you will test you code to see if it was solved.
Test to see if it an alias named msg hurt you, by converting your script command to /!msg $nick$read(test.txt, n, 1).
Check for dangerous events such as the infamous INPUT or the rising bandit PARSELINE by disabling them.If the problem solved then return the events one by one the find the problematic event and fix it.
Due to the lack of a responses/answers, I was unable to solve it, I have made a makeshift fix for this issue by using
play -xl# $nick test.txt
rather than
msg $nick $read(test.txt, n, 1)
I had almost the same problem and was able to solve it, using the same solution, try this:
Your previous script was: msg $nick $read(test.txt, n, 1)
Now remove the 'msg $nick' and add that to the beginning of every line in the text.txt file with a space between 'msg $nick' and the rest of the line, i.e : msg $nick Hey I see you are back | msg $nick Missed You!
Then your script becomes: $read(test.txt, p)
^^ Hope that makes sense, but I found the original issues was Double Evaluation hence why sometimes you would see the error: Unknown Command or something along those lines.
I use MIRC and this is my goal, i'm sure it's simple! thanks guys.
on $*:text:*test*:#: { msg $chan "Entire message containing test" }
You dont need the $ after the on, it's only used when you use regex to match (see here).
And indeed it's quite simple, use $1- to match he whole message. $1 will match the first 'token'.
In your example sentence Entire message containing test, $1 will rerturn Entire assuming you did not use a tokenize before and because the default delimiter is a space in mSL. $2 will retrurn message and so on.
Here is a great article about token manipulation and in your mIRC client you can use the command /help $1- to learn more about remote identifiers.
I've looked at all the similar questions on Stack Overflow, and tried a bunch of stuff in their documentation. My present attempt is below.
What I'm trying to accomplish is differential behavior based on the computer user. I have a work computer and a home computer, and I want the work computer to go to a different directory when I enter "code" into the command line than the one I want when I enter it at home. I tried this (my work username is afk, home is sfk):
function code
set result (dirh)
if [contains "sfk" $result]
cd ~/rails
else if [contains "afk" $result]
cd ~/code
else
echo $result
end
end
Currently, this is griping that "Unknown command contains Users/sfk/.config/fish/" (My PWD is Users/sfk/.config/fish/ when I'm entering this). I think maybe contains is just for lists, but the docs aren't particularly clear about this? Any idea how I might do this?
EDIT
Just tried this, and while it no longer errors, it ends up in the else case, which it shouldn't, cause my user IS sfk, which IS included in the dirh string:
function code
set result (dirh)
if test (contains "sfk" $result)
cd ~/rails
else if test (contains "afk" $result)
cd ~/code
else
echo $result
end
end
As said above in the comments, that is the best solution for this specific use case. But to answer the question in case someone wants to do something else.
You are right about contains, that it does an exact match on list items. You could use the switch function instead. Which supports wild-card matching.
function code
set -l result (dirh)
switch $result
case '*sfk*'
cd ~/rails
case '*afk*'
cd ~/code
case '*'
echo $result
end
end
I've noticed a big lack in documentation from mIRC scripting abilities so I apologize if I've missed something but I've been searching everwhere.
Basically, I have an on event when someone says something, I need to get there entire message, how is this possible? I've managed to discover $1- however this only grabs the text from what the event triggered from to the end, I need the entire message, is this possible?
This is actually pretty simple, although maybe you're on an earlier version of mirc, if the documentation is lacking:
on *:TEXT:*I need help with*:#channel: {
msg $chan $1-
}
$1- will always contain the full message. $# are space-delimited identifiers, so if your message is john: I need help with etc, $1 will contain john:, and $2 will contain I, and so on and so-forth. Adding the dash means 'this and everything onwards'. Since your match text is 'everything before I need help with and everything after, this code will always contain the full text.
The code above, in case it is not obvious, will message the channel the event triggered on with the full message text. Whatever you do with the text is up to you; it's just an example.
/dbg
alias dbg {
if !$debug { debug -i d dbg }
if $regex($1-,/.+!.+#.+.PRIVMSG.#.+:.+/g) {
echo 4 -s $*
}
}
$1- or $1
I have $_SERVER['DOCUMENT_ROOT'] echoed, the problem is when it is echoed from xampp it shows, like this:
C:/xampp/hdocs
and when echoed from PHPed it shows
C:\\xampp\\htdocs.
I want to replace "C:\\xampp\\htdocs" with "C:/xampp/hdocs" but I'm not able to do so using preg_replace.
Kindly help me !
You don't need regex for that. Use the str_replace() fnction:
str_replace('\\', '/', $str);