mIRC Home    About    Download    Register    News    Help

Print Thread
#135140 08/11/05 12:00 PM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
i made this for my bot,

on 666:text:!readlog*:#:/play $nick $mircdir\logs\ $+ $2 1500

what i wanted to do here is when i type "!readlog AnyLogName.txt" bot will play a log file for me or user with level 666
from my main mirc folder in my logs folder but it didn't work.

if it can be done, can i make the bot play 20 lines at the most from a log file *recent msgs*? or say a log file has 100 lines is it possible
to make the bot play which ever 20 lines out of 100 on my own picking?

Last edited by Confuzzled; 08/11/05 12:01 PM.
#135141 08/11/05 12:41 PM
Joined: Nov 2005
Posts: 3
E
Self-satisified door
Offline
Self-satisified door
E
Joined: Nov 2005
Posts: 3
Try this:

Code:
on 666:text:!readlog *:#: {
  play $nick $+($mircdirlogs,$chr(92),$2)) 1500
}
 

#135142 08/11/05 02:01 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Your main problem, I think, is your use of \ after $mircdir. $mircdir and $scriptdir automatically come with a \ at the end. So, c:\mirc\testing\test.txt would be $mircdirtesting\test.txt (notice no \ between $mircdir and testing). It looks weird, but it is correct. If you prefer not to see it look like that, you can combine them with $+()... $+($mircdir,testing\test.txt). If that makes it easier for you to read your script, go for it. smile

The best way to make /play stop after X lines would be to play it through an alias...

Code:
on 666:text:!readlog *:#: {
  unset %playlog.cnt
  var %starting.position = 1
  var %starting.position = $3
  play -af $+ %starting.position playlog $nick $mircdirlogs\ $+ $2 1500
}

alias playlog {
  inc %playlog.cnt
  msg $1-
  if (%playlog.cnt >= [color:red]20[/color]) { play stop | unset %playlog.cnt }
}


That will do what you wanted. Change the red 20 to however many lines you want it to display.

USE:
!readlog filename starting_line_number

EXAMPLE:
!readlog recent.log 15

Note that the starting line number is optional. It will default to 1 if left blank.

==========

Oh, and Emilo... You have an extra ). You also don't need to use $chr for the \.


Invision Support
#Invision on irc.irchighway.net
#135143 09/11/05 09:42 AM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
it don't work,

* /play: unable to open 'C:\mymirc\logs\#roomname.network.net.txt' (line 5, script2.mrc)

on 666:text:!readlog *:#: {
unset %playlog.cnt
var %starting.position = 1
var %starting.position = $3
play -af $+ %starting.position playlog $nick $mircdirlogs\ $+ $2 1500
}

alias playlog {
inc %playlog.cnt
msg $1-
if (%playlog.cnt >= 20) { play stop | unset %playlog.cnt }
}

maybe /play command won't work on active logs? cause i have mine enabled just so it catched everything that's happening in the channel, or i don't know i've been trying for quite a while now, i never did find a way to do this...

Last edited by Confuzzled; 09/11/05 09:46 AM.
#135144 09/11/05 12:41 PM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
nvm it works perfect huge thanks

#135145 09/11/05 01:58 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Enter the wrong log name?


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard