How to use the self() command?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
JamesMcBride
Posts: 34
Joined: 20 May 2015 16:18

How to use the self() command?

Post by JamesMcBride »

My goal in the short term, is to create a log file for my script based on the name of that script, My code started with:
$LogFile=<xyscripts> + self("base") + ".log";

so that it should appear in my XYScripts directory

but soon found out that wasnt working as expected. I am running the script from the 'Catalog', and I can see from the bit of code that is in the help file that self() seems meant to be rather versatile based even on the subroutine that it is called from.

The other thing that seemed strange to me was that my line of code above produced a filename of '0', so, not only did self("base") not point to where I thought it was pointing to, it sucked the string from <xyscripts> and ".log" into the void as well, leaving me with just '0' in the directory where I ran the script.

What am I doing wrong?

Norn
Posts: 504
Joined: 24 Oct 2021 16:10

Re: How to use the self() command?

Post by Norn »

Code: Select all

 $LogFile=<xyscripts> . "\" . self("base") . ".log";
Windows 11 24H2 @100% 2560x1440

altoclef
Posts: 99
Joined: 12 Oct 2012 18:54
Location: Win11 24H2 @100%

Re: How to use the self() command?

Post by altoclef »

JamesMcBride wrote: 30 Jan 2026 01:26 not only did self("base") not point to where I thought it was pointing to,
self('base') has a long-standing bug, which might also be the reason for what you are seeing (I don't know as I haven't looked at your post in detail).

twinBasic's proposed v1.0 release date has slipped to 19th March 2026 (https://github.com/twinbasic/twinbasic/issues/335), so I am hoping that it does not slip any further and that the bug can then be fixed.

JamesMcBride
Posts: 34
Joined: 20 May 2015 16:18

Re: How to use the self() command?

Post by JamesMcBride »

Hello again, everyone, and welcome back from the server change!
It looks like we were down for a couple of days, but it looks like we are back now better than ever.

Thank you for your help, Norn, with my VERY rookie mistake in appending strings together. It helps when we get the basics straight before moving on to the more complex stuffs. I AM a rookie for sure.

Thanks again for the help!

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

Re: How to use the self() command?

Post by admin »

The server change is still in progress. There will be another forum downtime tomorrow (just because I don't want any updates after I made the backup) and on Thursday the actual change should happen and it should be totally smooth.

Post Reply