toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Has something gone haywire? Let us know about it!
Post Reply
User avatar
dvgrn
Moderator
Posts: 8920
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Post by dvgrn » October 2nd, 2021, 8:44 am

I've just gotten a couple of reports, one from a Mac user and one from a Windows user, that they aren't able to get the Alt+G / Alt+H / Alt+J / Alt+K shortcuts to work in Golly 4.0. The error message for Alt+H is
The rule file is not valid:
LifeHistory

The error message:
File not found
Given rule: LifeHistory
The problem may have to do with upgrading from Golly 3.x to Golly 4.0. There used to be a rule file called "LifeHistory.rule", and references to it may be hanging around somewhere and causing trouble -- or maybe the rule file itself is! (Can't always trust what the error messages say, in weird cases like this.)

I did see this problem early on when I was troubleshooting the toStandard.lua Alt+J, toHistory.lua Alt+H, and toSuper.lua Alt+G shortcuts in the original Golly 4.0 beta -- but once I fixed the problem (possibly by generating a new GollyPrefs and/or cleaning out my Rules directory) I was never able to duplicate the issue again.

If this is a common issue I'd like to hear from other people who are seeing it, and we'll put the shortest easiest possible fix for it into this thread. Maybe a good solution would be some kind of cleanup script that you run once to make the upgrade problem go away.

But first I need details from copies of Golly that have this problem! Can someone start by either attaching their copy of GollyPrefs to a post here, or sending the file to me at b3s23life [at] gmail.com ? Thanks!

hotdogPi
Posts: 938
Joined: August 12th, 2020, 8:22 pm

Re: toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Post by hotdogPi » October 2nd, 2021, 8:47 am

The exact error message I get:

Golly warning:

The script file does not exist:
Scripts/Lua/toLife.lua

It appears in my most recent scripts run drop-down menu. When clicking that (by accident), I get:

Golly warning:
The script file does not exist:
/Volumes/Golly/golly-4.0.1-mac/Scripts/Lua/toLife.lua

For the LifeHistory script, I get the exact same error message as the OP. It does not get put in my recent scripts.
User:HotdogPi/My discoveries

Periods discovered: 5-16,⑱,⑳G,㉑G,㉒㉔㉕,㉗-㉛,㉜SG,㉟,㊱,㊳S,㊵㊷㊹㊺㊽㊿,54G,55G,56,57G,60,62-66,70,72,74S,75,76S,80,84,90,96,100,102S,108,110,114G,116,117G,120,126G,128S,138,147,154,156,196S,217,486,576

S: SKOP
G: gun

User avatar
dvgrn
Moderator
Posts: 8920
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Post by dvgrn » October 2nd, 2021, 5:16 pm

hotdogPi wrote:
October 2nd, 2021, 8:47 am
The exact error message I get:

Golly warning:

The script file does not exist:
Scripts/Lua/toLife.lua
You don't say what you do that triggers this warning -- but if you've upgraded from Golly 3.x to Golly 4.0 without re-mapping the Option+J keyboard shortcut, this is what I would expect to see when you hit Option+J. There isn't any "toLife.lua" in Golly 4.0, because Chris Rowett re-implemented LifeHistory and LifeSuper as a separate algo, so that "History" or "Super" can be appended to any rule without having to generate a separate rule table for each case.

So the first part of the fix is to use File > Preferences > Keyboard, hit Option+J (or Alt+J on non-Mac systems), and choose the file toStandard.lua instead of the outdated toLife.lua.

After that, hit Option+H or Alt+H in the same dialog box. Does the keyboard shortcut map directly to a rule table instead of to the Lua script? I have a vague memory of some Golly 3.x doing things that way? If so, re-map it in the same way to toHistory.lua, and everything should be in working order.

If it still _isn't_ in working order, then the next question is: can you run the Lua scripts from the Scripts folder by clicking on them -- or do they do the same thing when run that way, as when they're run from keyboard shortcuts?

hotdogPi
Posts: 938
Joined: August 12th, 2020, 8:22 pm

Re: toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Post by hotdogPi » October 2nd, 2021, 5:21 pm

Option-J now works. Thank you. (I don't need Option-H, as there are only problems going from multistate to two-state, not two-state to multistate.)
User:HotdogPi/My discoveries

Periods discovered: 5-16,⑱,⑳G,㉑G,㉒㉔㉕,㉗-㉛,㉜SG,㉟,㊱,㊳S,㊵㊷㊹㊺㊽㊿,54G,55G,56,57G,60,62-66,70,72,74S,75,76S,80,84,90,96,100,102S,108,110,114G,116,117G,120,126G,128S,138,147,154,156,196S,217,486,576

S: SKOP
G: gun

User avatar
dvgrn
Moderator
Posts: 8920
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Post by dvgrn » October 2nd, 2021, 6:00 pm

hotdogPi wrote:
October 2nd, 2021, 5:21 pm
Option-J now works. Thank you. (I don't need Option-H, as there are only problems going from multistate to two-state, not two-state to multistate.)
Whether it's needed or not, I'd like to know why it was broken. It's very convenient to have the shortcuts: getting rid of blue cells in a LifeHistory pattern is just [Alt|Option]J, H -- unless you want to keep other colors of cells, in which case it's Alt+K, set target state to 0, click on a blue cell.

Can someone confirm my theory that upgraded Golly 3.x instances have a leftover Alt+H mapped to a LifeHistory.rule table that no longer exists in Golly 4.0?

User avatar
Scorbie
Posts: 1642
Joined: December 7th, 2013, 1:05 am

Re: toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Post by Scorbie » October 4th, 2021, 3:03 am

dvgrn wrote:
October 2nd, 2021, 6:00 pm
hotdogPi wrote:
October 2nd, 2021, 5:21 pm
Option-J now works. Thank you. (I don't need Option-H, as there are only problems going from multistate to two-state, not two-state to multistate.)
Whether it's needed or not, I'd like to know why it was broken. It's very convenient to have the shortcuts: getting rid of blue cells in a LifeHistory pattern is just [Alt|Option]J, H -- unless you want to keep other colors of cells, in which case it's Alt+K, set target state to 0, click on a blue cell.

Can someone confirm my theory that upgraded Golly 3.x instances have a leftover Alt+H mapped to a LifeHistory.rule table that no longer exists in Golly 4.0?
Yes, I can confirm you can trigger the exact same errors this way.

Steps to reproduce:
1. Get a copy of Golly 3.4
2. Put an empty GollyPrefs file there
3. Get a copy of Golly 4.0
4. Copy the GollyPrefs file from Golly 3.4 there
5. Try to do Alt +J / Alt + K and voila! The exact same errors occur.

User avatar
dvgrn
Moderator
Posts: 8920
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Post by dvgrn » October 4th, 2021, 9:15 am

Scorbie wrote:
October 4th, 2021, 3:03 am
Steps to reproduce:
1. Get a copy of Golly 3.4
2. Put an empty GollyPrefs file there
3. Get a copy of Golly 4.0
4. Copy the GollyPrefs file from Golly 3.4 there
5. Try to do Alt +J / Alt + K and voila! The exact same errors occur.
By "Alt + K" do you mean Alt + H ? I don't think there should be any errors with Alt + K -- it just wouldn't work because it wasn't mapped in 3.4.

If you've done that and still have the 3.4 GollyPrefs available, can you check one more thing?

With the 3.4 GollyPrefs in effect, go to File > Preferences > Keyboard, click in the key text box and type Alt + H.

Is it true that the toHistory.lua script does not show up as being mapped to Alt + H? I seem to remember Andrew at one point deciding to map that key directly to the LifeHistory rule table -- which no longer exists in Golly 4.0, of course, so that would explain the difference between the errors.

User avatar
Scorbie
Posts: 1642
Joined: December 7th, 2013, 1:05 am

Re: toStandard.lua and toHistory.lua failing with "rule file is not valid" error

Post by Scorbie » October 4th, 2021, 9:33 am

dvgrn wrote:
October 4th, 2021, 9:15 am
By "Alt + K" do you mean Alt + H ? I don't think there should be any errors with Alt + K -- it just wouldn't work because it wasn't mapped in 3.4.
Whoops yes I mean Alt + H
dvgrn wrote:
October 4th, 2021, 9:15 am
If you've done that and still have the 3.4 GollyPrefs available, can you check one more thing?
Welp I had to redo the same thing because I deleted all that.
dvgrn wrote:
October 4th, 2021, 9:15 am
Is it true that the toHistory.lua script does not show up as being mapped to Alt + H? I seem to remember Andrew at one point deciding to map that key directly to the LifeHistory rule table -- which no longer exists in Golly 4.0, of course, so that would explain the difference between the errors.
That is true, and here's the window for reference (Golly 4.0 with Golly 3.4 Prefs file)
Attachments
golly-4.0-debugging.png
golly-4.0-debugging.png (47.2 KiB) Viewed 1060 times

Post Reply