mIRC Home    About    Download    Register    News    Help

Print Thread
Timer and variable assignment #266592 31/12/19 03:53 AM
Joined: Jul 2006
Posts: 3,703
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,703
I know that /timer has a special routine to look for variable assignments, so that the /timer command itself won't evaluate a variable in typical cases.
mIRC seems a bit greedy though, I was trying to pass parameter to an alias called via timer:

Code
alias main {
  var -s %a $1,%b $2,%c $3
  if (!%c) return
  .timermain -ho 1 800 main %a %b %c
}
/main a inc c

Here if %b is 'inc', %c disappear:
Quote
* Set %a to a
* Set %b to inc
* Set %c to c
* Set %a to a
* Set %b to inc
* Set %c to


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Timer and variable assignment [Re: Wims] #266595 31/12/19 02:55 PM
Joined: Jan 2004
Posts: 1,349
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,349
with/without the leading forward slash, same thing happens with

/main a dec b
/main a set b

but not
/main a var b

Last edited by maroon; 31/12/19 03:00 PM.
Re: Timer and variable assignment [Re: maroon] #266597 31/12/19 03:21 PM
Joined: Dec 2002
Posts: 4,759
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,759
Thanks for your bug report. This is a known issue. The /set, /inc, /dec commands require that the %var parameter is not evaluated when forming the command line. Previously, when /timer was used and included a reference to these commands, the %var was evaluated. Scripters requested that an exclusion be added for /timer in this case. However, as the parser works by evaluating all parameters first, then forming the command line, and then executing the command which parses its parameters, there is no way for the variable parser to know where the command starts in a variable parameter /timer command, especially if $+ and [ ] are used. This means that if you decide to use /set, /inc, or /dec in a /timer command, you will need to enclose your variable names with [ ] to prevent them from being parsed. This behaviour has been in place ever since this feature was added, so changes to this behaviour now would break all scripts that already do this.

Re: Timer and variable assignment [Re: maroon] #266598 31/12/19 03:22 PM
Joined: Dec 2002
Posts: 4,759
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,759
Quote
with/without the leading forward slash, same thing happens with

The /var command cannot be supported in /timer as it is far too complex.

Re: Timer and variable assignment [Re: Wims] #266637 07/01/20 11:51 PM
Joined: Dec 2002
Posts: 4,759
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,759
After testing this out, I decided to fix how %vars are parsed with /timer in the latest beta. This should be backwards compatible and work as before, except in cases where it was broken, as described above.

The code that parses %vars is very old. It has been tweaked over a long time to work the way it does. Unfortunately, it is also unecessarily complex because of all of the incremental changes over the years. So I decided to rewrite it completely. This is not something I normally do, especially with old code. But I think in this case it makes sense. However, this does mean it will need heavy testing as it affects how %vars are parsed. In my tests, the behaviour seems identical to previous versions, apart from the /timer fix. Please let me know if you spot any issues.

Re: Timer and variable assignment [Re: Khaled] #266657 11/01/20 11:25 AM
Joined: Jul 2014
Posts: 184
TECO Offline
Vogon poet
Offline
Vogon poet
Joined: Jul 2014
Posts: 184
I notice that there is a malfunctioning script of mine that works in conjunction with sockwrite. Sometimes it does not read variables due to changes. In the previous beta this was not true.


TECO
irc.PTirc.org (Co-Admin)
Re: Timer and variable assignment [Re: TECO] #266658 11/01/20 11:32 AM
Joined: Dec 2002
Posts: 4,759
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,759
Quote
I notice that there is a malfunctioning script of mine that works in conjunction with sockwrite. Sometimes it does not read variables due to changes. In the previous beta this was not true.

Please provide a short, example script that reproduces your issue?

Also, please test your script again with the previous beta. Preferrably, run both the new beta and the old beta at the same time with the same script with debugging /echos to see how the results vary.

Last edited by Khaled; 11/01/20 11:54 AM.
Re: Timer and variable assignment [Re: Khaled] #266662 11/01/20 12:25 PM
Joined: Jul 2014
Posts: 184
TECO Offline
Vogon poet
Offline
Vogon poet
Joined: Jul 2014
Posts: 184
Originally Posted by Khaled
Quote
I notice that there is a malfunctioning script of mine that works in conjunction with sockwrite. Sometimes it does not read variables due to changes. In the previous beta this was not true.

Please provide a short, example script that reproduces your issue?

