Skip to content

Commit

Permalink
Merge pull request #5 from mupfelofen-de/master
Browse files Browse the repository at this point in the history
Revise documentation. Add several code examples.
  • Loading branch information
Koncord committed Dec 14, 2017
2 parents 415c642 + eb38cda commit 85ac136
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 39 deletions.
4 changes: 2 additions & 2 deletions source/api/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Core table
----------
The Core table contains information about the current version, protocol and loaded mods.

loadedMods
^^^^^^^^^^
loadedModules
^^^^^^^^^^^^^

**Property**:
| **table**. An array with the names of all loaded clientside data files.
Expand Down
35 changes: 33 additions & 2 deletions source/api/eventAPI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ ON_PLAYER_CELLCHANGE
.. code-block:: lua
Event.register(Events.ON_PLAYER_CELLCHANGE, function(player)
io.write((New cell of player %s: %s.\n"):format(player.name, player:getCell().description))
io.write(("New cell of player %s: %s.\n"):format(player.name, player:getCell().description))
end)
ON_PLAYER_KILLCOUNT
Expand Down Expand Up @@ -215,7 +215,7 @@ ON_PLAYER_LEVEL
.. code-block:: lua
Event.register(Events.ON_PLAYER_LEVEL, function(player)
io.write((%s reached level %u.\n"):format(player.name, player.level))
io.write(("%s reached level %u.\n"):format(player.name, player.level))
end)
ON_PLAYER_BOUNTY
Expand All @@ -224,6 +224,15 @@ ON_PLAYER_BOUNTY
**Contains:**
| :doc:`player<./player>` player
.. code-block:: lua
Event.register(Events.ON_PLAYER_BOUNTY, function(player)
if player.bounty >= 5000 then
io.write(("%s: death warrant was revoked.\n"):format(player.name))
player.bounty = 4999
end
end)
ON_PLAYER_EQUIPMENT
-------------------

Expand Down Expand Up @@ -300,6 +309,14 @@ ON_PLAYER_SENDMESSAGE
**Contains:**
| :doc:`player<./player>` player
| **string** message.
| **number** channel.
.. code-block:: lua
Data.overrideChat = true
Event.register(Events.ON_PLAYER_SENDMESSAGE, function(player, message, channel)
player:message(channel, ("%s (%d): %s\n"):format(player.name, player.pid, string.reverse(message)), true)
end)
ON_PLAYER_ENDCHARGEN
--------------------
Expand All @@ -316,6 +333,20 @@ Called when player finishes the character generation sequence
player:message(0, "Good luck.\n", false)
end)
ON_PLAYER_WEATHER
-----------------

**Contains:**
| :doc:`player<./player>` player
.. code-block:: lua
Event.register(Events.ON_PLAYER_WEATHER, function(player)
if os.date("%m.%d") == "12.24" then
player:getWeatherMgr():setWeather(8)
end
end)
.. _OnGUIAction-anchor:

ON_GUI_ACTION
Expand Down
35 changes: 0 additions & 35 deletions source/api/modInfo.rst

This file was deleted.

36 changes: 36 additions & 0 deletions source/api/moduleInfo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
moduleInfo.json
===============

moduleInfo.json should contain basic info about a script addon:

.. code-block:: json
{
"name": "MyFirstMod",
"author": "Me",
"version": "0.0.1",
"dependencies": {
"Core": ">=0.0.1",
"MyAnotherMod": ">=0.0.1"
}
}
name
----

The name of the script addon without spaces.

author
------

The name of the author.

version
-------

The version used in the dependency checker.

dependencies
------------

The list of dependencies.
9 changes: 9 additions & 0 deletions source/api/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ Enables or disables the console for a player.
setDifficulty(difficulty)
-------------------------

.. tip::
The default values represent the limits of the slider used in OpenMW.
They are neither the upper nor the lower limit.

Changes the difficulty for a player.

**Parameters:**
| **number** difficulty. Default values from -100 to 100.
.. code-block:: lua
if player.race == "wood elf" then
player:getSettings():setDifficulty(500)
end

0 comments on commit 85ac136

Please sign in to comment.