Scripting Bugs

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

: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: 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: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: Scripting Bugs

Post by nerdweed »

You can use this instead. Updating my latest post there with this as well

Code: Select all

If (substr($RecPath,0,2) == "\\" )  { $flag=1; }
Else { $flag = exists($RecPath) ; }
If ($flag > 0) {add the path to my list;}

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Scripting Bugs

Post by bdeshi »

if you try syntactically invalid path with SC html (example>> ::html('C:'); <<) , a couple of weird mutant dialogs come up. :shock:
I understand the error here is with the script being incorrect, but still, can I call the resulting windows anything but bugs (really creepy ones too)?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: Scripting Bugs

Post by admin »

Agreed, there is room for improvement. :)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Scripting Bugs

Post by bdeshi »

SC download: if the source url can not be loaded (shows error #0), the target file is still created and moreover, it's locked by XY. The pc is disconnected from the net, if it's relevant.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: Scripting Bugs

Post by admin »

Completely confirmed and fixed. Thanks!

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

Re: Scripting Bugs

Post by PeterH »

Some problem with *$nr++ - maybe :bug: ? (Or 'works as designed', as IBM might say :( )

A stmt *$nr++; is allowed.
Shouldn't it then also be allowed to code:

Code: Select all

 $nr = '$ind';
 Global *$nr = 5;
 $i = *$nr++;                              // wrong
 $char = Substr('123456789', *$nr++, 1);   // wrong
 Text "i='$i', char='$char', ind='$ind'";
 step;
Both *$nr++ always seem to be 0, no matter of value of *$nr :arrow: $i will be 0, Substr will take first char. *$nr is *not* incremented.

Of course:

Code: Select all

 $nr = '$ind';
 Global *$nr = 5;
 *$nr++;
 $i = Eval($nr); 
 $char = Substr('123456789', Eval($nr), 1);
 Text "i='$i', char='$char', ind='$ind'";
 step;
works OK.


By the way, in step mode: if the last stmt of a script doesn't work as expected, you have no chance to check variable contents, as the script ends immediately. As in the first example: here the Text command displays something unexpected, but vars can't be checked then. So it would be fine to be able to display variable contents also *after* execution of the last stmt of a (sub-)script.
I help myself by sometimes adding a Step-Instruction after the last instruction... :roll:

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

Re: Scripting Bugs

Post by admin »

Confirmed.

1. Not supported. Maybe later.
2. Good idea, I make a note.

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

Re: Scripting Bugs

Post by PeterH »

admin wrote:1. Not supported.
You are IBM :shock:

A bit expecting this I didn't create a :bug: -thread for this :roll:
(As can be seen: it can be circumvented. Problem is to know it :P )

So: in docu you should give info that *$var++; is supported only standalone, not as an operand, or right in a set instruction.
And you might make a note for this, too :biggrin:

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

Re: Scripting Bugs

Post by PeterH »

Just saw this:

Code: Select all

v14.30.0001 - 2014-07-11 21:46
    + Scripting: The dereference operator * (asterisk) can now be used anywhere
      in a statetment.
        $var = '$a'; *$var = "TEST"; echo *$var;  //TEST
        $var = '$a'; *$var = "TEST"; echo "*$var, $a!";  //TEST, TEST!
        $var = '$a'; *$var = 1; echo 1 + *$var++; //3
    ! Scripting: The following kind of statement was not parsed correctly. Now
      it is:
        $a = 1; echo 1 + $a++; //3
        $a = 1; echo $a++ + 1; //3
Hey - looks very promising :shock:

But sorry need some time before I can test :cry:

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

Code: Select all

    ! Scripting: The following kind of statement was not parsed correctly. Now
      it is:
        $a = 1; echo 1 + $a++; //3
        $a = 1; echo $a++ + 1; //3
Granted I haven't test it but this seems wrong.

In every language I'm familiar with those examples would resolve $a to 1 and then increment it - so they'd echo 2 and the value of $a would become 2.

Your examples would be accurate if instead of "$a++" they were "++$a" but that's not supported.

klownboy
Posts: 4440
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: Scripting Bugs

Post by klownboy »

I don't follow, when $a is 1, if echo $a++ yields 2 which it does, why wouldn't echo 1 + $a++ = 3 (which it does)?

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

klownboy wrote:I don't follow, when $a is 1, if echo $a++ yields 2 which it does, why wouldn't echo 1 + $a++ = 3 (which it does)?
It's the difference between $a++ and ++$a - though since XY doesn't support the latter it is somewhat moot.

In most languages...
$a++ means use the value of $a and then increment it.
++$a mens increment the value and then use it.

Code: Select all

$a = 1; $b = $a++;   $c = $a; echo "$a $b $c"; // should echo 1 1 2

$a = 1; $b = ++$a;   $c = $a; echo "$a $b $c"; // should echo 1 2 2

$a = 1; $b = ++$a++; $c = $a; echo "$a $b $c"; // should echo 1 2 3
So

Code: Select all

$a = 1;
 echo $a++;          // should echo 1 then set $a to 2.
 echo 1 + $a++;      // should echo 3 (1+2) then set $a to 3.
 echo 1 + $a++ + 1;  // should echo 5 (1+3+1) then set $a to 4.

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

Re: Scripting Bugs

Post by admin »

TheQwerty wrote:

Code: Select all

    ! Scripting: The following kind of statement was not parsed correctly. Now
      it is:
        $a = 1; echo 1 + $a++; //3
        $a = 1; echo $a++ + 1; //3
Granted I haven't test it but this seems wrong.

In every language I'm familiar with those examples would resolve $a to 1 and then increment it - so they'd echo 2 and the value of $a would become 2.

Your examples would be accurate if instead of "$a++" they were "++$a" but that's not supported.
Damn, you are right. I checked it with PHP.

Back to work... :twisted: :cup:

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

Re: Scripting Bugs

Post by PeterH »

admin wrote:
TheQwerty wrote:

Code: Select all

    ! Scripting: The following kind of statement was not parsed correctly. Now
      it is:
        $a = 1; echo 1 + $a++; //3
        $a = 1; echo $a++ + 1; //3
Granted I haven't test it but this seems wrong.

In every language I'm familiar with those examples would resolve $a to 1 and then increment it - so they'd echo 2 and the value of $a would become 2.

Your examples would be accurate if instead of "$a++" they were "++$a" but that's not supported.
Damn, you are right. I checked it with PHP.

Back to work... :twisted: :cup:
But now you have a problem: docu says:
  • You can also use $i++/$i-- as an argument. The value is incremented/decremented before it is passed to the function. ...
And there are people (like me) currently using it this way :x

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

Re: Scripting Bugs

Post by admin »

Yes, this is bad. :evil: Any ideas?

Post Reply