mIRC Home    About    Download    Register    News    Help

Print Thread
#263131 04/06/18 09:19 AM
Joined: Jun 2018
Posts: 9
B
BRUT Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2018
Posts: 9
Hello,
what is the best simple script to display last X lines of text, that was written in the channel when usind some kind of command like !last15 working with the newest mIRC version?
I have tried a few that i found, but got no luck.

EDIT: Just for sure, I have there mIRC clients connected 24/7, for some other scripts

Last edited by BRUT; 04/06/18 01:13 PM.

admin of http://BRUT.me
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
You can use $line(#channel,N) to access the Nth line in a channel window from your on text event on !last15


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2018
Posts: 9
B
BRUT Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2018
Posts: 9
sorry I am not a skillfull scripter, I do not understand how u mean that.
i just want that everybody, who access some channels, our gaming servers are connected to them, when using a command being able to see last history what was written


admin of http://BRUT.me
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
There's several issues that will control what needs to be done. Is the reply going to be a /notice or a /query directly to the person requesting the 15 lines, or are the 15 lines going to be flooded into channel each time someone does it? Should the 15 lines be parsed to exclude events like join/part/quit/etc? The 15 lines would be from the perspective of whoever is running the script, so if someone sends a /notice to that nick containing objectionable or private content, you'd need to filter that out of the display. Do you want to filter out all/part of the timestamp when displaying the 15 lines?

This snippet sends the last 15 lines of the 1st channel into window @test:

Code:
//window @test | var %a $line($chan(1),0) | if (%a <= 15) var %range 1-15 | else var %range $+($calc(%a -14),-,%a) | filter -ww $chan(1) @test *



If you want to exclude the event non-message lines, you'd need to capture more than 15 so you'd have some extras to compensate for the discarded lines.

Another way to do this is just make a script to monitor the :TEXT: event for that channel, and possibly the :ACTION: event to capture /me message. This method by default would ignore join/part/quit, so if you wanted to add those events, they would also need to be scripted to add displays to @test. The script could echo each nick+message to @test in the format you like, and delete any lines off the top when there's more than 15 lines. Then the script can respond to the !last15 to display the window's contents, without counting that !command as a channel message.

Your script can easily get more complicated if you want to include a bad-word filter that prevents tricksters from getting you banned for using bad words, where 1 nick uses the badword and gets banned, then another nick uses !last15 to make you repeat it and gets you banned too.

Joined: Jun 2018
Posts: 9
B
BRUT Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2018
Posts: 9
Thank You for such a great answer. Firstly I wanted this to be sent to the channel, but to avoid spam, it would be the best to send it directly as a query message to the one who writes !last.
Very good question with the parts, but when I am thinking about it, it is good to have this information in !last too, no exclude of such messages and no exclude of bad words, I do not have any badwords filter on my channels and bad words are reported in the main channel because a lot of times they help to detect a cheater
but if it would send private content too

but one thing that came on my mind now, would it be from all channels where the bot is mixed up, because I would need to have it from one specific channel, where i write !last
not everything what the bot sees, because I have more servers, each has its own channel, and the same mIRC bot is on all channels, dont want to have separate bot for each channel


admin of http://BRUT.me

Link Copied to Clipboard