Back Previous Next

Menu misery and version detection

Menus still need some testing, but since I promised the version detection code on the previous page, this page will go up half finished.

First, version detection: how to find out which expansion packs are installed. Why this is necessary will become clear later on. The way the Sims works, though extended by every expansion pack, differs dramatically between the pre-HD (the Sims, LL, HP) and HD+ (including Deluxe) versions. So the object programmer has to be able to find out i. whether a particular expansion pack has been installed and ii. whether the installation is pre-HD or HD+.

There are three very similar ways to test the game version. The first checks if an expansion pack has been installed:

Global ( from Simulation ) Game Edition Flag Set? House Party
Code: 2:14 00 02 00 00 08 06 07

The third byte, "02", is the number of the expansion pack, where the Sims is 0, LL is 1, HP is 2, HD is 3, Vacation is 4, Deluxe is 5, UL is 6, SS is 7 and MM is 8. The sixth byte, "08", asks if the flag for that number has been set, ie. if that expansion pack was installed. Changing its value to "09" tells the game to set the flag, pretending that the expansion pack is installed - a risky instruction.

But if I don't need to query every pack installed, only wanting to know whether the installation is HD or higher, I change the sixth byte to "00".

Global ( from Simulation ) Game Edition > 2
Code: 2:14 00 02 00 00 00 06 07

This means the highest expansion pack installed is bigger than 2, meaning, at least 3. HD is 3, so this is the instruction for testing whether an installation is HD+ and will make use of things like Autofollow and ArtGlobals. If I want to know whether HP (which is 2) is the highest pack installed, the "00" becomes "02":

Global ( from Simulation ) Game Edition Equals? 2
Code: 2:14 00 02 00 00 02 06 07

As said, menus still need testing, but I've discovered the following about submenus (especially when dynamically created, which is what this howto will be about):

And that's why version detection is important when making menus!





Back Previous Next