mIRC Homepage
Posted By: DuXxXieJ Automaticly reload scripts after edit - 15/06/11 07:39 PM
Is there any setting to reload scripts automaticly when they've been changed?

My bot is running on an other pc where I connect to using FTP. Using the FTP I edit it's scripts, but I need to use .reload <script> to have it reloaded.

The popup "<script> has been changed, reload from disk?" comes back every time.

Any idea?
Posted By: Masoud Re: Automaticly reload scripts after edit - 15/06/11 11:22 PM
Well, you just answered your own question...
If you have no clue, here is an example:
Code:
on *:Text:.reload *:#:{
  var %file = $+($scriptdir,$1,.mrc)
  if ($exists($qt(%file))) {
    .load -rs $qt(%file)
    notice $nick $nopath(%file) successfully reloaded.
  }
}

You should change the path to your script directory path, or adjust the code in the way you want...

Hope this helps.
Posted By: DJ_Sol Re: Automaticly reload scripts after edit - 16/06/11 03:24 AM
Open the script editor. On the top menu choose Options > (uncheck) Initialization Warning

This should help.
Posted By: RoCk Re: Automaticly reload scripts after edit - 16/06/11 03:53 AM
I'm thinking he means the Monitor File Changes option.

Open the script editor. On the top menu choose Options > (un-check) Monitor File Changes
Posted By: Masoud Re: Automaticly reload scripts after edit - 16/06/11 09:58 AM
How could i miss the last line, lol
DJ_Sol & RoCk, i think you both are right. He needs to uncheck both of them...
Posted By: DuXxXieJ Re: Automaticly reload scripts after edit - 16/06/11 08:33 PM
@Masoud,

I already said that I was using a script, which was the problem because I don't want to reload the script manually, that's why I asked for an automaticly <----- option for this. Not a manually. But thanks tho.

@DJ_Sol and RoCk

Both options didn't help. Maybe I didn't explain well, I'll try better now:


I'm running a mirc bot, which has scripts loaded (doh). Because it's on an other PC, I'm editing the scripts by FTP.

So, I connect to it's ftp server and edit a file and then save it. Now the script has been edited, but needs to be reloaded to make the changes work.

Let's say the script first had a !command which replied with 'hello!'. I've edited the 'hello!' to 'hello $nick $+ !'.

When saving the file (by FTP!) I want it to reload automaticly in mIRC, because when I've saved it and using !command it'll still shout 'hello!'.

So actuallly I'm looking for an mIRC option that reloads and loaded mIRC script when edited, without doing ANYTHING.

Maybe this explanation was better? If it wasn't clear enough tho.



--- EDIT ----
@Masoud; .load -rs is quite double, reload will work as well :P
Posted By: Riamus2 Re: Automaticly reload scripts after edit - 16/06/11 09:38 PM
You would need a timer that automatically checks the script file for changes (compare $md5 or similar to find out) and then use /reload if it changes.
Posted By: DuXxXieJ Re: Automaticly reload scripts after edit - 16/06/11 09:44 PM
Originally Posted By: Riamus2
You would need a timer that automatically checks the script file for changes (compare $md5 or similar to find out) and then use /reload if it changes.


Lol, I just wanted to post again with having a idea, which is a timer to check the 'edited at..' date/time and if that was later than the var %time (or something that's been set while loading) it should reload itself.

I'll go try yours
Posted By: DuXxXieJ Re: Automaticly reload scripts after edit - 16/06/11 11:46 PM
Originally Posted By: Riamus2
You would need a timer that automatically checks the script file for changes (compare $md5 or similar to find out) and then use /reload if it changes.


Ok, I've been looking in the mIRC help file $md5. So, if I do //echo -a $md5(files/fun/fortune.txt) I get 0bca7c6a0c47c954973fd24783c7ce5b.

Can't really figure out how this should say the file has been edited (can't decode it.)



- EDIT -

Didn't saw the Nth part, I now have used //echo -a $md5(files/fun/fortune.txt,2) which appears to be different when I've changed the file.

Hope this'll work! Thanks
© mIRC Discussion Forums