|
| Author |
Message |
weizbox Newbie

Joined: 31 Mar 2005 Posts: 4
 
|
Posted: Thu Mar 31, 2005 8:17 pm Post subject: |
|
|
Hi everyone, Im pretty new to perl, and as well, bots. I was wondering what would be the best method for an aimbot to read a text file, and basicly know when it has changed, and on change then react to it (I know enough perl to do the reaction part). I downloaded the base bot, and have gotten it to do things such as reply and whatnot, but Im trying to get it to trigger on another program of mine that writes to a text file, and when this occurs, find a username in teh text file, accociate username with aim sn, and message user with some of the info in the file that just changed. As far as getting the info out of the file and comparing against a list to see what they're screen name is, I think I can do. The part I dont know about is to know when a file has been modified (overwritten by the other app). This change can occur whenever, theres no set time... so I was thinking of something along teh lines of checking every second or so to see if theres a change. Any ideas of links to put me in the right direction?
Many Thanks, Weizbox  |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Thu Mar 31, 2005 10:12 pm Post subject: |
|
|
To get the last modified time of a file, do:
| Code: | | $modified = stat($filename)[9]; |
So like...
| Code: | | # Starting point.<br />my $modified = stat('file.txt')[9];<br /><br />#..... file is modified .....<br /><br /># See if the file is modified.<br />if (stat('file.txt')[9] > $modified) {<br /> # do stuff<br />} |
_________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
weizbox Newbie

Joined: 31 Mar 2005 Posts: 4
 
|
Posted: Thu Mar 31, 2005 11:01 pm Post subject: |
|
|
Ah, thank you... but any idea where in the basebot this would be placed to still include being able to reaspond to IMs, etc? Im using the base-bot model at the moment and just making a few changes here and there.
Thanks! |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Thu Mar 31, 2005 11:33 pm Post subject: |
|
|
You could get the original modified date of the file before the bot goes on the while(1) loop, and then put the other stuff inside that loop:
[CODE]# this is where the getting $modified would go
while (1) { $msn->do_one_loop();
# this is where the comparing would go } _________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
weizbox Newbie

Joined: 31 Mar 2005 Posts: 4
 
|
Posted: Thu Mar 31, 2005 11:40 pm Post subject: |
|
|
ah ha... Im using the aimbot at the moment and noticed the aim->start at the bottom but had no idea how that would do anything at all.. so im going to try and replace it with what you put down, switching msn for aim, and from there it looks like im good.
Thanks again! much appreciated in the start of this learning curve. Weizbox |
|
| Back to top |
|
 |
weizbox Newbie

Joined: 31 Mar 2005 Posts: 4
 
|
Posted: Fri Apr 01, 2005 1:34 am Post subject: |
|
|
Hi, I just got my script written up for testing and the first error I got was a syntax error on the same line where i put
$modified = stat($filename)[9];
syntax error at bot.pl line 94, near ")["
as you know, im kinda a noob so not sure if i was supposed to put down that [9] differntly or what... but Im looking into it to try to see what I can find online to get it up and running.
Weizbox |
|
| Back to top |
|
 |
malefactor Member

Joined: 27 Jan 2005 Posts: 109 Location: Lewiston, ME
  
|
Posted: Sat Apr 02, 2005 5:26 pm Post subject: |
|
|
I always use an array ->
@filestats = stat($filename); $modified = @filestats[9];
perhaps you should try that |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Sat Apr 02, 2005 6:53 pm Post subject: |
|
|
Aha, the one I gave you was missing a pair of parenthesis.
| Code: | | my $modified = (stat('Leviathan.pl'))[9]; |
I just tested it, that one works (of course replace 'Leviathan.pl' with $filename or whatever file you're checking ). _________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
|