BTS Unaltered Gameplay Project

Discussion in 'Civ4 - BTS Unaltered Gameplay (BUG, BAT and BULL)' started by alerum68, Aug 2, 2007.

Thread Status:
Not open for further replies.
  1. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,120
    Location:
    an Aussie in Boston
    Great - the only question is now ... what are the commands? Got a link to a suitable website somewhere?
     
  2. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Try this page on Python String Methods.

    Here are some more general Python sites: I just found a nice looking tutorial geared for people learning to program called How to Think Like a Computer Scientists. Then there's the Python Tutorial and the Library Reference.

    Things you'll find useful include

    • getting a single char: "banana"[3] -> "a"
    • slice notation (like sub/midstr): "banana"[2:4] -> "na"
    • "banana".find("an") -> 1
    • "banana".find("an", 2) -> 3
    • "banana".find("an", 2, 4) -> -1
    • "banana".split("n") -> [ "ba", "a", "a" ]
    There are two similar ways to go about parsing the format string that I can see. First is to use split("%") to chop up the string into pieces between the %'s. There are a couple corner cases you need to check in order to tell which parts are format codes and which are literal text. The other way is to scan the string yourself using find("%", ...).

    Especially read the sections about string slices. This is your old friend substr/midstr.
     
  3. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,120
    Location:
    an Aussie in Boston
    Error:
    Traceback (most recent call last):
    File "CvEventInterface", line 30, in onEvent
    File "CvCustomEventManager", line 124, in handleEvent
    File "CvCustomEventManager", line 135, in _handleDefaultEvent
    File "autologEventManager", line 265, in onEndGameTurn
    File "autologEventManager", line 822, in checkStuff
    AttributeError: 'AutoLogEvent' object has no attribute 'CIVReligion'

    I had a look at the code and it looks ok to me. Well, put it this way, it looks similar to the code I had in my mod.

    I've got the option screen done but it doesn't seem to be writing the stuff back to the ini file. Is there something that I missed or required in the callback?

    Thx for the string stuff - will look at it.
     
  4. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    :eek: Where did this come from? Is this a new bug in autolog or is it related to the naming mod you're doing?

    It should happen automagically. Did you add your new section and values to the INI file first? It will fail if the section doesn't exist, but it will add values for you (no comments though).

    Code:
    def handleBugExitButtonInput ( argsList ):
    	"Exits the screen after saving the options to disk"
    	szName = argsList
    	[b]g_options.write()[/b]
    	getBugOptionsTabControl().destroy()
    	return 1
    
     
  5. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,120
    Location:
    an Aussie in Boston
    I've been doing a few things with the logger but nothing that should interview with this.
     
  6. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    I'll take a look at the autolog bug.

    Yo Commagno!

    You wanted building icons in headers? You got 'em!

    As a start, I've added a new set of columns: building classes. If you add a building class to a page, it does a couple things.

    First, the actual column becomes the correct building for your civilization. If you add the "Walls" column, it will show the "Dun" when playing the Celts.

    Second, the header is the aforementioned building's icon. It's scrunched kinda small to fit (20x20), but is legible for the most part.

    Third, its value takes three possibilities: a red dash "-" when you cannot build that building in the city, a blue circle "o" when you can build it, a yellow circle "o" when you could build it if you weren't already building it in some other city (think wonders), or a green "x" when the city has the building.

    In any case, play around with that and see if it works for you.

    One possible downside to using building classes is that say you were building a page of all buildings that affect money. You'd like to add the Mint (Forge +10% :gold:) but cannot using this scheme without adding the Forge itself, so you're SOL. :(

    I could add the same column types for buildings (work the same but specify actual buildings) to solve this problem, but then the screen is a nightmare to manage and the code was tough to get it to work as it is. Unless it's really serious, that's not so high on my priority list.
     
  7. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    self.CIVReligion is initialized in initStuff(). I'm going to take a wild stab and guess that this happened after you modified autologEventManager while Civ was running, correct? I've found that under some circumstances when you do this, while the game reloads the modified module, it loses anything attached to self. This is the reason for all the globals in CvMainInterface -- they don't get lost.

    If you're still seeing this after a restart of Civ, please let me know.
     
  8. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,120
    Location:
    an Aussie in Boston
    Correct. I was jumping in and out of CIV while working on my unit naming code. Will try with a complete restart. Or I could turn logging off.
     
  9. Cammagno

    Cammagno King

    Joined:
    Dec 15, 2005
    Messages:
    712
    Location:
    Genoa (Italy)
    Great! :goodjob: It's like having MSDA features inside CDA, and more!
    And another very good thing is that icons come with tooltips, wonderful.

    So... a couple of requests: :blush:

    1) can I have these wonderful icons as headers also of the "normal" building columns? Even better if you can put some symbol before or after those, like putting them in brackets or so.
    2) can I have the resource icons as headers of the resource columns?
    3) is it possible to add tooltips (text-only ones will be enough) also to the other headers? I don't say you have to, if it is possible, you can create one and I think I can manage to add the others following your exemple.

    I'm not sure that I've fully understood what you meant here, but if I have, I think that's ok as it is.

    One minor bug I'm having from the beginning with our CDA is that the first time (after a new installation of BUG) in which I press the button to go to the customization table, the game crashes. Only the first time, but each first time. Maybe, if the CustomDomAdv.txt is provided, this doesn't happen. So... where does it goes? Have you already modified CDA in order to place it in MyDocs\BtS\...? If not, I think it's better to do it soon or later, even because the providing of it with BUG will be easier.
     
  10. jray

    jray King

    Joined:
    Jan 31, 2006
    Messages:
    925
    Location:
    North Carolina (USA)
    Once I got to 900 AD or so in my current game with FlavorBUG 0.05, I wasn't able to load any of my saves. I had a series of 10 or 15 saves from 900 AD onwards, ALL of which caused a CTD during game loading, even after a reboot. Older saves would load fine.

    I swapped out CustomAssets to the regular BUG 0.15 mod, and all the saves loaded fine. So I think there's a problem in FlavorBUG 0.05.

    FYI, in my own modding work I've seen a lot of these types of CTD's caused by inserting comments in XML files. Comments are supposed to be benign in XML, but believe it or not, sometimes when I would add a comment somewhere besides at the very top of the file, it would cause a CTD upon game load. I have no idea if that's the problem here, but I thought I'd offer the only advice I can think of for now as far as where to start troubleshooting. Perhaps it's just an isolated problem-- I can hope!

    See the attached save, not the very first turn on which it happened, but close. If you have trouble duplicating it, or would like an earlier save to narrow down exactly when it started happening, etc., then let me know and I'll hunt further. I'm anal about saving games and have pretty much every turn saved.

    Oh, and I have 3.02 with Solver's unofficial patch (Aug 15 version) and military academy fix installed, and nothing else, with only minor editing to BUD Mod.ini (turning on specialist stacker and disabling a few of the civ4lerts). I also have a new XPS 700 with 4Gb RAM, 512mb video, etc.... so I don't think it's hardware-related.
     

    Attached Files:

  11. jray

    jray King

    Joined:
    Jan 31, 2006
    Messages:
    925
    Location:
    North Carolina (USA)
    Perhaps you guys knew this already, but FYI I've done some thorough playtesting and verified that the civ4alerts for trades opportunities (techs or gold or gpt) are always one turn behind. That is, you get the "New techs..." message one turn AFTER it's really available, and the gold amounts are also from the previous turn. This problem has always existed, and I reported it ages ago back in the HOF mod forum, and the HOF developers said they'd look into it sometime, but I haven't heard anything.

    It'd be awesome if we could nail this down... we micromanagers otherwise need to check the Foreign advisor every single turn just to make sure we aren't a turn late with all our trades. I tried to troubleshoot it, but my Python experience is just too shabby to do much.

    Alerts for city growth/unhappy/unhealthy occur on the correct turns. It's only the trade stuff that is messed up. I think what's going on is that the code is executed in the wrong part of the turn cycle.

    BTW, I'm also getting the "City's cultural boundaries are about to expand" even though I disabled it in the INI.
     
  12. NikNaks

    NikNaks Deity

    Joined:
    Jul 25, 2006
    Messages:
    2,972
    Location:
    England
    I can't imagine it being anything to do with Solver's patch, so it's probably comments. I would advise that you don't download the latest version from the SVN, as a lot of art that the game tries to read is missing (haven't been able to upload it).
     
  13. Erendir

    Erendir Chieftain

    Joined:
    Oct 31, 2005
    Messages:
    59
    Hi

    i've tried to move attitude icons at the end of the score-lines - it would be a column so that it'll be more easier to see the attitude...
    i have just moved the "# BUG - Attitude Icons" code from CvMainInterface.py just after the line 3235 "# BUG - Power Rating - end", but no chagnes appeared... it wonders me a lot, but i'm not so good in python, so can anybody explain me why this didnt work?
    (Number 4 on the image is what i wanted to do)
    Spoiler :



    With Civ4lerts mod it must be easy to realise number 3: it shows, if AI have techs, gold or gold per turn avaible to trade...

    the images are from the post http://www.civfanatics.ru/forum/index.php?showtopic=3379&st=120# on a russian development forum of MAIN SCREEN MOD
    actual version is here: http://forums.civfanatics.com/uploads/66549/CvMainInterface.rar
     
  14. peterdiplaros

    peterdiplaros Chieftain

    Joined:
    Aug 7, 2007
    Messages:
    1
    I like some of the things proposed in the last post. I would endorse items 1, 2 and 4.

     
  15. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,120
    Location:
    an Aussie in Boston
    I know that the HOF guys had this trouble too. I think they fixed it in one of their HOF mods ... check that code to see how they did it.
     
  16. FeedBack

    FeedBack Time for some FeedBack!

    Joined:
    Oct 11, 2006
    Messages:
    523
    Location:
    Sao Paulo, Brazil
    Guys, I think I have a problem with the last SVN revision here:

    Spoiler PythonErr.log :
    Traceback (most recent call last):
    File "<string>", line 1, in ?
    File "<string>", line 52, in load_module
    File "CvEventInterface", line 13, in ?
    File "<string>", line 52, in load_module
    File "CvCustomEventManager", line 24, in ?
    File "<string>", line 52, in load_module
    File "CvEventManager", line 12, in ?
    File "<string>", line 52, in load_module
    File "CvScreensInterface", line 54, in ?
    File "<string>", line 52, in load_module
    File "BugOptionsScreen", line 16, in ?
    ImportError
    :
    No module named BugUnitNameOptionsTab

    Failed to load python module CvEventInterface.
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    Traceback (most recent call last):

    File "CvAppInterface", line 56, in onLoad

    AttributeError: 'module' object has no attribute 'onEvent'
    ERR: Python function onLoad failed, module CvAppInterface
    Traceback (most recent call last):

    File "CvAppInterface", line 70, in preGameStart

    AttributeError: 'module' object has no attribute 'showTechChooser'
    ERR: Python function preGameStart failed, module CvAppInterface
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    ERR: Call function showMainInterface failed. Can't find module CvScreensInterface
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    ERR: Call function showMainInterface failed. Can't find module CvScreensInterface
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    ERR: Call function showMainInterface failed. Can't find module CvScreensInterface
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    repeats until file gets 49Kb
    ERR: Call function onEvent failed. Can't find module CvEventInterface
    ERR: Call function showMainInterface failed. Can't find module CvScreensInterface
    ERR: Call function onEvent failed. Can't find module CvEventInterface

    And, of course, I got no interface....

    I reverted back to revision 160 and everything's okay there. Could you, please, check it out?

    Thanks in advance! :D
     
  17. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Looks like a partial check-in. Ruff: have you committed all your code for the Renamer Mod?

    Allow me to put on my "Repo Nazi" hat for a moment . . .

    <repo-nazi>

    One of the really nice things that the repository gives us is the ability to work concurrently on the same codebase.

    One of the really bad things that the repository gives us is the ability to work concurrently on the same codebase.

    Keep in mind that whatever you commit will not only affect players using the mod but also the other team members. When it comes time to commit your changes, the first thing to do after testing them is to sync to the repo -- get the latest version from the repository -- fix any conflicts, and test that it still works before committing your changes. If the repository is in a broken state, everyone is blocked from committing their work reliably.

    SVN is great in that it provides atomic commits. This means that all of your changes that belong together are either committed as a whole or not at all. Use this! Commit at the root of a directory hierarchy and select just the files that belong to the change you're committing. This way, if it fails midway through, the repo isn't broken -- it's all rolled back so you can try again.

    Also, make sure you commit all the files for a change and don't leave any stragglers, especially new files that aren't automatically added to the list of files to commit by Tortoise.

    </repo-nazi>

    Now, I'll be the first to admit that I've committed something in a hurry without proper testing, and I've broken my share of builds and forgotten to commit new files over the years, so please don't take this as a high-and-mighty you-are-bad speech. The above is how we should all strive to operate.

    In Reality(tm), people want your changes now even though you have to head off to school/work and cannot test thoroughly, or we simply make mistakes. No worries. We're all human -- even the Italians! :p
     
  18. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    It sounds like you didn't change the right file. Did you modify a file outside your CustomAssets directory? Meaning, did you unzip BUG in location X, copy it to your "My Games\BtS" folder, and then modify the file in location X?

    Check that you definitely saved the file. Another thing to do is to clear your Civ cache (search forums for exact directory), but that shouldn't be necessary (hasn't been for me yet).

    You're not getting an error, so you probably did the edit correctly. Here's how I think you have it from your description:

    Code:
    # BUG - Dead Civs - end
    
    # ... code moved from here ...
    
    # BUG - Dead Civs - start
    										if (gc.getPlayer(ePlayer).isAlive()):
                ...
    # BUG - Power Rating - end
    
    # ... to here ...
    # BUG - Attitude Icons - start
    										if (BugScore.isShowAttitude() and not gc.getPlayer(ePlayer).isHuman()):
    											iAtt = gc.getPlayer(ePlayer).AI_getAttitude(gc.getGame().getActivePlayer())
    											cAtt =  unichr(ord(unichr(CyGame().getSymbolID(FontSymbols.POWER_CHAR) + 4)) + iAtt)
    											szBuffer = szBuffer + u" %c" %cAtt
    # BUG - Attitude Icons - end
    
    											# BUG: ...end of indentation
    # BUG - Dead Civs - end
    
    Technically, you should have put it after the last line I have shown here to properly nest the start and end comments, but that won't matter since the two lines are just comments and have no effect.

    I just tested the above and it works fine on my end. I've committed the change as a stopgap until Alerum finishes his reworking of the scoreboard layout.
     
  19. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Making those headers icons too isn't so hard, but because they are drawn totally separate from the table header, decorating them will be harder. I suppose I could set the table's header to "[ ]" and see if I can get the icon to sit between the brackets.

    However, given that these columns will be wider and have totally different values (icons), what's the reason?

    I wonder why this wasn't the case already. :confused: I'll do this and make the row values be red "-" and green "x" like the buildings. Actually, should it be the number that the city has access to? I'm tempted to say "no" simply because all cities should have the same number, and in this screen you don't really care how many. If you need to know how many, just open any city that has it.

    Thoughts?

    I'll take a look at how MSDA did it. The Civ table widget doesn't support tooltips, so it would be a manual process like MSDA does. I've hacked it up a bit already, and will have to do more to get icons for the other building columns.

    Can you further explain "crashes"? Is this a crash to desktop, a Python error? And do you have to do anything other than restart Civ to get it to work?

    I agree. I haven't changed anything about where it's stored. Mine got created in the root of my BtS install folder. That needs to change for sure, but I don't really like any of the options. I think best would be to fput it wherever the INI file is found. One more thing on my list. :crazyeye:
     
  20. Cammagno

    Cammagno King

    Joined:
    Dec 15, 2005
    Messages:
    712
    Location:
    Genoa (Italy)
    If it's problematic to put the icon between the brackets, even adding some text symbol before or after is ok, it's only to differentiate from tho classbuilding columns. If it's not possible, even the symple icons are ok, though, because the need to differentiate them is not so strong.

    Two reasons:
    1) it's true that the columns will be wider due to their content, but almost always the name title is wider than the content, so using the icons allows a wide reduction anyway.
    2) the buildings' and resources' text headers are localized; this means that if I optimize the columns' size for the Italian version of the game, it will be messy for the English version and for the other localized version (and viceversa). This is why I like headers which are icons or short and not localized text.

    The only thing that I can say about it is that they were into the original CDA, I think they were removed by people who updated the mod to Warlords because of a bug linked with the zoom button problem. I'll search for a link to the original CDA.

    Ok :) Not high priority, anyway.
    [so, the tooltips on the icons came magically together with them? Cool! :)]


    Yes, they are crashes to desktop, without any message (it simply says that Civ4 has stopped working (I'm on Vista)). And no, I've nothing to do other than restart Civ. And remember that it only happens after a fresh installation of BUG (that I make previously deleting the older CustomsAssets folder).

    Yes, If you mean the BUG Mod.ini file, I agree with you. :)
     
Thread Status:
Not open for further replies.

Share This Page