Programmable Sleep Clock v3.31

<< < (42/59) > >>

dizzy:
If you clear the bit 0 of flags in the Lua primitive, the SimAntics game engine will execute a Lua loadstring() of the indicated STR#'s description after doing a quick filter (they don't let you dofile() anymore, for example). I've been doing this for the past couple weeks in testing, and I've had no real problems.

J. M. Pescado:
...in English this time?

dizzy:
Let's look at an example:

Code:

# Group = 0x7F1D0F49, Instance = 0x1030
# Title = Interaction - Pet - Give Birth

Look through that mess of code and you'll eventually notice this:

Code:

    59: Lua: Private - "OpenBirth", defined in description, Passing in params where param 0 = Local 0, param 1 = 0, param 2 = 0; true: 2E, false: 2E
        [ 007E: (00) 30010100FAFF19000007000007000000 ]
    5A: Lua: Private - "CloseBirth", defined in description; true: 63, false: 63
        [ 007E: (00) 30010200F2FF07000007000007000000 ]

Notice that both those Lua primitives are "defined in description" as per their flags settings.

Now, if you look at "Group = 0x7F1D0F49, STR# 0x130(Lua Scripts)", you see this:

Code:

0x0: OpenBirth
local numPKs = GetPrimitiveParameter(0)
nUI.OpenProgressDialog(4276996822)
nUI.ShowProgressDialogControl(1, false)
nUI.ShowProgressDialogControl(2, false)
nUI.ShowProgressDialogControl(3, false)
nUI.ShowProgressDialogControl(4, false)
nUI.ShowProgressDialogControl(numPKs, true)

0x1: CloseBirth
nUI.CloseProgressDialog()

The description for the first string contains the Lua code for the first command, and the description for the second string contains the code for the second. Pretty simple, really.

twojeffs:
Ah yes, the pet birth code. That's where I saw the local lua code. Thanks again Dizzy. :)

J. M. Pescado:
That made much more sense. How reverse-compatible is this, though? How far back in the engine can we expect to be able to do this?

Navigation

[0] Message Index

[#] Next page

[*] Previous page