mIRC Home    About    Download    Register    News    Help

Print Thread
/background bug #254666 24/08/15 01:14 AM
Joined: Aug 2015
Posts: 35
_
_entropy Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Aug 2015
Posts: 35
running mIRC v7.43 on XP SP3 using 42K RAM...

This works with a custom /query <nick> alias..

Here is the code:

Code:
 alias query { 
  if (!$2) { !query $1 | bg $1 }
  else { !query $1 | bg $1 | msg $1- }
  haltdef
}

Here is the code for /bg:

Code:
alias bg {
  if (!$1) { return }
  var %n = $1
  tokenize 32 $mkfn($1)

  window -pdCk0arh +eLf @logo -1 -1 840 90
  drawtext -o @logo 01 Tahoma 60 20 7 $iif($len(%n) >= 22,$+($mid(%n,1,22),...),%n)
  drawtext -o @logo 04 Tahoma 60 20 5 $iif($len(%n) >= 22,$+($mid(%n,1,22),...),%n)

  drawsave -b32 @logo $+($scriptdir,$1,.png)
  window -c @logo

  background -pn %n $qt($+($scriptdir,$1,.png))
  .remove $qt($+($scriptdir,$1,.png))
}

The error:

Code:
* /background: unable to load 'C:\mIRC\scripts\test.png' (line 314, theme.mrc)

I "sometimes" get this error on the /background line. The file exists.

Please fix this!

Last edited by _entropy; 24/08/15 04:54 AM.
Re: /background bug [Re: _entropy] #254668 24/08/15 07:43 AM
Joined: Mar 2010
Posts: 144
Masoud Offline
Vogon poet
Offline
Vogon poet
Joined: Mar 2010
Posts: 144
You're doing it wrong.

First, what's with -pn switches? Use either Normal (-n) or Photo (-p).

And, you're send an extra parameter to /background here
Code:
background -pn %n $qt($+($scriptdir,$1,.png))

What's %n? You don't need it there.

Code:
alias bg {
  if (!$1) { return }
  var %n = $1
  tokenize 32 $mkfn($1)
  var %file = $qt($+($scriptdir,$1,.png))

  window -pdCk0arh +eLf @logo -1 -1 840 90
  drawtext -o @logo 01 Tahoma 60 20 7 $iif($len(%n) >= 22,$+($mid(%n,1,22),...),%n)
  drawtext -o @logo 04 Tahoma 60 20 5 $iif($len(%n) >= 22,$+($mid(%n,1,22),...),%n)

  drawsave -b32 @logo %file
  window -c @logo

  background -an %file
  .timer 1 0 .remove %file
}


It's good to use a timer (even with duration 0) for removing the file, just to make sure that it will be removed after the code reaches the end.


Nothing...
Re: /background bug [Re: Masoud] #254669 24/08/15 07:58 AM
Joined: Aug 2015
Posts: 35
_
_entropy Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Aug 2015
Posts: 35
MaSOuD.. this changes the background of a channel window, when its supposed to be query...

Code:
background -an %file

Works (although still gives a background error)

Code:
background -n $1 %file

Last edited by _entropy; 24/08/15 08:13 AM.

mIRC Scripts Website: https://mircscripts.net - Register today!
Re: /background bug [Re: _entropy] #254670 24/08/15 09:14 AM
Joined: Dec 2002
Posts: 4,563
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,563
Thanks for your bug report. Unfortunately I have not been able to reproduce this issue here. I tested your script using the following timer:

Code:
alias test timer -m 1000 1 query test

And it ran through to completion with no errors every time I ran it.

When the /background command reports this error, this means that either the file does not exist or is inaccessible for some reason. Is your system low on memory or disk space? These are often the cause of these types of issues. Are you using anti-virus software? These can often make newly created files inaccessible during a scan. Are you saving to a network drive? That might be the cause of the issue. You will need to find a way to narrow down the cause of the issue.

Re: /background bug [Re: Khaled] #254676 24/08/15 08:10 PM
Joined: Aug 2015
Posts: 35
_
_entropy Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Aug 2015
Posts: 35
Khaled...

try with many /query <nicks>...

Query Code:

Code:
alias query { 
  if (!$2) { !query $1 | bg $1 }
  else { !query $1 | bg $1 | msg $1- }
  haltdef
}

/BG Code:

Code:
alias -l bg {
  if (!$1) { return }
  var %n = $1
  tokenize 32 $mkfn($1)

  var %file = $qt($+($scriptdir,$1,.png))

  window -pdCk0arh +eLf @logo -1 -1 840 90
  drawtext -o @logo 01 Tahoma 60 20 7 $iif($len(%n) >= 22,$+($mid(%n,1,22),...),%n)
  drawtext -o @logo %tx Tahoma 60 20 5 $iif($len(%n) >= 22,$+($mid(%n,1,22),...),%n)

  drawsave -b32 @logo %file
  window -c @logo
  .timer -om 1 400 background -n %n %file
}

Test Many Queries:

Code:
alias doquery {
  var %a = 1, %b, %t = 1, %c = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10
  while ($gettok(%c,%a,32)) {
    %b = $v1
    .timer 1 %t query %b
    inc %t
    inc %a
  }
}

Error:

Code:
* /background: unable to load 'C:\mIRC\scripts\test1.png' (line 317, new_theme.mrc)
* /background: unable to load 'C:\mIRC\scripts\test3.png' (line 317, new_theme.mrc)


As you can see, "sometimes" there are errors...

Try it again (many times) and get back to me...

Last edited by _entropy; 24/08/15 10:21 PM.

mIRC Scripts Website: https://mircscripts.net - Register today!
Re: /background bug [Re: _entropy] #254687 25/08/15 07:11 AM
Joined: Dec 2002
Posts: 4,563
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,563
I tested your script several times and it ran without any issues. I also tried changing the /timer to a millisecond timer using:

Code:
.timer -m 10 %t query %b

to repeat and speed up the process and it still ran correctly. Tested under Windows XP, 7, 8.1, and Wine.

Do you have any anti-virus/security software installed? If you disable/unload it completely and test again, do you still see this issue?

If you install a clean copy of mIRC, using the portable option in the installer, to a new, empty folder in your documents folder, and run this script in that copy of mIRC, do you still see this issue?