mIRC Home    About    Download    Register    News    Help

Print Thread
Automaticly reload scripts after edit #232680 15/06/11 07:39 PM
Joined: Jan 2007
Posts: 280
DuXxXieJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
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?


Squee whenever a squee squee's. Squee whenever a squee does not squee.
Re: Automaticly reload scripts after edit [Re: DuXxXieJ] #232681 15/06/11 11:22 PM
Joined: Mar 2010
Posts: 144
Masoud Offline
Vogon poet
Offline
Vogon poet
Joined: Mar 2010
Posts: 144
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.


Nothing...
Re: Automaticly reload scripts after edit [Re: DuXxXieJ] #232686 16/06/11 03:24 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Open the script editor. On the top menu choose Options > (uncheck) Initialization Warning

This should help.

Re: Automaticly reload scripts after edit [Re: DJ_Sol] #232688 16/06/11 03:53 AM
Joined: Dec 2002
Posts: 2,021
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,021
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

Re: Automaticly reload scripts after edit [Re: DuXxXieJ] #232690 16/06/11 09:58 AM
Joined: Mar 2010
Posts: 144
Masoud Offline
Vogon poet
Offline
Vogon poet
Joined: Mar 2010
Posts: 144
How could i miss the last line, lol
DJ_Sol & RoCk, i think you both are right. He needs to uncheck both of them...


Nothing...
Re: Automaticly reload scripts after edit [Re: Masoud] #232704 16/06/11 08:33 PM
Joined: Jan 2007
Posts: 280
DuXxXieJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
@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

Last edited by DuXxXieJ; 16/06/11 08:34 PM.

Squee whenever a squee squee's. Squee whenever a squee does not squee.
Re: Automaticly reload scripts after edit [Re: DuXxXieJ] #232706 16/06/11 09:38 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: Automaticly reload scripts after edit [Re: Riamus2] #232708 16/06/11 09:44 PM
Joined: Jan 2007
Posts: 280
DuXxXieJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
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


Squee whenever a squee squee's. Squee whenever a squee does not squee.
Re: Automaticly reload scripts after edit [Re: Riamus2] #232712 16/06/11 11:46 PM
Joined: Jan 2007
Posts: 280
DuXxXieJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
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

Last edited by DuXxXieJ; 16/06/11 11:50 PM.

Squee whenever a squee squee's. Squee whenever a squee does not squee.