Lost Perm variables

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Lost Perm variables

Post by PeterH »

This seems to be a very strange one :shock:

Code: Select all

// Script Docu: Test "Perm" problem with Global

"Set 2 Perm Vars"
// -------------------------------------------------------------------------------------------------
 Global  $names;
// -------------------------------------------------------------------------------------------------
   Msg "Before 'Perm': _PV = $_PV";

 Perm $_PV;
   $_PV = "eins";

   Msg "After 'Perm' & 'Set': _PV = $_PV";
Execute this script (a shortened extract of a real script) - it just defines $_PV as Perm and assigns a value.
When ended: test by Scripting/Permanent Variables :arrow: all seems OK!

But: if you now start any script (do it in stepping mode) this new Global Variable suddenly is completely lost, as if Unset was executed.
(With Step mode you can show it before the first command is executed.)

If in this script you delete the "Global $names" statement, everything will be OK!

admin
Site Admin
Posts: 67315
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Lost Perm variables

Post by admin »

Sure? All fine here.

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Lost Perm variables

Post by PeterH »

admin wrote:Sure? All fine here.
Yes, sure :cry:

To verify:
- I just restarted XY :arrow: not one Perm to find
- copy/pasted above code to Try Script...
- executed all :arrow: after that the variable was known as perm
- started Try Script... a second time
- before execution of "Global" there was not any var to be shown (No Variables... button!) :(
- after 1*Continue (= execution of Global) *only* the global, not the perm was shown
- after 2nd Continue the 1st "Msg" showed the *undefined* perm variable

So here it happens with a real scriptfile, and it happens with try script.

By the way: in the tests before some perms existed before the test. They were *not* affected by this script - only perms (I also did it with 2 perms) defined as new in this script were affected!
If I delete the Global and run the script, the perm variable(s) remain(s) defined. If I then re-add the global everything seems OK - the perm stays permanent :roll:

What i said: strange!

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Lost Perm variables

Post by PeterH »

And one more...

copied XYplorer.exe + XYcopy.exe to new directory, then retried above "Try Script..."

:arrow: same problem :cry:

admin
Site Admin
Posts: 67315
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Lost Perm variables

Post by admin »

You said:
PeterH wrote:But: if you now start any script (do it in stepping mode) this new Global Variable suddenly is completely lost, as if Unset was executed.
That is what I tested.

But now you run the same script again. So is this the bug condition? Run exactly this script two times?

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Lost Perm variables

Post by PeterH »

admin wrote:You said:
PeterH wrote:But: if you now start any script (do it in stepping mode) this new Global Variable suddenly is completely lost, as if Unset was executed.
That is what I tested.

But now you run the same script again. So is this the bug condition? Run exactly this script two times?
No no no - no difference with same *or* any other script! Error in both situations, even before 1st instruction executed!

admin
Site Admin
Posts: 67315
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Lost Perm variables

Post by admin »

Can anybody repro this?

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Lost Perm variables

Post by PeterH »

Above tests all were on W7(X64) SP1.

Now retested on my normal XY on WXP SP3 in Virtual Box. Same problem.

To say again - maybe the strangest thing of all: after having executed the script, the permanent var can be seen by Scripting/Permanent Variables.
Just by starting any script then (same or other), before executing any command of the script, the new permanent var disappears.


("Har har har" he chortled. "I'll take your treasure and take it away."
And then he disappeared into the gloom...)
Just OT, from a 30+ year old adventure game on a mainframe :lol:


PS - is there any problem with http://www.xyplorer.com? since about 1 hour I very often can't reach it, while other sites have no problems.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Lost Perm variables

Post by Marco »

I can repro running the script in the OP twice.
Weird...
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 67315
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Lost Perm variables

Post by admin »

WOW, I got it. This (rare) bug is there since we have permanent variables. Thanks, PeterH! Fix comes.

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Lost Perm variables

Post by PeterH »

admin wrote:WOW, I got it. This (rare) bug is there since we have permanent variables. Thanks, PeterH! Fix comes.
Good to hear - thanks :appl:

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Lost Perm variables

Post by PeterH »

admin wrote:WOW, I got it. This (rare) bug is there since we have permanent variables. Thanks, PeterH! Fix comes.
Tested 11.90.0104.

Neither above example nor any of my other (rare :P ) tests continue to show the error.

So I now can start working heavily :lol: with global variables. Thanks a lot!


PS
I missed completely the advantage of permanent variables to be automatically used in every script, after having been defined once! Having noticed this some days ago started me re-using them, e.g. as simulated parameters to "simulated subroutines or functions". This sometimes *can* be more easy than using globals, that must be defined everywhere. (Though you must be very careful with the names of perms :ugeek: )
(Much better would be the ability to use scripts as *real* functions or subroutines, but I've said/asked that some times before :roll: )

Post Reply