mIRC Home    About    Download    Register    News    Help

Print Thread
on 1:load: #65607 27/12/03 10:27 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on 1:LOAD: {
  if !$script(script.mrc) != $true) { .load -rs $mircdir/script.mrc }
 .unload -rs scriptcheck.mrc

can somone explain why that wont work? i just added one line in this example, but in my script it sheck 17 files.. it working if i make a alias of it.. but it should work on load too.. shouldent it??


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: on 1:load: #65608 27/12/03 11:59 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline
Vogon poet
Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
Code:
  
on 1:LOAD: {  
if [color:red]([/color]!$script(script.mrc) != $true) { .load -rs $mircdir/script.mrc } 
.unload -rs scriptcheck.mrc   
 [color:red] } [/color] 

Re: on 1:load: #65609 28/12/03 12:01 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
the first ( dosent mather. the same problem.. but it works as an alias.. so if i have "on 1:LOAD:command" then i can trigger the script..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: on 1:load: #65610 28/12/03 06:55 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline
Fjord artisan
Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
try this?

Code:
on *:load: { 
if (!$script(script,mrc)) { .load -rs $mircdir/script.mrc }
else {
 .unload -rs scriptcheck.mrc
}
}

is that what your looking for?


Need amazing web design for low price: http://www.matrixn3t.net
Re: on 1:load: #65611 28/12/03 11:42 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Are you trying to load your script files if they are already loaded? well thats what it looks like at least.

im going to assume the following.
(1) your attempting to reload already loaded script files
(2) the ( at the start of the IF was accidently left off in your example
(3) $mircdir has no spaces in the path which would cause it to fail

your problem might be in $mircdir/script.mrc as $mircdir ends with a \ and adding a / of your own you get \\ (/ translates to \) in there but then maybe not as the files load up under this but load twice if u have previously loaded them manually, you might not get this if you loaded yours up orginally using $mircdir/filename.mrc, check out doing ECHO $script(1) up to 17 i guess, do you have a \\ in the path?

regardless i tried your code block as follows
Code:
; filename scriptcheck.mrc
on 1:LOAD: {
  if (!$script(script.mrc) != $true) { load -rs $mircdir/script.mrc }
  .unload -rs scriptcheck.mrc
}

; filename script.mrc
on 1:LOAD: echo -s ONLOAD script.mrc
 


when doing a /load -rs scriptcheck.mrc it works fine, it loads script.mrc, and its ON LOAD triggers (after this onload completes).

I would change the code as follows as i would have thought it clearer, but your choice

Code:
; filename scriptcheck.mrc
on 1:LOAD: {
  if ($script(script.mrc) != $null) { load -rs $mircdir $+ script.mrc }
  .unload -rs scriptcheck.mrc
}
 


I used $+ to connect $mircdir & script.mrc even tho i could have used $mircdirScript.mrc as it allows them to be joined, I just dont do it, i think its bad practice to differ your code using the ODD identifier that takes extentions, i would rather have everything following one format.

PS: one odd thing i found while doing this is $script(script.mrc) returns a path\filename combo even if the script.mrc file doesnt exist let alone just not loaded, it must be some odd thing mirc does, using anyother filename i tried returns $null unless its loaded, ie $script(scripts.mrc)

Re: on 1:load: #65612 28/12/03 02:13 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
What i trying to do, thats a sheck, and if 1 of my remote files missing, then i want it loaded again.. and the file i was unloading is the one that sheck my other files.. it's only used at startup, then i dont need it loaded any more


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: on 1:load: #65613 28/12/03 02:51 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
well if thats the case then
Code:
 
on 1:LOAD: {
  if (!$script(script.mrc) != $true) { .load -rs $mircdir/script.mrc }
  .unload -rs scriptcheck.mrc
}
 

isnt going to work you needed it to be == not !=, better yet, make it ($script(script.mrc) == $null) { .load etc etc

Only problem is as i said with $script(script.mrc) comes up with a false loaded even if the file doesnt exist