Jump to content

glundberg

Member
  • Content Count

    1
  • Joined

  • Last Visited

    Never
  1. I have done a bit of research into how to get a LUA script to execute. There are exactly three requirements: 1) The first line of the script must be a package ID, which must be a valid hexadecimal value. I did not test to see how large this value may be, but I did test to ensure that several values between 00000000 and FFFFFFFF (inclusive) would work (all did), and that non-hex values did not work (none did). I also did not test to determine if there is a specific order of initialization for the scripts, or if duplicate package ID numbers had any effect. This seemed moot to me since it's rather simple to ensure scripts do not care about order of initialization or multiple-initializations of the same script. 2) For obvious reasons, the dataset TYPE MUST be LUA (CA63E2A3). 3) The dataset GROUP must be EITHER 4A5E8F3F (which appears to be LUA scripts mainly related to automata) or 4A5E8EF6 (which appears to be LUA scripts mainly related to advisors). Note that the group for the LUA script in the Living Mall plugin is one of these values. I tested +/- 1 from each of the above group values and neither caused my test script to load. As to the dofile stuff .. it appears that's only needed by the Maxis-supplied LUA scripts. Note there is a script with a package ID which does a dofile() for everything else. Maxis does some fiddling with the dofile() function to cause it to know that the filename specified refers to a TGI dataset. We, however, do not have that luxury, so we MUST have a package ID at the top of every script dataset. Since the dataset group numbers must match those of Maxis' LUA scripts, care must be taken to ensure that the instance numbers do not collide unless the intention actually is to replace the Maxis-supplied script.
×