mIRC Homepage
Posted By: AD1C set works where var doesn't - 12/10/11 03:05 PM
This line works:

  set %spotline %callsign %county1 $+ , %state1 %freq %mode

whereas this line does not:

  var %spotline %callsign %county1 $+ , %state1 %freq %mode

When using "var" instead of "set" the I get %callsign and %county1 in %spotline, but I don't get any of the rest of the line:

  10-12-2011 14:57 GMT - AD1C Erie

If I only change "var" to "set", I get it all:

  10-12-2011 14:57 GMT - AD1C Erie, NY 7056.5 CW

Any idea what's up with that?
Posted By: Wims Re: set works where var doesn't - 12/10/11 03:45 PM
This is because /var and /set doesn't share the same syntax:

Originally Posted By: /help /var
You can create multiple local variables by separating them with commas:

/var %x = hello, %y, %z = $me
var %spotline %callsign %county1 $+ , %state1 %freq %mode
A quick workaround is to use the -l switch on /set to make a local variable using the /set syntax


Posted By: Riamus2 Re: set works where var doesn't - 12/10/11 04:56 PM
As Wims pointed out, commas are used in /var to separate multiple variables on the same line. You can use /set -l as he mentioned, or you can replace the comma with $chr(44).

var %spotline %callsign %county1 $+ $chr(44) %state1 %freq %mode

Posted By: AD1C Re: set works where var doesn't - 12/10/11 05:01 PM
Thanks!
Posted By: Tomao Re: set works where var doesn't - 12/10/11 07:07 PM
If you need variables to be referred to after your script has finished its routine at a later time, setting global variables are recommended over the local ones. The local variables are set temporarily and unset when a script has completed its task.
© mIRC Discussion Forums