Also, please test your script again with the previous beta. Preferrably, run both the new beta and the old beta at the same time with the same script with debugging /echos to see how the results vary.

The previous beta no longer works, is limited to 30 days. However from what I notice, the variables when calling through the sock are not always timely answered when multiple calls are made from the sock. I have a fairly long script from an RSS feed reader and it reads several urls and with current version it sometimes does not reproduce the sock call.


TECO
irc.PTirc.org (Co-Admin)
Re: Timer and variable assignment [Re: TECO] #266663 11/01/20 12:44 PM
Joined: Dec 2002
Posts: 4,759
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,759
The previous beta, v7.58.808, should still be working.

Either way, I really would need a method to reproduce the issue because, so far, I have not been able to reproduce any issues in any of my test scripts.

I would suggest that you add debugging information to your scripts and analyze the results.

Re: Timer and variable assignment [Re: Khaled] #266664 11/01/20 01:07 PM
Joined: Jul 2014
Posts: 184
TECO Offline
Vogon poet
Offline
Vogon poet
Joined: Jul 2014
Posts: 184
Originally Posted by Khaled
The previous beta, v7.58.808, should still be working.

Either way, I really would need a method to reproduce the issue because, so far, I have not been able to reproduce any issues in any of my test scripts.

I would suggest that you add debugging information to your scripts and analyze the results.

I understand, but I also no longer have access to the previous version 7.58.808. However the script code is very long and as I said, what I notice is that whenever I execute the command that traces the urls where the feeds are downloaded, it calls the sock multiple times because there are several urls, and only the The second attempt is that it checks as if it were a lock that existed.


TECO
irc.PTirc.org (Co-Admin)
Re: Timer and variable assignment [Re: TECO] #266665 11/01/20 01:54 PM
Joined: Dec 2002
Posts: 4,759
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,759
Quote
I understand, but I also no longer have access to the previous version 7.58.808. However the script code is very long and as I said, what I notice is that whenever I execute the command that traces the urls where the feeds are downloaded, it calls the sock multiple times because there are several urls, and only the The second attempt is that it checks as if it were a lock that existed.

If you add debugging to your script, can you verify that this is due to incorrect %var parsing? That is the issue we need to track down.

I have added a link to the previous beta here.

Re: Timer and variable assignment [Re: Khaled] #266668 11/01/20 02:37 PM
Joined: Jul 2014
Posts: 184
TECO Offline
Vogon poet
Offline
Vogon poet
Joined: Jul 2014
Posts: 184
Something goes with sockread or sockopen due to a change made in the latest beta. I apologize for not being able to identify where the error is, but I believe it will be due to the timer that was created in this change. Because when sockread or sockopen is called multiple times, it does not work for the first time. Even the $sockerr handle does not return the error.


TECO
irc.PTirc.org (Co-Admin)
Re: Timer and variable assignment [Re: TECO] #266670 11/01/20 04:57 PM
Joined: Dec 2002
Posts: 4,759
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,759
Okay, thanks for testing it out. I will be reverting this change in the next beta.

Re: Timer and variable assignment [Re: Khaled] #266671 11/01/20 05:05 PM
Joined: Jul 2014
Posts: 184
TECO Offline
Vogon poet
Offline
Vogon poet
Joined: Jul 2014
Posts: 184
Originally Posted by Khaled
Okay, thanks for testing it out. I will be reverting this change in the next beta.

Thank you Khaled
I apologize for not being able to help in the best way.


TECO
irc.PTirc.org (Co-Admin)
Re: Timer and variable assignment [Re: TECO] #266677 12/01/20 02:22 PM
Joined: Dec 2002
Posts: 4,759
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,759
Thanks, I found an issue with how the variable parser handles /sockread parameters in the beta. I have released a new beta that reverts this change for now but will be fixing the /sockread issue and performing some more tests before including it again in the next beta.

Re: Timer and variable assignment [Re: Khaled] #266686 12/01/20 09:43 PM
Joined: Jul 2014
Posts: 184
TECO Offline
Vogon poet
Offline
Vogon poet
Joined: Jul 2014
Posts: 184
Originally Posted by Khaled
Thanks, I found an issue with how the variable parser handles /sockread parameters in the beta. I have released a new beta that reverts this change for now but will be fixing the /sockread issue and performing some more tests before including it again in the next beta.

It's ok
The beta released today normalized the /sockread command, when you release the new beta, I'll give you feedback wink


TECO
irc.PTirc.org (Co-Admin)