Announcement

Collapse
No announcement yet.

Clerics, Corporate branch and so on...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by mapfi
    Not a bad idea if we just can't get that stupid city state...
    And to think I'm usually trying to get *out* of City State to a higher form of government...

    If the just converted city is the capital one could argue that you also might convert the civilizations leader, which then would proclaim the new religion as state religion (like it was done with christianity in old rome).
    I was thinking about that when (in Succession Game V) we converted the city of Mecca. Just something about that...
    "...your Caravel has killed a Spanish Man-o-War."

    Comment


    • #32
      Originally posted by mapfi

      Yep, if you look in that little piece of code I wrote you'll find I solved that by using a global variable to count the called events. There might be something better, though.
      But i gave a fast look in the code. and i thought i did exacly what you did (unless the captureCity event). But i will do a deeper look into it, now.

      Originally posted by mapfi
      That's my aim too,
      I have noticed the minute i saw the LeaderReligion[]. Although i have seen those religions listed above.

      Originally posted by mapfi
      Quite sure, tested it, but try it out in the game yourself.
      I will. sorry, but I still dont believe. . Anyone else has acould share us this information?

      I forgot to attach the text (Oops)
      Attached Files
      "Kill a man and you are a murder.
      Kill thousands and you are a conquer.
      Kill all and you are a God!"
      -Jean Rostand

      Comment


      • #33
        Mapfi. I have tested and debugged the slic.

        The loop is gone thanks to you. I would had stopped my work here if it werent for you.

        Everything is working just the way i wanted . Except for two things.
        1) the UnconvertCity event. It doenst work. In my code i was suposed to get a message what it doenst happen. I think it iseither was one of my mistake (which i dont think so since i gave it a look and did not found anything) or this event has bug in it (I am kind of paranoid with this since my pillaging problem in my city expansion code).

        2) The message wich asks if you want to convert all cities appear many times in the game since we used this event as function several time in the game. I suggest we change the message trigger event to another convert event. there is one event called ConvertCityOrder and, as you will see in the code i attached here, i used ConvertCityUnit, but it is 1:30 AM here. I didnt test this modification yet but i do need some sleep
        I hope you can give a look at it today as you said you could.

        Attached Files
        "Kill a man and you are a murder.
        Kill thousands and you are a conquer.
        Kill all and you are a God!"
        -Jean Rostand

        Comment


        • #34
          Isn't there a saying that goes like 'Never make promises you can't keep' ?... Looks like I won't have as much time today as I thought, since we didn't get everything we wanted done yesterday (yes, I'm a student, but I work for an insurance company right now).
          But let's have a look at the code:
          Code:
          ConvertorCiv[ReligiousCount] = city[0];		// Store the converted city
          ConvertedCity[ReligiousCount] = player[0];	// and the player who converted
          That's never going to work since you're story cities in the int array and vice versa - just switch the two
          Code:
          return tmpPlayer;	// if GetCityConvertor = 0, means city is not converted
          this comment is no longer true, since you're storing the religion when the city is created now, so it will never be 0, what this means for the code I haven't analyzed, though
          Code:
          void_f AddCityToReligionCount (city_t tmpCity, int_t tmpConvertor) {
          this function is really not necessary, since you've got every city already in the array by default (when it's created), so you just need to store the new religion value in the appropriate place

          The handling of the ConvertCity event looks fine. If you used it for the 'DoYouWantToConvert' trigger it's clear that the message boxes will appear over and over again, since you're in a loop there too. The problem with the ConvertCityUnit event I see is that I'm not really sure if it determines already the conversion in the game or if there's still a probability check with some constant. Does the Kill() in the code just stop you're event handler or also the event that triggered it? I don't know, really. But if not, then you can't habe the 'DoYouWantToConvert' be 'pre'.

          Now for the Reformation, same reasoning with kill() and 'pre' here.

          So much for now, work here I come...

          Comment


          • #35
            Originally posted by mapfi


            Code:
            ConvertorCiv[ReligiousCount] = city[0];		// Store the converted city
            ConvertedCity[ReligiousCount] = player[0];	// and the player who converted
            That's never going to work since you're story cities in the int array and vice versa - just switch the two
            Oops
            Originally posted by mapfi
            Code:
            void_f AddCityToReligionCount (city_t tmpCity, int_t tmpConvertor) {
            this function is really not necessary, since you've got every city already in the array by default (when it's created), so you just need to store the new religion value in the appropriate place
            There ar two reasons i added this funtion. First because it appears many times in the game. Second to make easier to you to
            change for that .# if you want. Other than that i am aware that a three lines funtion is a bit unecessary.

            Originally posted by mapfi
            Code:
            return tmpPlayer;	// if GetCityConvertor = 0, means city is not converted
            this comment is no longer true, since you're storing the religion when the city is created now, so it will never be 0, what this means for the code I haven't analyzed, though
            This comment should be erased. As you may see i even took the GetCityConvertor == 0 off the every turn gold and the sell indulgences. Yet you were right about the cities loosing their converted cities when enacting new govs . This means we have to come up with an idea to fix this bad feature. I suggest we make the begin turn event convert all cities in the count again. Or Unless there is a government enacted event wich i think i read somewhere that there isnt. Maybe we will probably
            have to edit the create city event (this remind me that i didnt tested this event. And the getCityConvertor == 0 may come back.

            Originally posted by mapfi
            The handling of the ConvertCity event looks fine. If you used it for the 'DoYouWantToConvert' trigger it's clear that the message boxes will appear over and over again, since you're in a loop there too.
            I noticed that. and only solved by placing the kill() before the code. Bt i will wait to see how you'll fix this.
            This loop thing is much more common than i imagined (As i said before i dont have experience with programming. All I know comes from the Locutus/IW Slic learning texts.
            I am getting a bit paranoid with this loop thing. thinking that the pillaging bug may be a loop (but it is such simple code). I think i will send it those to you to.

            Originally posted by mapfi
            The problem with the ConvertCityUnit event I see is that I'm not really sure if it determines already the conversion in the game or if there's still a probability check with some constant. Does the Kill() in the code just stop you're event handler or also the event that triggered it? I don't know, really. But if not, then you can't habe the 'DoYouWantToConvert' be 'pre'.
            Now for the Reformation, same reasoning with kill() and 'pre' here.
            As far as i know the kill() doesn stop anything. It just closes the messagebox.

            Originally posted by mapfi
            So much for now, work here I come...
            Good Luck
            "Kill a man and you are a murder.
            Kill thousands and you are a conquer.
            Kill all and you are a God!"
            -Jean Rostand

            Comment


            • #36
              As for the AddCityToReligionCount, it just makes the array bigger by adding cities even they're already in it. That's what bothered me. Furthermore you rely on the GetCityConvertor function to test the whole array until the end even if it already hits the city, so you'll get the exact value. And it might just be, that we can change that. I don't know if slic has a break order though. Anybody?
              Code:
              tmpplayer = player[0];
              religion = PlayerReligion[tmpplayer];
              AddCityToReligionCount(city[0], PlayerReligion[player[0]]);
              this is in the ConvertCity handler, you can put religion as argument of the function to keep it simple...

              Another thing I spotted, in the UnconvertCity handler you assign player[0] = Religion for no apparent reason. ?

              Quoting myself:
              Does the Kill() in the code just stop you're event handler or also the event that triggered it?
              That's something I need to know before I start on this again. Anybody?

              Hey, it seems like I'm always bickering about your code. It's good and a lot of work, though and so gets us really farther ahead.

              Comment


              • #37
                This line wrongly went inside on one of your quotes in my last post. I fix it. But i am afraid you wont read it again.

                "As far as i know the kill() doesn stop anything. It just closes the messagebox."

                the player[0] variable is for the messages.

                I can only say that i wish i had someone "bickering" every code i make like you do with this one.
                "Kill a man and you are a murder.
                Kill thousands and you are a conquer.
                Kill all and you are a God!"
                -Jean Rostand

                Comment


                • #38
                  Originally posted by mapfi
                  I don't know if slic has a break order though. Anybody?


                  I don't think so, but if you put the loop in a function of its own then you can use return to get out of the function and thus break the loop.

                  Quoting myself:
                  That's something I need to know before I start on this again. Anybody?


                  AFAIK the kill() will only stop the message box.

                  IIRC if you want to cancel the event you must return STOP;

                  Comment


                  • #39
                    Well, your UncovertCity handler was pre, so the result is, that whatever you program with your messageboxes it will still unconvert the city at the end, so that's why your code doesn't work in that part. Either you change it to post or use that stop order if it works.

                    player[0], ah yes, in the text part, forgot that...

                    note: don't get too excited seeing that your code got downloaded twice , that's me, since I got to have it at work and on my laptop.

                    well, i'll see if I can find the time to work on something tonight or tomorrow...

                    Comment


                    • #40
                      Originally posted by mapfi
                      note: don't get too excited seeing that your code got downloaded twice , that's me, since I got to have it at work and on my laptop.

                      Originally posted by mapfi
                      Well, your UncovertCity handler was pre, so the result is, that whatever you program with your messageboxes it will still unconvert the city at the end, so that's why your code doesn't work in that part. Either you change it to post or use that stop order if it works.
                      ...
                      well, i'll see if I can find the time to work on something tonight or tomorrow...
                      I will wait to see how it is going to look like before continuing the work in it. Keep me informed of the changes.
                      "Kill a man and you are a murder.
                      Kill thousands and you are a conquer.
                      Kill all and you are a God!"
                      -Jean Rostand

                      Comment


                      • #41
                        As I said I wanted to give bonuses to the player depending on the religion. What kind of methods do we have to do just that, preferably for each city?
                        I tried to write into the city variable properties but that seems to be read-only.
                        I can only think of giving/taking gold of/from the player and city specific to add happiness by the HappinessTimer event. Anything else that you guys know of?

                        John: of course, return breaks it, why didn't I think of that... thanks. I couldn't find stop in the documentation but abort(). I'll just try.

                        edit: don't you just hate it when you find dozens of spelling mistakes the moment you posted it...

                        Comment


                        • #42
                          Originally posted by mapfi
                          As I said I wanted to give bonuses to the player depending on the religion. What kind of methods do we have to do just that, preferably for each city?

                          I tried to write into the city variable properties but that seems to be read-only.
                          I can only think of giving/taking gold of/from the player and city specific to add happiness by the HappinessTimer event. Anything else that you guys know of?
                          I posted a request to locutus the best ideas discussed in the best of all worlds thread. They've dicussed a lot about religion and culture but i was too lazy to follow the dicussion and its long posts .

                          Originally posted by mapfi
                          John: of course, return breaks it, why didn't I think of that... thanks. I couldn't find stop in the documentation but abort(). I'll just try.
                          Abort() is used only to prevent messages to be sent. It does not affect the code.
                          (Like text(string), title(string), show(), kill(), button and others it can only be used in message codes.

                          Originally posted by mapfi
                          edit: don't you just hate it when you find dozens of spelling mistakes the moment you posted it...
                          Most of the post i send i have to edit more than two times. And you still find lots of mistakes in them.
                          "Kill a man and you are a murder.
                          Kill thousands and you are a conquer.
                          Kill all and you are a God!"
                          -Jean Rostand

                          Comment


                          • #43
                            Originally posted by mapfi
                            John: of course, return breaks it, why didn't I think of that... thanks. I couldn't find stop in the documentation but abort(). I'll just try.
                            You could visit Locutus' uni home page. There you can find some Slic1 documentation and the edit plus syntax files. The Slic1 documentation contains some stuff about message boxes that isn't be foound in the documentation found here on Apolyton.

                            Originally posted by mapfi
                            edit: don't you just hate it when you find dozens of spelling mistakes the moment you posted it...
                            Fortunatley I find my spelling, grammer and missing words mistakes some months later usually. So I am not too bothered with them. Of course for a readme or strings in a mod it is more important.

                            -Martin
                            Civ2 military advisor: "No complaints, Sir!"

                            Comment


                            • #44
                              Just noticed all this. This is a great idea! I've glanced over the code Pedrunn posted above and here's a few comments;

                              1) Re the AddCityToReligionCount function:

                              this function is really not necessary, since you've got every city already in the array by default (when it's created), so you just need to store the new religion value in the appropriate place
                              I agree with Mapfli; I think this is what you want:

                              Code:
                                
                              void_f ChangeCityReligion (city_t theCity, int_t tmpConvertor) {
                              
                              int_t i;
                              city_t tmpCity;
                              
                                   tmpCity=theCity;
                                   for(i = 0; i < ReligiousCount; i = i + 1) {
                              	    if(tmpCity == ConvertedCity[i]) {
                                            ConvertorCiv[i] = PlayerReligion[tmpConvertor];
                              	    }
                                  }
                              }
                              Then you can change the following handler to:

                              Code:
                              HandleEvent(ConvertCity) 'ConvertCityAccordingToReligion' post {// When a city was converted
                              int_t i;
                              int_t tmpplayer;
                              int_t religion;
                              	if(CityIsValid(city[0])) {// maybe not necessary, but safe
                              		
                              		ChangeCityReligion(city[0],player[0]);							
                              	}
                              }
                              I haven't looked at the other places where you used AddCityToReligionCount, but doing it this way would mean that you'd have to make changes there.

                              Notice in the above function that I've got two city type variables where you'd think one would be sufficient. This is because of a bug in SLIC:

                              Important note! As this documenation is being prepared, the first patch for CTP2 is about to be released. Unfortunately a bug with functions was discovered too late to fix. Specifically, in some cases, using members of unit, army, city,and location variables that are function parameters may not always work as expected. There is, however, a workaround. Copy the function parameter to a local variable and use that variable instead. Example:

                              // This version may fail sometimes!
                              int_f DoesAHumanOwnThisUnit(unit_t theUnit)
                              {
                              if(IsHumanPlayer(theUnit.owner)) {
                              return 1;
                              }
                              return 0;
                              }

                              // This version should always work
                              int_f DoesAHumanOwnThisUnit(unit_t theUnit)
                              {
                              unit_t copiedUnit;
                              copiedUnit = theUnit;
                              if(IsHumanPlayer(copiedUnit.owner)) {
                              return 1;
                              }
                              return 0;
                              }

                              The author apologizes for this and promises that if there is another patch it will be fixed. But the above workaround should always work.

                              2) The 'PlayerHasConverted' message at line 131 is sent to AllButOne via an Alertbox. I don't think you can do this. For one thing AlertBoxes are modal, which means that they must contain at least one button which must be pressed before the game can continue. Your's doesn't have a button. Also, I can't see how you can send an Alertbox to an AI civ: they can't press buttons.

                              So, I guess you just want to use a messagebox.

                              3) Do you have DebugSlic=Yes? You must have it turned on while you're debugging your code, otherwise you're bound to end up with lots of errors that you don't know about.

                              When the next version comes out I'll try to have a more detailed look at it.

                              Comment


                              • #45

                                I'm pissed off. I've been working on this thing for hours now and it just makes fun of me. Furthermore I kept editing the code and what it looks now to the worse and I didn't save all the different versions. So I'm fed up and need to go to bed. Just some stuff that came up:
                                • if you test with debugslic=yes you'll get an array out of bound when you try to write into player[1] in the convertciv trigger
                                • The part Peter posted about the function in function or so is the one I mentioned like in the second or third post. well, it means we gotta rewrite the thing with lots of tmp variables
                                • i'm not that sure about convertcityunit event, like you said - it doesn't seem to work. we have to find another solution here - that needs a lot of thinking with logic so I'll do that tomorrow when I've slept enough


                                That was about Pedrunn's code. Now the other problems I ran into:
                                • where is the ai told that converted cities are something bad? Ihave to turn that off, otherwise my idea with different religions and for each one a colour (unlike Pedrunn's with a native religion to each player) won't work
                                • a newbie to slic question - is player[0] the player who's got the turn or the one defined in the called event? Actually it's pretty clear that it is the first one but a wrong thought like that screwed me up big time today...


                                So, more tomorrow,

                                Comment

                                Working...
                                X