Old tips = new tricks

Want to talk about something that isn't covered by another category?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

bogs
Posts: 3791
Joined: Sat Feb 25, 2017 10:45 pm

Re: Old tips = new tricks

Post by bogs » Mon Jun 17, 2019 10:47 pm

I've updated this plugin again. One behavior that was annoying me was that it would always open at the center of the screen, so I was constantly moving it to the side.

Now I've added a custom property that will let it will retain whatever position it was in last when you close the IDE.

A second annoyance I had come across was that if you put this in the default location for plugins (my livecode/Plugins) and you use a range of versions of the IDE, it would save in the latest format due to a handler that saves the stack on closing because there are a number of things that change in the stack while it is running/opened/etc., such as which tip you are on and how many others are left.

To prevent this, I added a 'save this stack with format 5.5' line to the closeStack handler. IF you keep multiple versions of the IDE in operation, this should prevent the tips stack from not being able to be opened in which ever IDE you happen to be in.

As always, if you have any problems with the stack, please let me know.
Image

bogs
Posts: 3791
Joined: Sat Feb 25, 2017 10:45 pm

Re: Old tips = new tricks

Post by bogs » Fri Jul 05, 2019 9:12 pm

I updated the plugin once more, because I noticed the previous update hosed the menu system :(

That is fixed, but now as I'm running through the code, I'm seeing an issue with the following statements...

Code: Select all

       put the version into tmpVers
(x)   if tmpVers > "6.5.2" then save stack "revLcTips" with format 5.5
The error reported is "stack "revLcTips": compilation error at line 112 (Function: missing '('), char 58", but I'm not sure why, as every example I've seen of that command has it laid out like it is? Am I missing something? Should the format be in parenthesis or something?

Thanks for any tips / suggestions :D
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5105
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Old tips = new tricks

Post by jacque » Sat Jul 06, 2019 5:23 pm

The > sign works with numbers and those can't have more than one decimal point. You can strip out the decimals and treat the version as an integer, or truncate it if that won't matter much. Or you can compare each decimal part individually. There may be other ways too.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 3791
Joined: Sat Feb 25, 2017 10:45 pm

Re: Old tips = new tricks

Post by bogs » Sat Jul 06, 2019 7:00 pm

That is good to know Jacque, thanks! Unfortunately, modifying it down to the first digit didn't resolve the issue :(
Selection_001.png
...huh?
I should add that even with just 'save stack "revLcTips" with format 5.5' generates the same error. I'm very saddened by this turn of events.
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5105
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Old tips = new tricks

Post by jacque » Sun Jul 07, 2019 4:02 pm

Sorry, I didn't focus on the actual error very well. The next thing I'd try is to put the format version number in quotes.

The error you're getting doesn't describe the problem very well.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3596
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Old tips = new tricks

Post by richmond62 » Sun Jul 07, 2019 6:01 pm

The error you're getting doesn't describe the problem very well.
If LiveCode ever falls by the wayside (hope not for at least the next 25 years) that
might be the best text to inscribe on its gravestone.

bogs
Posts: 3791
Joined: Sat Feb 25, 2017 10:45 pm

Re: Old tips = new tricks

Post by bogs » Sun Jul 07, 2019 6:07 pm

Heh, true true Richmond :D

I had already tried Jacque's last suggestion, and a few others. Here is what got rid of the error message, if you can believe it ...

save stack "revLcTips" with format ('5.5')

I'm still not sure why any error was generated, no version of that line of code that I was able to find required the number to be treated in any special way. Just my dumb luck, I guess :?
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3596
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Old tips = new tricks

Post by richmond62 » Sun Jul 07, 2019 6:27 pm

Now might be a good opportunity to start a discussion about LiveCode error messages . . .

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5105
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Old tips = new tricks

Post by jacque » Sun Jul 07, 2019 9:46 pm

Well, it did say it wanted a function...

What I usually do, when I do it at all, is:

Code: Select all

put the stackfileversion into tCurVersion
set the stackfileversion to "5.5"
save this stack
set the stackfileversion to tCurVersion
Which has always worked in the past, but it's been a while.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2826
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Old tips = new tricks

Post by mwieder » Sun Jul 07, 2019 9:49 pm

the stackfileversion property has been deprecated since version 8.0.0.

bogs
Posts: 3791
Joined: Sat Feb 25, 2017 10:45 pm

Re: Old tips = new tricks

Post by bogs » Sun Jul 07, 2019 10:13 pm

@Jacque - If I am parsing that correctly, it would have to be opened first, right?

Here is the main problem, being a plugin located in the central plugins folder (not in the IDEs plugin folder), I would open say, Lc 7 (or v8.x) to look at something, then close it and go back to say 6.5.

Once opened in 8, though, it was being saved back as sfv 8.x, so when I opened 6.x, the plugin wouldn't load. So really what I need to make sure is that it can open in older versions after opening in a newer version. I'm sure others who actually write plugins must have a work around for this, but apparently didn't read or see or respond to the earlier post where I asked about it.

@mwieder - deprecated, but still working I assume? I can't really open a version higher than 8.1.2 on my 'nix box, but in that one it still shows 'the version'
Image

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2826
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Old tips = new tricks

Post by mwieder » Sun Jul 07, 2019 10:46 pm

"the version" is of course still working. And "the stackfileversion" also still works, although its use isn't recommended and it may/will/who-knows disappear at any time.

I don't remember offhand when the "save stack with format" syntax was introduced, but I'm reasonably confident it was pretty recent. So if you're relying on that syntax in earlier versions you're out of luck. Then you'll see what you're seeing: open in v7, assume the save will be in 5.5 format, try to open in 6.5, discover it didn't work.

Maybe more to the point, *why* are you saving the stack at each closeStack call? That seems like asking for trouble. If you need to set preferences, save and load them from a text file.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2826
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Old tips = new tricks

Post by mwieder » Sun Jul 07, 2019 10:47 pm

You can't open a version > 8.1.2 on your *nix machine?

bogs
Posts: 3791
Joined: Sat Feb 25, 2017 10:45 pm

Re: Old tips = new tricks

Post by bogs » Mon Jul 08, 2019 5:58 am

Heh, well, actually the idea for 'save stack with format' came from a suggestion by Panos to solve a similar problem I was having with a different stack I made which I thought was a bug in later versions of the IDE. All my IDE preferences are set to save the stack preserving the original format, but Panos pointed out to me that this does *not* apply when you have 'save this stack' (which came out in v1.) in the close request.

The stacks original authors wrote it with a 'save this stack' in the close request (probably for version 1.x, but I can't run that on 'nix either), but it is for sure present in 2.x, which is where I brought it up from. There are a number of custom properties which update and then have to be saved out. Sure I could go write them all out to a file, I suppose, however I'm not sure there would be a great advantage to it. The people who wrote it I am positive were a great deal farther along than I am in the language.

In any case, using that line does work in 6.x, but the reason I wrapped it in the if/then is because 6.x already saves in 5.5 format. It works in the later versions for sure, because the problem I was having re-opening it in 6.x was fixed once the 'with format' was added, I just found it curious that 6.x required the (' ') around the number. I never saw it listed that way anywhere else that I could find.
mwieder wrote:
Sun Jul 07, 2019 10:47 pm
You can't open a version > 8.1.2 on your *nix machine?

Well, open, to various degrees of success. Some of the later versions crashed instantly, some crash doing something like, oh, adding a browser widget. 8.1.2 is the last version that gives me enough time to try to answer someone else's question, but I sure wouldn't try to write anything in it more complicated than "answer "Hello"" on this box.

8.0.1, if I really needed to write something in a newer engine format is probably the best shot at working on my distro of choice, but really, nothing I do exceeds the capabilities of the original Mc, although I like to plug around in RR 2.x a LOT, and the latest I use is 6.5.2. I am almost never past that one.

That isn't to say I don't have any way of running a later version of the IDE, but it sure is not my preference. IF I had to, I could pop up a VM and run 9.x, and I do actually do that if I have time to go bug hunting.

But if the IDE won't run on my system, what would make me think a standalone I make with it will run on anything I need it too? The older engines, bugs and all, are far less 'finicky' for my special snow flake requirements.
Image

jiml
Posts: 173
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: Old tips = new tricks

Post by jiml » Mon Jul 08, 2019 10:54 pm

Bogs,

In regard to your earlier post
I'm seeing an issue with the following statements...

Code: Select all

      put the version into tmpVers
  if tmpVers > "6.5.2" then save stack "revLcTips" with format 5.5
Here's one way to check if the current version of LC meets a minimum requirement.

Jim Lambert

Code: Select all

on mouseUp
   answer versionAtLeast("6.5.2")
end mouseUp

function versionAtLeast pMinimumVersion
   put the version & cr & pMinimumVersion into pVersionList
   put sortVersions(pVersionList) into pVersionList
   if lineoffset(the version,pVersionList) = 1 then
      return true
   else
      return false
   end if
end versionAtLeast

function sortVersions pVersionList
   --Assumes version numbers are in x.x.x format
   set the itemdelimiter to "."
   repeat with x = 3 down to 1
      sort lines of pVersionList numeric descending by item x of each
   end repeat
   return pVersionList
end sortVersions

Post Reply

Return to “Off-Topic”