Backup of Lua (3) Back


Back to History list

*一般[#lacce35c]
**これは何? [#mc8bd8ba]

これはA1で機能するluaスクリプトを書くためのレファレンスである。この文書を作った段階では、それはluaスクリプトで利用可能な全てのトリガと関数のリストがある。A1でluaの機能性が成長して行くにつれて、この文章も成長していくと期待される。ここの全てが完全に文章化されているわけではないが、それを修正する手助けは歓迎される。

これはluaそのもののレファレンスではない。それについてはlua.orgを見なさい。

**スクリプトを実行する方法 [#n408ab40]

There are two ways to get a script to run - level specific MML, and selecting a script at the gather network game dialog. To use level specific MML, put the script in a TEXT resource in the map file. Then put in TEXT resource 128 MML telling A1 where to find the script, which in its most basic form is this:

	<marathon_levels>

	<level index="0">
	<lua resource="1000"/>
	</level>

	</marathon_levels>

By convention we use TEXT resource 1000+x to hold the script for level x, so the first level in the map file (which has level index 0) gets its script in TEXT resource 1000.

This works fine for single player games. It will also work for multiplayer games, but only if every player has a copy of the map file and selects it in enviroment prefs.

To use a script via the network game dialog, put then script in a text file. Then, at the gather network game dialog, select "use script", then select your script file.

When playing network games, even if you are not gathering, it's important not to have a map file with level specific MML selected in your environment prefs, unless it's the map file for the map you are playing. A1 will run the script for that map file, your game will go out of sync, and you'll be unhappy.

**Units [#o3107d79]

The unit for distance we use is World Units (WU) These are the same values you'd see in Forge or with F10 location display, and 1/1024 of what A1 uses internally and what you'd see in Pfhorte.

Units for speed are . . . well let's say they're messy. :)

*[[A1 Functions]] [#tf89cd06]
*[[Mnemonics]] [#af4e89b5]
*[[Dynamic Limits]] [#a1857eae]

* [#a2a9c9c4]
公式にあるのをコピペ、後で翻訳予定(by pfhore,EMRの翻訳の資料のため)