<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://bf2tech.uturista.pt/index.php?action=history&amp;feed=atom&amp;title=Python_Cookbook</id>
	<title>Python Cookbook - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://bf2tech.uturista.pt/index.php?action=history&amp;feed=atom&amp;title=Python_Cookbook"/>
	<link rel="alternate" type="text/html" href="https://bf2tech.uturista.pt/index.php?title=Python_Cookbook&amp;action=history"/>
	<updated>2026-08-05T23:54:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://bf2tech.uturista.pt/index.php?title=Python_Cookbook&amp;diff=84&amp;oldid=prev</id>
		<title>Pireax: Created page with &quot;This is a &quot;cookbook&quot; of short, simple snippets of Python code that illustrate how to do some common BF2 programming task. Cookbook items will generally not be complete scripts...&quot;</title>
		<link rel="alternate" type="text/html" href="https://bf2tech.uturista.pt/index.php?title=Python_Cookbook&amp;diff=84&amp;oldid=prev"/>
		<updated>2018-06-21T19:26:40Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This is a &amp;quot;cookbook&amp;quot; of short, simple snippets of Python code that illustrate how to do some common BF2 programming task. Cookbook items will generally not be complete scripts...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is a &amp;quot;cookbook&amp;quot; of short, simple snippets of Python code that illustrate how to do some common BF2 programming task. Cookbook items will generally not be complete scripts--see the [[Scripts|Scripts]] section for those. On the other hand, cookbook entries should be more than just the name of a method or event to use--see the [[Object_Reference|Object Reference]] and the [[Event_Reference|Event Reference]] for those.&lt;br /&gt;
&lt;br /&gt;
Please contribute your BF2 Python &amp;quot;recipies&amp;quot; to this cookbook! All cookbook entries should follow the format of the [http://www.oreilly.com/catalog/pythoncook2/index.html O&amp;#039;Reilly Cookbooks]: each recipie should have three sections: &amp;#039;&amp;#039;&amp;#039;The Problem&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;The Solution&amp;#039;&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;&amp;#039;Discussion&amp;#039;&amp;#039;&amp;#039;. Please list your user name as the recipie contributor, as well.&lt;br /&gt;
&lt;br /&gt;
If you have corrections or improvements to these recipies, feel free to update their pages; if you just want to comment about them or ask questions, put those on the appropriate discussion page (push the &amp;quot;discussion&amp;quot; tab at the top of the page).&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re looking for a general Python cookbook (not specific to BF2), check out the [http://aspn.activestate.com/ASPN/Python/Cookbook/ ActiveState Python Cookbook]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
== CD Keys  ==&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Accessing_CD_Key_Hash|Accessing CD Key Hash]]: How to access the CD key hashes of connected players from within BF2 Python programs.&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Computing_CD_Key_Hashes|Computing CD Key Hashes]]: How to convert a CD key into the hash used by BF2.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Dynamic Programming  ==&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Changing_Objects_At_Runtime|Changing Objects At Runtime]]: How to dynamically add or change attributes and methods of objects while a program is running; useful for overriding the behavior of standard BF2 Python code.&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Reloading_modules_at_runtime|Reloading Modules At Runtime]]: How to reload a modified module file at runtime, without restarting the server. Perfect for making quick changes.&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Adding_New_RCon_Commands|Adding New RCon Commands]]: How to add as many new, custom RCon commands as you would like, without changing any of the standard server files.&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:How_To_Implement_Better_Error_Catching|How To Implement Better Error Catching]]: How to catch errors that Python normally doesn&amp;#039;t tell you about.&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Dynamically_Changing_an_Event_Handler|Dynamically Changing an Event Handler]]: Replacing an event handler that the original BF2 Python code has already registered with a new &amp;quot;wrapper&amp;quot; handler that you write, with no modification to original source code required. Uses a fix to the standard BF2 autobalance algorithm as an example.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Configuration Variables  ==&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Finding_the_Value_of_a_Server_Configuration_Variable|Finding the Value of a Server Configuration Variable]]: How to find out what any server configuration variable (set in &amp;lt;code&amp;gt;.con&amp;lt;/code&amp;gt; files) is set to.&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Easy_Custom_Config_Variables|Easy Custom Config Variables]]: An easy way to create and use your own configuration variables, without having to write your own parser or create a new config file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Maps  ==&lt;br /&gt;
&lt;br /&gt;
* [[Cookbook:Ploting_Object_Positions_on_a_Map_Image|Ploting Object Positions on a Map Image]]: How to convert the X/Y/Z coordinates used by Battlefield 2 so that they can be used to plot points on HUD maps using the Python Imaging Library.&lt;/div&gt;</summary>
		<author><name>Pireax</name></author>
	</entry>
</feed>