1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Patch Bug Appeal

Discussion in 'Civ2 - Scenario League' started by techumseh, Feb 8, 2020.

  1. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
  2. JPetroski

    JPetroski Deity

    Joined:
    Jan 24, 2011
    Messages:
    2,461
    Does converting the events (with @Prof. Garfield 's converter) to lua solve this issue? Because I didnt find the converter to be particularly troublesome to use (any issues I encountered were due to errors I had made in the macro.txt).

    A permanent fix would be best of course, but I'm curious if this is an issue that can be addressed in the meanwhile with minimum effort.
     
  3. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    That is not what I'm looking for John. I will most likely try to utilize Lua in a scenario in the near future. But I've just spent months overhauling the events of Burma Campaign and I'm now beginning that process with Sea Lion. There are dozens of ToT scenarios out there that may not work properly because of the Patch bug. I've spent quite a bit of time and effort to isolate the issue. I'd like TheNamelessOne to fix the problem. And I'd very much appreciate the support of my colleagues in bringing this to his attention.
     
  4. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    2,638
    Location:
    Ontario
    John's point is that if the events are converted to Lua, then we have a work around. Lua will keep track of the continuous information in the state table (which we've used enough to know is reliable) instead of the ordinary location in the saved game. If my code doesn't imitate the macro system, then I or someone else can change it. (That is, unless the lua 'interface functions' with the game are bugged in some way, which might be the case with the negotiation event.)

    I've 'stripped down' my converter, so it can just be pasted into a scenario folder, and convert the events (provided they do not have errors). As a bonus, it will also fix the road multiplier bug for rules files that do not have a COSMIC2 section. It won't work for scenarios that have multiple events files (like Burma), but I can add that feature if you want it.

    I just tested it briefly on @tootall_2012 's A House divided, and it worked after I fixed the events. (It needed an @IF at line 127).

    If you have any problems with the converter, let me know.

    I agree that this a bug that should be fixed when TNO comes back. But that's kind of the point, that he (or she?) is gone and doesn't seem to be frequenting the forums at the moment. Those of us working with lua have occasionally brought up issues in the TOTPP thread, some of which are almost certainly dead simple to fix if you have the TOTPP source code (I'm thinking particularly of modifying terrain types, where all he would have to do is get rid of the condition that the new input has to be between 0 and 16, and we could then place rivers via event). Since that sort of thing hasn't been fixed, I'm inclined to think that trying to get TNO's 'attention' isn't likely to work, and we're better off just making a convenient list of issues agreed by the community to be 'very important' to address. And I do agree that this is one such issue.
     

    Attached Files:

  5. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    This is what I feared when TNO introduced Lua, which is that it will split the community. I said as much at the time. I am not interested in a debate about whether or not I should be adopting Lua, or whether is the answer to this issue. The Patch, as far as I can ascertain, has a bug which severely weakens the Macro events, which I should remind you, is the events language that was developed for Test of Time by the people who designed the game.

    Lua requires a level of programming skill that most of us do not posses. Despite your admirable efforts to make it more accessible, it remains out of reach for most of us. Frankly, at this point in my design career (if you can call it that), I am not interested in learning another and more complex language. So far, it looks like Lua scenarios require a two person team: a designer and a programmer. I count two programmers to date; yourself and Knighttime. I have yet to see one produced by a single individual. I will remind you that when I asked for your help in developing a Lua scenario, you declined. Knighttime has indicated that he is open to collaboration, which I very much appreciate, but the details have yet to be sorted out.

    I made Burma Campaign work without Lua, and I am confident I can do the same with Sea Lion. That's not the point. ToTPP has seriously damaged the usefulness of the Macro events language, and TheNamelessOne should rightfully sort it out. There are dozens of scenarios that were made before Lua and even before ToTPP. Your proposed solution is not the answer for them.

    As I said, I am not interested in a debate with the Lua converts. What I'm asking for is a little solidarity from my comrades.
     
  6. CurtSibling

    CurtSibling ENEMY ACE™ SLeague Staff Supporter

    Joined:
    Aug 31, 2001
    Messages:
    28,761
    Gender:
    Male
    Location:
    Innsmouth
    Can any of our programmers break into ToTPP and fix this issue? Or is TNO the sole wizard able to hack the patch?
     
  7. JPetroski

    JPetroski Deity

    Joined:
    Jan 24, 2011
    Messages:
    2,461
    You absolutely have it and I'm not trying to annoy you. If TNO ever comes back I will certainly aid you in bringing this to his/her attention. All I'm saying is that the converter is much like choice.exe once was. A workaround when new technology broke the old. Luckily, it's not that much more difficult to use, either. So, yes, a permanent fix for the root cause would be best, but, the sky hasn't fallen and @Prof. Garfield has created a workable solution in the meanwhile.

    While we're waiting for a permanent fix, if there is a particular scenario that isn't working for you due to the continuous bug, I'm happy to convert it for you. All you have to do is build it 100% as you always have and then give me the files once you're done. This would not be a huge time commitment and would be best done in large amounts now while our programmers are still interested and available in case we notice issues.

    I think you probably should at some point because I believe the point Tech is making is that every single scenario out there that had a continuous modifier (which is probably all of them) don't currently work. It's an easy enough fix (simple enough that designers vs. coders could go through and fix the old albums and upload patches for them) but only if the tool allows for multiple event files (as most large scenarios eventually came to have). This is something I (and others) could probably do much like the modified scenarios page.

    It's not something that is easy to learn, that is for sure. What has always interested me most about designing these things was overcoming obstacles (look at all the ways we've exploited bugs, or "broken" the game to get effects we wanted over the years), so I've been trying to learn. If you don't have an interest, you can continue to use macro.txt. It's a small ask to get someone to help you with the converter, or even adding in a module or two (like munitions). Germanicus now has them and it wasn't a very big project.
     
  8. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    2,638
    Location:
    Ontario
    @techumseh the code I posted last night does not require any knowledge of Lua to use. The conversion code I've posted before did require a bit of Lua knowledge, mostly because I envisioned it as a means to add lua specific features to an existing scenario, so the user presumably already had a bit of Lua experience.

    However, this issue is different, so I've lowered the technical requirements. Fortunately, there are fewer unknowns on my end, so the user doesn't have to make decisions.

    Here are the instructions to use the fix I posted last night:

    1. Extract the contents of the zip file.
    2. Copy the three files into the folder of the scenario you want to run with Lua.
    3. Rename events.txt and rules.txt so that these two file names are entirely lower case (I don't think it is necessary, but it won't hurt anyway.)
    4. Start the scenario, and use Lua events.
    5. If there are errors in the events, either comment them out with semicolons or fix them. The lua console will appear upon error and give you the line of the last good event, so this shouldn't be too difficult.

    If there are issues, then report them as bugs and I can fix them.

    If this is an acceptable level of effort for a work around, then I'll look into making it work for events changed by batch file and events chosen at random.

    Unfortunately, this requires more skill than programming in Lua. I don't know how to do it.

    Broadly speaking, there are two kinds of programming languages: interpreted languages (like Lua and Python) and compiled languages (like C/C++ and FORTRAN).

    The difference is that when you want to run the code from an interpreted language, you just provide that code to the interpreter, and your instructions are carried out.

    Compiled languages, on the other hand, are converted to machine code when they are 'compiled', and then you run the machine code (like an .exe file). Figuring out what part of the machine code does what, and making changes to it, is much more difficult than changing source code (which is why we use source code in the first place). TNO didn't leave us the source code for TOTPP, so we can't even learn from that.

    About this bug, do we know if it impact all scenarios, or just scenarios that use certain TOTPP features? I don't remember running into it when I was testing out the macro language to figure out exactly what things did. For example, does it only affect scenarios that use custom landmarks or resource locations?
     
  9. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    Thank you. And I do appreciate your efforts and your help. The converter will be very useful, initially just to find the errors in the Macro events. When I reworked the Burma events, I spent a lot more time finding and fixing my own errors (many of which had nothing to do with syntax), than I did doing the workarounds for the continuous events. It will be the same with Sea Lion, and I'll try to utilize the converter to find them once I've fixed the continuous events. Luckily, the Sea Lion events are much simpler than in Burma Campaign, so it shouldn't take me more than a week or so.
     
  10. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    I've finished the events work around, eliminating the use of the 'continuous' event modifier. I did what you said, but I don't know what "Start the scenario, and use Lua events" means. How do you use Lua events? The scenario just loads as usual.

    (edit) I have ticked the Lua scripting and the Lua scenario events boxes before launching the scenario. There must be something else?
     
    Last edited: Feb 13, 2020
  11. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    2,638
    Location:
    Ontario
    Do you get this box?

    LuaWarning.png

    If you do, then either the scenario should start, or the Lua console should appear with an error.

    What? My event converter is supposed to accept the continuous modifier. Do you mean to say that it threw an error for every single event with a continuous modifier? If that's the case, then either those events were written incorrectly, or my converter needs to be fixed, since it is supposed to accept all valid macro events.
     

    Attached Files:

  12. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    1) I do not get the box.

    2) It was always my plan to rework the Macro events so that the failure of the continuous modifier would not hurt the scenario, just as I did with Burma. I simply substitute spare technologies as repeating triggers, in place of continuous modifiers. That work is now complete and I want to check the Macro events for errors, of which I'm sure there are many. If that also gives me a working set of Lua events, then even better. I can release it as a Lua scenario.
     
    Last edited: Feb 14, 2020
  13. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    2,638
    Location:
    Ontario
    Maybe you chose to trust the file in the future, so you aren't being asked again. To check that the Lua events are active, open cheat mode and the Lua console. The list of all the parsed events should appear, if Lua events are being used.

    Oh, okay.

    There isn't much point in releasing as a 'Lua Scenario', unless you plan to make some enhancements. If that's the case, one of my in progress projects is a 'template' scenario folder that already has functionality 'linked together', so it might be best to wait for that. Maybe play with the 'sneak preview' I did with Imperialism II for the city production restrictions, or with JPetroski's Germanicus, to get your feet wet.
     
  14. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    Nothing. I opened cheat mode and everything is standard. No Lua console is visible. I do get the "configure ToTPP" box, btw. I play Test of Time on my old computer running Windows XP. Could that be an issue? Or maybe way back I missed some installation of Lua components? Your three files have been installed in the scenario folder, btw.
     
  15. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    OK, some progress. I installed ToTPPv15.1 and the console now appears. Clicked "show console on error" and "OK". "Load this time". Loaded Sea Lion scenario. "Error loading events.lua. Details have been logged to the console (Ctr-Shift-F3)". The console appears with a bunch of data, with the "Load Script" button. Try button - fail. Try (Ctr-Shift-F3) - fail. Begin Scenario box appears. Try button - fail. Try (Ctr-Shift-F3) - fail. OK. Pick civilization box appears. German. Try button - fail. Try (Ctr-Shift-F3) - fail. And so on, until the scenario starts and the console disappears.
     
  16. JPetroski

    JPetroski Deity

    Joined:
    Jan 24, 2011
    Messages:
    2,461
    When you finally get into the game and press ctr-shift-f3, can u paste what shows up in the white box?
     
  17. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    There is no white box.
     
  18. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    2,638
    Location:
    Ontario
    Once you get into the game, you have to enable cheat mode to open the console with CTRL+SHIFT+F3. The information printed to the console should remain. You can copy and paste information from the console.

    Most of the data that appears is just confirmation that the event was parsed correctly, and the last line number of that event. At the very least, jumping to the line of the last successfully parsed event in your text editor will tell you what event has a problem. I'll be able to tell you what the error generated means. (I'll probably have to post a legend about them at some point, since they refer to certain details of how the parser works.)
     
  19. techumseh

    techumseh Emperor

    Joined:
    Mar 12, 2002
    Messages:
    1,504
    Location:
    in the frozen north
    That seems to work. Thanks! It looks like 289 events are sound. Here's what apparently doesn't work:

    ...rose\Test of Time\Scenarios\Sea Lion\getLegacyEvents.lua:369: Event file 1 at line number 5454 doesn't have an

    open action.
    stack traceback:
    [C]: in function 'error'
    ...rose\Test of Time\Scenarios\Sea Lion\getLegacyEvents.lua:369: in main chunk
    [C]: in function 'require'
    ...se\Test of Time\Scenarios\Sea Lion\legacyEventEngine.lua:20: in main chunk
    [C]: in function 'require'
    ...es\Microprose\Test of Time\Scenarios\Sea Lion\events.lua:59: in main chun

    So, how do I find the event at 5454? Once I fix it, do I have to redo the process to identify the flawed events one at a time, or is that it?
     
  20. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    2,638
    Location:
    Ontario
    If you're using notepad, try turning OFF 'word wrap' (in the format menu), then use ctrl-G to go to line 5454.

    Or, get a proper text editor like notepad++ that will display line numbers for you.

    You will have to re-do the process for each event. I didn't really conceive this as an event checker (though after changes are made, the line numbers wouldn't match anyway), and it is possible that it will accept certain kinds of incorrect events, that will either be revealed at runtime, or which the parser 'understands', but the macro engine in the original game wouldn't.
     

Share This Page