Requesting following features

when you end war you get a message saying:

"brennus has made peace with washington"

or simmilar, what we need you to do is disable these messages!
 
actaully that's a point... Baldyr we are going to have to use a special method for this! If asaf manages to disable them that will also take away the sound of peace (great :p) so we are going to have to put it back, however I have already worked on code like this in my own programming :D

Code:
from winsound import *
def playSound(n = 1, name = '[B]TheirMakePeace[/B].wav'):
    while n > 0:
        PlaySound(name, SND_FILENAME)
        n += -1

TheirMakePeace.wav needs to be kept in the python folder alongside the code! (unless you know how to link with the vanilla sound folder)

to play the sound once it is called as

playSound()

So I guess my learning has just come in handy! :D I guess the function should be put in helpers or something I don't know...
 
actaully that's a point... Baldyr we are going to have to use a special method for this! If asaf manages to disable them that will also take away the sound of peace (great :p) so we are going to have to put it back, however I have already worked on code like this in my own programming :D

Code:
from winsound import *
def playSound(n = 1, name = '[B]TheirMakePeace[/B].wav'):
    while n > 0:
        PlaySound(name, SND_FILENAME)
        n += -1

TheirMakePeace.wav needs to be kept in the python folder alongside the code! (unless you know how to link with the vanilla sound folder)

to play the sound once it is called as

playSound()

So I guess my learning has just come in handy! :D I guess the function should be put in helpers or something I don't know...

You should place this code in a new Python file, for example, I've got a Python file in my mod, called JemonHelp.py, I use it for posting messages to the message view under the tech bar.
This is my file, where I've taken the message code from Civ4lerts, because it's insanely useful to be able to use whenever I want.

Code:
from CvPythonExtensions import *
import CvUtil
import Popup as PyPopup
import PyHelpers
import CvEventInterface
import autolog

# GLOBALS
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
gc = CyGlobalContext()
localText = CyTranslator()
game = CyGame()

class JemonHelp:
	def addMessageNoIcon(self, iPlayer, message):
		"Displays an on-screen message with no popup icon."
		self.addMessage(iPlayer, message, None, 0, 0)

	def addMessageAtCity(self, iPlayer, message, icon, city):
		"Displays an on-screen message with a popup icon that zooms to the given city."
		self.addMessage(iPlayer, message, icon, city.getX(), city.getY())

	def addMessageAtPlot(self, iPlayer, message, icon, plot):
		"Displays an on-screen message with a popup icon that zooms to the given plot."
		self.addMessage(iPlayer, message, icon, plot.getX(), plot.getY())

	def addMessage(self, iPlayer, szString, szIcon, iFlashX, iFlashY):
		"Displays an on-screen message."
		eventMessageTimeLong = gc.getDefineINT("EVENT_MESSAGE_TIME_LONG")
		CyInterface().addMessage(iPlayer, True, eventMessageTimeLong,
								 szString, None, 0, szIcon, ColorTypes(-1),
								 iFlashX, iFlashY, True, True)

Then, to use my code, I use this:
Code:
import JemonHelp
JemonHelp = JemonHelp.JemonHelp()
At the top of any file that I want to use the code, then in my code, for this example, I've used:

Code:
JemonHelp.addMessageAtPlot(iPlayer, message, 'Art/plotlistenhancements/medallion_cantmove_gg.dds', pPlot)

So, for your code, I'd suggest you make a Help file like that, then add your code in like this:
Code:
from winsound import *

class [COLOR="Red"]YourClassName[/COLOR]:
	def playSound(self, n, name):
		while n > 0:
			PlaySound(name, SND_FILENAME)
			n += -1

Notice I've removed the file name and number from the code?
To call this code, you'd use
Code:
import YourPythonFile

YourPythonFile = YourPythonFile.YourClassName

YourPythonFile.playSound(1, 'TheirMakePeace.wav')

This allows you to be much more flexible, using different sound files without doing much changing of code, and setting the n value yourself, so you can play a sound more than once, without much editing.
 
If I wanted to do that all I would have to do is the exact same thing :p

