Lua: nhcore script with function callbacks
Adds possible callbacks for "start_new_game", "restore_old_game", "moveloop_turn", and "game_exit" which when defined, will be called from core code at the appropriate time. Adds lua hooks for dump_fmtstr (only if DUMPLOG), dnum_name, u.moves, u.uhave_amulet, and u.depth.
This commit is contained in:
@@ -890,6 +890,7 @@ split off some of the functionality that was in makedefs (compiled-in options
|
||||
and accessed on the target platform
|
||||
replace quest.txt and associated conversion to quest.dat via makedefs with
|
||||
Lua quest texts loaded at runtime
|
||||
callback lua functions from core at certain game actions
|
||||
some altars are displayed in different colors (for tty and curses at least)
|
||||
add 'quick_farsight' option to provide some control over random clairvoyance
|
||||
where pausing to be able to browse temporarily visible aspects of the
|
||||
|
||||
29
doc/lua.adoc
29
doc/lua.adoc
@@ -14,6 +14,35 @@ Example:
|
||||
|
||||
local str = nh.an("unicorn");
|
||||
|
||||
=== dnum_name
|
||||
|
||||
Returns the full dungeon name (as defined in dungeon.lua) for the dungeon
|
||||
number given as parameter.
|
||||
|
||||
Example:
|
||||
|
||||
local dungeon_name = nh.dnum_name(u.dnum);
|
||||
|
||||
=== dump_fmtstr
|
||||
|
||||
Returns a string replacing special format chars with game data.
|
||||
Only available if NetHack was compiled with DUMPLOG.
|
||||
|
||||
|===
|
||||
| %% | literal '%'
|
||||
| %t | game start, timestamp
|
||||
| %T | current time, timestamp
|
||||
| %d | game start, YYYYMMDDhhmmss
|
||||
| %D | current time, YYYYMMDDhhmmss
|
||||
| %v | game version, eg. '3.7.0-0'
|
||||
| %u | UID
|
||||
| %n | player name
|
||||
| %N | first character of player name
|
||||
|===
|
||||
|
||||
Example:
|
||||
|
||||
local filename = nh.dump_fmtstr("/tmp/nethack.%n.%d.log");
|
||||
|
||||
=== getlin
|
||||
|
||||
|
||||
Reference in New Issue
Block a user