The Sims 2 (PlayStation Portable)/Lua Scripts
This is a sub-page of The Sims 2 (PlayStation Portable).
This game uses a TON of Lua scripting for... basically everything. It has a few C global functions (mostly "critter" functions, related to Sims) which aren't documented at all, but most of the game uses plain Lua. This page will document anything commented out, whether it is notes, or full discarded code.
It should be noted that most if not all of the actual lua scripts that run during gameplay will be located in the "main" lua function files (ie. 17617.res, 17618.res, etc.) and the files under lua/ will be duplicates. Because of this, these are the files that should be modified before running QuickBMS re-import if any changes are to be made.
File names are taken from the bottom of the scripts.
To do: Several more scripts. |
lua/testlua
-- print('gamestate.spam = ' .. gamestate.spam) -- assert(gamestate.spam == 3.5) -- gamestate.fred = gamestate.spam + 1 -- print('gamestate.fred = ' .. gamestate.fred) -- assert(gamestate.fred == 4.5) -- options['render/wireframe'] = 1
An interesting script that prints numbers, and most likely renders the game in wireframe.
lua/items
-- Items are ordered as seen in \docs\Design Documents\InventoryItems.xls
This script contains a reference to a design document.
lua/controls
controlMapping1 = { id = 'motoraptor dino', id = 'Sims2', ps2 = { stickLeftAnalog = 'movement', stickRightAnalog = 'camera', stickDPad = 'menu navigate', buttonX = 'jump', buttonSquare = 'weak attack', buttonTriangle = 'strong attack', buttonCircle = 'grab attack', buttonSelect = 'radar/map toggle', buttonStart = 'pause/options', triggerLeft1 = 'change weapon', triggerLeft2 = 'look mode', triggerRight1 = 'fire weapon', triggerRight2 = 'libertize', buttonStickLeft = '', buttonStickRight = '', }, gamecube = { stickLeftAnalog = '', stickRightAnalog = '', stickDPad = '', buttonA = '', buttonB = '', buttonX = '', buttonY = '', buttonZ = '', buttonStart = '', triggerLeft = '', triggerRight = '', }, xbox = { stickLeftAnalog = '', stickRightAnalog = '', stickDPad = '', buttonA = '', buttonB = '', buttonX = '', buttonY = '', buttonBlack = '', buttonWhite = '', buttonStart = '', buttonSelect = '', triggerLeft = '', triggerRight = '', buttonStickLeft = '', buttonStickRight = '', }, psp = { stickLeftAnalog = 'movement', stickDPad = 'menu navigate', buttonX = 'jump', buttonSquare = 'weak attack', buttonTriangle = 'strong attack', buttonCircle = 'grab attack', buttonSelect = 'radar/map toggle', buttonStart = 'pause/options', triggerLeft = 'change weapon', triggerRight = 'fire weapon', }, },
This script contains a table, which interestingly has controls for PlayStation 2, GameCube, Xbox, and PlayStation Portable. This is most likely left over from a different project.
lua/user_config
-- Uncomment this line to disable all printing, unless you override -- for a specific channel (see below): --SetDefaultDisplayLevel(LogLevel.Off) -- Disable all logging messages --SetDefaultDisplayLevel(LogLevel.Warning) -- Display warnings and errors only -- Replace 'name' with your name to display messages on your -- personal logging channel: --SetDisplayLevel('name', LogLevel.All) -- Show all logging messages on 'name' channel -- Disable printing line numbers for all messages: -- (replace with LogLevel.All to show them all) --SetDefaultLineNumberLevel(LogLevel.Off) -- Display line numbers with all messages printed on the 'name' channel: --SetLineNumberLevel('name', LogLevel.All)
This script has user configurations, which are intended for programmers. Later on,
if debug then -- Comment out the below line to turn off opening the interactive -- debugging shell when errors are encountered in Lua scripts. debug.break_on_errors = true end
there is an if statement that turns on breaking on errors. Right below,
-- You can set your name to true so that you can write conditional code -- while developing. --YOUR_NAME = true
there is a comment that explains how you would write conditional code while developing.