mIRC Home    About    Download    Register    News    Help

Print Thread
#272082 27/09/23 05:49 AM
Joined: Dec 2021
Posts: 35
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Dec 2021
Posts: 35
I would like an option in the vairables menu and and an alias command to make variables which == $null unset to save room. The inverse of the switch is to keep the variable in the list how it is when set to $null


. : Machine-Gun script named Bauderr with Trio-ircproxy.py : .
Joined: Dec 2002
Posts: 252
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
As a temporary solution, you could use a script to test variables and clear them if they are null. Here's an example commented to explain what it's doing, and also echoing output:

Code
alias freenullvars {
  ;== Find how many vars exist and set a count variable.
  var %x = $var(*,0) + 1 
  ;== We increase x by 1 because at the time of calling $var, x is not set yet....

  echo -a *** Testing %x variables...

  ;== Loop thru all variables backwards so freeing a null variable doesn't affect the rests $var() index
  while (%x && $var(*,%x)) {

    ;== Determine if it's not local, isn't on a decay timer, and is null, if so erase.
    if (!$var(*,%x).local && !$var(*,%x).secs && !$var(*,%x).value) {
      echo -a *** Removing null variable: $var(*,%x)
      unset [ $var(*,%x) ] 
    }
    else { echo -a *** Keeping $var(*,%x) . Local? $var(*,%x).local Decay? $var(*,%x).secs Null? $iif(!$var(*,%x).value,$true,$false) }

    ;== Decrease count variable
    dec %x
  }
}
Example:
/set %abc def
//set %xyz $Null
/freenullvars

result:
Code
*** Testing 3 variables...
*** Removing null variable: %xyz
*** Keeping %abc . Local? $false Decay? 0 Null? $false
*** Keeping %x . Local? $true Decay? 0 Null? $false


Link Copied to Clipboard