playSound(10, 'Alarm.wav')

it defaults at TheirMakePeace as that's what we need it for but can be changed :p Why do you need the class, what benefit is it exactly?

edit: the n = 1 and name = 'TheirMakePeace.wav' is there so that the function can be called as playSound() meaning it is played once and on Peace sound. however we could make it playSound(2) playing Peace twice or playSound(2, 'Alarm.wav') playing the alarm twice... see?

oh we do have our own file for all our functions aswell :p but thanks anyway!
 
If I wanted to do that all I would have to do is the exact same thing :p

playSound(10, 'Alarm.wav')
I totally forgot you could do that :mischief:

Why do you need the class, what benefit is it exactly?
I have no idea, the file I copied and emptied out for my file had a class, so I thought it'd be a good idea to keep it :lol:

edit: the n = 1 and name = 'TheirMakePeace.wav' is there so that the function can be called as playSound() meaning it is played once and on Peace sound. however we could make it playSound(2) playing Peace twice or playSound(2, 'Alarm.wav') playing the alarm twice... see?

oh we do have our own file for all our functions aswell :p but thanks anyway!
Well, that's good :D
I have a tendency to break things, so I keep all my separate Python code in modules, so when I break something, I know exactly where and why, and then add them into the main code when I'm sure they work properly, or just never move them.. I'm pretty lazy, so it's really timesaving to have a small module just for little pieces of code like that :D
 
:p well good to know I am not missing anything!
 
No, no... Don't bother with the sound nonsense. There is already support for this in the CivIV Python API and I will be able to add it to the mod, no problems.
 
oh..... Mine's better :p :lol:
whats that method like then?
 
What I'm saying is that you don't need to do anything. Because its already there.
 
You only need to implement these changes in Helpers:
Code:
def addMessage(tag, tValues, eColor, tCoords=(-1, -1), [COLOR="Red"]sound=""[/COLOR]):
        """
        Adds the tag (string) message to the game in eColor. (The preset pointers to valid
        ColorTypes are eRed, eGreen and eWhite. A None value will disable the message.) If
        the tag argument requires other values to be included in the message, then these
        can be supplied with the tValues (tuple) argument. The optional tCoords (tuple)
        argument is set to a pair of default -1 values that indicate that no arrow should
        accompany the text message. (Valid map tile coordinates will enable the arrow.)
[COLOR="Red"]        The sound argument (string) can point to the location of an optional sound file.[/COLOR]
        """
        if eColor == None: return
        message = Translator.getText(tag, tValues)
        bArrow = tCoords != (-1, -1)
        Interface.addMessage(pHumanCiv.get(playerID), True, 20, message, [COLOR="Red"]sound[/COLOR], eMinorEvent, "", eColor, tCoords[0], tCoords[1], bArrow, bArrow)
Done. You don't need anything else for this, and you don't even need to use a separate function call. Its another non-issue.
 
hey that is cool! Mine was still pretty good... Took a while to make that when I first needed it!

No problem I will implement this to the message function now!
 
while I continue finding names I wanted to know how it is all going

and whether you can remove the peace messages from ending war asaf (incase you didn't see, look above :p)
 
while I continue finding names I wanted to know how it is all going
I'm not doing anything on this until you finish a set of data for us to use. I'm not gonna develop something that has to be completely over-hauled once you figure out what you wanna do with it.

Just put down what you have - and worry about "completing" the whole thing once we're done with the technical aspects of it.

and whether you can remove the peace messages from ending war asaf (incase you didn't see, look above :p)
I just don't think that he understood your request. And he might also be too pressed for time at the moment. :p
 
I just don't think that he understood your request. And he might also be too pressed for time at the moment. :p

Yes to both.
 
when do you think you are able to do it?

What I mean is can you disable the messages + sounds that occur when 2 civs make peace with each other:

Julius Caesar has made peace with washington!
 
yep, we will deal with all of this on our end. The problem is that when a rebellion occurs every civ apart from the target makes peace with the rebels, so when you know everyone it is very annoying to get 6 (I think) peace messages all in a line :p
 
Back
Top Bottom