mirror of https://github.com/marrub--/zscript-doc
Compare commits
2 Commits
0634ea76af
...
fceaa55824
Author | SHA1 | Date |
---|---|---|
an | fceaa55824 | |
an | 31552790d1 |
|
@ -1,5 +1,4 @@
|
|||
ZScriptDoc
|
||||
==========
|
||||
# ZScriptDoc
|
||||
|
||||
This is documentation for the ZScript language. CC0 public domain. See
|
||||
[LICENSE](LICENSE.txt) for more information.
|
||||
|
|
|
@ -48,7 +48,7 @@ Thinkers which do think and are mandatory to many checks:
|
|||
| `Thinker.STAT_BOT` | All bot logic. This is not bound to their actor. |
|
||||
|
||||
```
|
||||
class Thinker play
|
||||
class Thinker : Object play
|
||||
{
|
||||
const TICRATE;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ A container representing an array of lines of text that have been broken up to
|
|||
fit the screen and clipping region.
|
||||
|
||||
```
|
||||
class BrokenLines
|
||||
class BrokenLines : Object
|
||||
{
|
||||
int Count();
|
||||
string StringAt(int line);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Represents an arbitrary polygonal 2D shape.
|
||||
|
||||
```
|
||||
class Shape2D
|
||||
class Shape2D : Object
|
||||
{
|
||||
void Clear(int which = C_Verts | C_Coords | C_Indices);
|
||||
void PushCoord(vector2 c);
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
# ConsoleEvent
|
||||
|
||||
The information for a `ConsoleProcess` or `NetworkProcess` event.
|
||||
|
||||
```
|
||||
struct ConsoleEvent
|
||||
{
|
||||
readonly int Player;
|
||||
readonly string Name;
|
||||
readonly int Args[3];
|
||||
readonly bool IsManual;
|
||||
}
|
||||
```
|
||||
|
||||
- `Player`
|
||||
|
||||
The player who created this event, or `-1` if there was no activator. This
|
||||
will always be positive for `NetworkProcess` events and always `-1` for
|
||||
`ConsoleProcess` events.
|
||||
|
||||
- `Name`
|
||||
|
||||
The name as provided to `SendNetworkEvent`. Use this to distinguish between
|
||||
event types. It is favorable to prefix names with the name of your mod or
|
||||
game so that it will not potentially conflict with other mods.
|
||||
|
||||
- `Args`
|
||||
|
||||
The arguments as provided to `SendNetworkEvent`.
|
||||
|
||||
- `IsManual`
|
||||
|
||||
`true` if this event was created manually, for instance through a console
|
||||
command.
|
||||
|
||||
<!-- EOF -->
|
|
@ -0,0 +1,34 @@
|
|||
# EventHandler
|
||||
|
||||
Event handlers handle events on a per-game or per-map level. This means that
|
||||
they are registered when you start a new game or map, and un-register when you
|
||||
finish the game or map. This is unlike `StaticEventHandler`, which registers
|
||||
when the engine is started, and un-registers when it exits.
|
||||
|
||||
All of the virtual functions on `EventHandler` have empty implementations by
|
||||
default, so you only need to override the events your event handler needs to
|
||||
override.
|
||||
|
||||
See `StaticEventHandler` for more information on the events that can be
|
||||
overridden on this type.
|
||||
|
||||
```
|
||||
class EventHandler : StaticEventHandler
|
||||
{
|
||||
clearscope static StaticEventHandler Find(class<StaticEventHandler> type);
|
||||
clearscope static void SendNetworkEvent(string name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
|
||||
}
|
||||
```
|
||||
|
||||
- `Find`
|
||||
|
||||
Finds and returns the `StaticEventHandler` type `type` if it is registered,
|
||||
or `null` if it does not exist. It should be noted that this is exactly the
|
||||
same as `StaticEventHandler`'s, and does not actually check for
|
||||
`EventHandlers`, although due to inheritance will return them correctly.
|
||||
|
||||
- `SendNetworkEvent`
|
||||
|
||||
Sends a network event with no activator.
|
||||
|
||||
<!-- EOF -->
|
|
@ -0,0 +1,44 @@
|
|||
# RenderEvent
|
||||
|
||||
The information for a `RenderOverlay` event.
|
||||
|
||||
```
|
||||
struct RenderEvent
|
||||
{
|
||||
readonly vector3 ViewPos;
|
||||
readonly double ViewAngle;
|
||||
readonly double ViewPitch;
|
||||
readonly double ViewRoll;
|
||||
readonly double FracTic;
|
||||
readonly Actor Camera;
|
||||
}
|
||||
```
|
||||
|
||||
- `ViewPos`
|
||||
|
||||
The position at which the camera is at.
|
||||
|
||||
- `ViewAngle`
|
||||
|
||||
The yaw angle of the camera.
|
||||
|
||||
- `ViewPitch`
|
||||
|
||||
The pitch angle of the camera.
|
||||
|
||||
- `ViewRoll`
|
||||
|
||||
The roll angle of the camera.
|
||||
|
||||
- `FracTic`
|
||||
|
||||
A value between 0 and 1 (exclusive) representing the time between the last
|
||||
game tick and the next game tick. This is most useful for interpolation, and
|
||||
you can add it to the current game tick to get the real time at which this
|
||||
event has been called. Precision is not specified.
|
||||
|
||||
- `Camera`
|
||||
|
||||
The actor which is acting as the camera for the player's view.
|
||||
|
||||
<!-- EOF -->
|
|
@ -0,0 +1,30 @@
|
|||
# ReplaceEvent
|
||||
|
||||
The information for a `CheckReplacement` event. You can mutate the variables in
|
||||
this event to change the result of replacement checking.
|
||||
|
||||
```
|
||||
struct ReplaceEvent
|
||||
{
|
||||
readonly class<Actor> Replacee;
|
||||
class<Actor> Replacement;
|
||||
bool IsFinal;
|
||||
}
|
||||
```
|
||||
|
||||
- `Replacee`
|
||||
|
||||
The actor class which is being replaced.
|
||||
|
||||
- `Replacement`
|
||||
|
||||
What to replace it with. This class type is already effected by skill and
|
||||
actor definition replacements, so it may be useful to read it. Modify this
|
||||
to change what the resulting replacement class ends up being.
|
||||
|
||||
- `IsFinal`
|
||||
|
||||
If `true`, the engine will not attempt to continue going down the
|
||||
replacement chain, and will directly replace the actor with `Replacement`.
|
||||
|
||||
<!-- EOF -->
|
|
@ -0,0 +1,249 @@
|
|||
# StaticEventHandler
|
||||
|
||||
Static event handlers handle events on a per-instance level. This means that
|
||||
they are registered when you start GZDoom, and un-register when you exit
|
||||
GZDoom. This is unlike `EventHandler`, which registers when a new game is
|
||||
started, and un-registers when it ends. Care should be taken to make sure that
|
||||
variables kept in a static event handler don't interact with the game directly,
|
||||
or it will act **non-deterministically** and cause a desync.
|
||||
|
||||
All of the virtual functions on `StaticEventHandler` have empty implementations
|
||||
by default, so you only need to override the events your event handler needs to
|
||||
override.
|
||||
|
||||
Differences in virtual function behaviour are listed in the `EventHandler`
|
||||
documentation.
|
||||
|
||||
```
|
||||
class StaticEventHandler : Object play
|
||||
{
|
||||
clearscope static StaticEventHandler Find(class<StaticEventHandler> type);
|
||||
|
||||
virtual void OnRegister();
|
||||
virtual void OnUnregister();
|
||||
|
||||
virtual void WorldLoaded(WorldEvent e);
|
||||
virtual void WorldUnloaded(WorldEvent e);
|
||||
virtual void WorldThingSpawned(WorldEvent e);
|
||||
virtual void WorldThingDied(WorldEvent e);
|
||||
virtual void WorldThingRevived(WorldEvent e);
|
||||
virtual void WorldThingDamaged(WorldEvent e);
|
||||
virtual void WorldThingDestroyed(WorldEvent e);
|
||||
virtual void WorldLinePreActivated(WorldEvent e);
|
||||
virtual void WorldLineActivated(WorldEvent e);
|
||||
virtual void WorldSectorDamaged(WorldEvent e);
|
||||
virtual void WorldLineDamaged(WorldEvent e);
|
||||
virtual void WorldLightning(WorldEvent e);
|
||||
virtual void WorldTick();
|
||||
|
||||
virtual ui void RenderOverlay(RenderEvent e);
|
||||
|
||||
virtual void PlayerEntered(PlayerEvent e);
|
||||
virtual void PlayerRespawned(PlayerEvent e);
|
||||
virtual void PlayerDied(PlayerEvent e);
|
||||
virtual void PlayerDisconnected(PlayerEvent e);
|
||||
|
||||
virtual ui bool UiProcess(UiEvent e);
|
||||
virtual ui void UiTick();
|
||||
virtual ui void PostUiTick();
|
||||
|
||||
virtual ui bool InputProcess(InputEvent e);
|
||||
|
||||
virtual ui void ConsoleProcess(ConsoleEvent e);
|
||||
virtual void NetworkProcess(ConsoleEvent e);
|
||||
|
||||
virtual void CheckReplacement(ReplaceEvent e);
|
||||
|
||||
virtual void NewGame();
|
||||
|
||||
void SetOrder(int order);
|
||||
|
||||
readonly int Order;
|
||||
bool IsUiProcessor;
|
||||
bool RequireMouse;
|
||||
}
|
||||
```
|
||||
|
||||
- `Find`
|
||||
|
||||
Finds and returns the `StaticEventHandler` type `type` if it is registered,
|
||||
or `null` if it does not exist.
|
||||
|
||||
- `OnRegister`
|
||||
|
||||
Called when this type is registered. This is where you should set `Order`,
|
||||
`IsUiProcessor` and `RequireMouse`.
|
||||
|
||||
- `OnUnregister`
|
||||
|
||||
Called when this type is un-registered. With `StaticEventHandler`s this is
|
||||
called when the engine shuts down, so it isn't particularly useful.
|
||||
|
||||
- `WorldLoaded`
|
||||
|
||||
Called directly after the status bar is attached to the player and after
|
||||
`REOPEN` ACS scripts are called, just before the display is flushed and
|
||||
auto-save is done.
|
||||
|
||||
- `WorldUnloaded`
|
||||
|
||||
Called directly after `UNLOADING` ACS scripts, just before the level is
|
||||
changed.
|
||||
|
||||
- `WorldThingSpawned`
|
||||
|
||||
Called directly after an actor's `PostBeginPlay` function.
|
||||
|
||||
- `WorldThingDied`
|
||||
|
||||
Called after `MorphedDeath`, inventory items have called `OwnerDied`, and
|
||||
the target is set to the damage source, just before `KILL` ACS scripts are
|
||||
called and the rest of the death handling is done.
|
||||
|
||||
- `WorldThingRevived`
|
||||
|
||||
Called when an actor is revived, after everything is finished.
|
||||
|
||||
- `WorldThingDamaged`
|
||||
|
||||
Called directly before `Die`, or directly after after `DamageMobj` finishes.
|
||||
|
||||
- `WorldThingDestroyed`
|
||||
|
||||
Called at the beginning of an actor's `OnDestroy` function.
|
||||
|
||||
- `WorldLinePreActivated`
|
||||
|
||||
Called directly after a line is tested for activation, before any other
|
||||
activation specials are called (such as checking for keys, executing the
|
||||
line special, etc.)
|
||||
|
||||
- `WorldLineActivated`
|
||||
|
||||
Called directly after a line's special is executed, if it succeeded, before
|
||||
any other handling (such as changing a switch's texture) is completed.
|
||||
|
||||
- `WorldSectorDamaged`
|
||||
|
||||
Called when a sector is damaged if it has any health groups, before any
|
||||
other handling is done.
|
||||
|
||||
- `WorldLineDamaged`
|
||||
|
||||
Called when a line is damaged if it has any health groups, before any other
|
||||
handling is done.
|
||||
|
||||
- `WorldLightning`
|
||||
|
||||
Called when lightning strikes, directly after the sound is played, just
|
||||
before `LIGHTNING` ACS scripts are called.
|
||||
|
||||
- `WorldTick`
|
||||
|
||||
Called on every world tick, after interpolators are updated, world freeze is
|
||||
updated, sight counters are reset, particles have run their thinkers, and
|
||||
players have run their thinkers, just before the status bar is ticked, the
|
||||
level ticks, thinkers are ticked, and the level time is updated. This is not
|
||||
called when the game is paused, and its execution is entirely deterministic
|
||||
regardless of how this event handler is applied.
|
||||
|
||||
- `RenderOverlay`
|
||||
|
||||
Despite the name, this is actually run on the status bar, specifically in
|
||||
`BaseStatusBar::DrawTopStuff`. It is run after `HudMessage`s are drawn and
|
||||
power-ups are drawn, just before ゴゴゴ「The Log」ゴゴゴ is drawn. You may
|
||||
use `Screen` functions in this function.
|
||||
|
||||
- `PlayerEntered`
|
||||
|
||||
Called during level load when each player enters the game, after the camera
|
||||
is set but just before `RETURN` ACS scripts are called.
|
||||
|
||||
- `PlayerRespawned`
|
||||
|
||||
Called when a player spawns, directly after the teleport fog is spanwed and
|
||||
just before `RESPAWN` ACS scripts are called. Also called similarly at the
|
||||
end of the `Respawn` function, for example when the `resurrect` cheat is
|
||||
used.
|
||||
|
||||
- `PlayerDied`
|
||||
|
||||
Called after `WorldThingDied` and `GetDeathHeight`, and after the actor's
|
||||
thing special is activated, when the obituary has been displayed, just
|
||||
before `DEATH` ACS scripts have been called.
|
||||
|
||||
- `PlayerDisconnected`
|
||||
|
||||
Called when a bot is removed and when a player disconnects from the game,
|
||||
just before `DISCONNECT` ACS scripts are called.
|
||||
|
||||
- `UiProcess`
|
||||
|
||||
Called only if `IsUiProcessor` is `true`. Called when a GUI event is
|
||||
dispatched by the engine, for example when the UI is active and the player
|
||||
has pressed a key or moved the mouse. Mouse movements will only be captured
|
||||
if `RequireMouse` is `true`. Because this interacts directly with the OS it
|
||||
is not part of the game simulation, therefore has `ui` scope and must
|
||||
dispatch commands to the game as networked events. If the return value is
|
||||
`true`, the function will block any further handlers from processing this
|
||||
event, essentially "eating" it. If the return value is `false`, other
|
||||
handlers will continue to be called as normal.
|
||||
|
||||
- `UiTick`
|
||||
|
||||
Despite what it may seem, this function is actually called deterministically
|
||||
within the game loop, just before the level is ticked and after the player's
|
||||
network commands are created. Albeit this, it is `ui` scope, so it should
|
||||
be used to process UI code.
|
||||
|
||||
- `PostUiTick`
|
||||
|
||||
Similar to `UiTick`, this is also deterministic, but called after all other
|
||||
tickers.
|
||||
|
||||
- `InputProcess`
|
||||
|
||||
The same as `UiProcess`, but this is only called when inputs are being
|
||||
directed to the game, rather than to the GUI. All of the same restrictions
|
||||
apply to this as they do to `UiProcess`, and the return value acts the same.
|
||||
|
||||
- `ConsoleProcess`
|
||||
|
||||
Called when network events which have no player activator are received.
|
||||
|
||||
- `NetworkProcess`
|
||||
|
||||
Called when network events which have a player activator are received.
|
||||
|
||||
- `CheckReplacement`
|
||||
|
||||
Called during actor replacement, after skill replacement is done, but before
|
||||
any other replacement (such as actor replacements done in ZScript actor
|
||||
definitions.)
|
||||
|
||||
- `NewGame`
|
||||
|
||||
Called on a new game, directly after level data is reset and right before
|
||||
the level is set up.
|
||||
|
||||
- `SetOrder`
|
||||
|
||||
Sets the ordering of this event handler, which can be read from `Order`.
|
||||
|
||||
- `Order`
|
||||
|
||||
The arbitrary ordering of this event handler relative to other ones. Event
|
||||
handlers with lower ordering numbers have their functions executed first.
|
||||
You can set this variable with `SetOrder`.
|
||||
|
||||
- `IsUiProcessor`
|
||||
|
||||
If `true`, GUI events will be sent to this event handler through
|
||||
`UiProcess`. This is mainly for optimization purposes.
|
||||
|
||||
- `RequireMouse`
|
||||
|
||||
If `true`, mouse events will be sent to this event handler through
|
||||
`InputProcess` and/or `UiProcess`. This is mainly for optimization purposes.
|
||||
|
||||
<!-- EOF -->
|
|
@ -3,7 +3,7 @@
|
|||
A class containing an animated intermission background.
|
||||
|
||||
```
|
||||
class InterBackground play
|
||||
class InterBackground : Object play
|
||||
{
|
||||
static InterBackground Create(WBStartStruct wbs);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ Status screens have four stages:
|
|||
These are provided as constants in `StatusScreen`. The starting stage is `StatCount`.
|
||||
|
||||
```
|
||||
class StatusScreen abstract play
|
||||
class StatusScreen : Object abstract play
|
||||
{
|
||||
const NG_STATSY;
|
||||
const SHOWNEXTLOCDELAY;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Iterates over line indices with a specified tag.
|
||||
|
||||
```
|
||||
class LineIdIterator
|
||||
class LineIdIterator : Object
|
||||
{
|
||||
static LineIdIterator Create(int tag);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
A sound sequence (`SNDSEQ`) node.
|
||||
|
||||
```
|
||||
class SeqNode
|
||||
class SeqNode : Object
|
||||
{
|
||||
static name GetSequenceSlot(int sequence, int type);
|
||||
static void MarkPrecacheSounds(int sequence, int type);
|
||||
|
|
|
@ -17,7 +17,7 @@ The predefined layers are:
|
|||
| `PSprite.Weapon` | `1` | The default layer for all weapons. |
|
||||
|
||||
```
|
||||
class PSprite play
|
||||
class PSprite : Object play
|
||||
{
|
||||
readonly State CurState;
|
||||
readonly int ID;
|
||||
|
|
63
api.md
63
api.md
|
@ -1,8 +1,11 @@
|
|||
# API
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
* [Actors](#actors)
|
||||
* [Base](#base)
|
||||
* [Drawing](#drawing)
|
||||
* [Event Handling](#event-handling)
|
||||
* [Files](#files)
|
||||
* [Intermission Screens](#intermission-screens)
|
||||
* [Level Data](#level-data)
|
||||
|
@ -11,6 +14,8 @@
|
|||
* [Weapons](#weapons)
|
||||
* [Global Objects](#global-objects)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
The ZScript API (Advanced Programming Interface) is vast and has some holes
|
||||
which are hard to explain. Some parts are implemented in ways that don't make
|
||||
sense to user code, but are fine to the engine. Because of this, the API shall
|
||||
|
@ -25,17 +30,17 @@ are part of the API.
|
|||
|
||||
# Actors
|
||||
|
||||
<!-- toc actor -->
|
||||
<!-- inter-toc actor -->
|
||||
|
||||
* [State](api-actor-State.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Base
|
||||
|
||||
<!-- toc base -->
|
||||
<!-- inter-toc base -->
|
||||
|
||||
* [Array](api-base-Array.md)
|
||||
* [Color](api-base-Color.md)
|
||||
|
@ -47,13 +52,13 @@ TODO
|
|||
* [Thinker](api-base-Thinker.md)
|
||||
* [Vector](api-base-Vector.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Drawing
|
||||
|
||||
<!-- toc drawing -->
|
||||
<!-- inter-toc drawing -->
|
||||
|
||||
* [BrokenLines](api-drawing-BrokenLines.md)
|
||||
* [Console](api-drawing-Console.md)
|
||||
|
@ -64,33 +69,37 @@ TODO
|
|||
* [TexMan](api-drawing-TexMan.md)
|
||||
* [TextureID](api-drawing-TextureID.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Event Handling
|
||||
|
||||
<!-- toc events -->
|
||||
<!-- inter-toc events -->
|
||||
|
||||
* [ConsoleEvent](api-events-ConsoleEvent.md)
|
||||
* [EventHandler](api-events-EventHandler.md)
|
||||
* [RenderEvent](api-events-RenderEvent.md)
|
||||
* [ReplaceEvent](api-events-ReplaceEvent.md)
|
||||
* [StaticEventHandler](api-events-StaticEventHandler.md)
|
||||
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Files
|
||||
|
||||
<!-- toc files -->
|
||||
<!-- inter-toc files -->
|
||||
|
||||
* [Wads](api-files-Wads.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Intermission Screens
|
||||
|
||||
<!-- toc inter -->
|
||||
<!-- inter-toc inter -->
|
||||
|
||||
* [InterBackground](api-inter-InterBackground.md)
|
||||
* [PatchInfo](api-inter-PatchInfo.md)
|
||||
|
@ -98,7 +107,7 @@ TODO
|
|||
* [WBPlayerStruct](api-inter-WBPlayerStruct.md)
|
||||
* [WBStartStruct](api-inter-WBStartStruct.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
For legacy reasons, many intermission-related things may be prefixed with `WI`
|
||||
or `WB`. The abbreviation `WI` means *World Intermission* (the intermission
|
||||
|
@ -108,7 +117,7 @@ for [statistics drivers](https://doomwiki.org/wiki/Statistics_driver).
|
|||
|
||||
# Level Data
|
||||
|
||||
<!-- toc level -->
|
||||
<!-- inter-toc level -->
|
||||
|
||||
* [F3DFloor](api-level-F3DFloor.md)
|
||||
* [FColorMap](api-level-FColorMap.md)
|
||||
|
@ -121,45 +130,45 @@ for [statistics drivers](https://doomwiki.org/wiki/Statistics_driver).
|
|||
* [Side](api-level-Side.md)
|
||||
* [Vertex](api-level-Vertex.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Players
|
||||
|
||||
<!-- toc player -->
|
||||
<!-- inter-toc player -->
|
||||
|
||||
* [PlayerClass](api-player-PlayerClass.md)
|
||||
* [PlayerSkin](api-player-PlayerSkin.md)
|
||||
* [Team](api-player-Team.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Sounds
|
||||
|
||||
<!-- toc sound -->
|
||||
<!-- inter-toc sound -->
|
||||
|
||||
* [SeqNode](api-sound-SeqNode.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Weapons
|
||||
|
||||
<!-- toc wep -->
|
||||
<!-- inter-toc wep -->
|
||||
|
||||
* [PSprite](api-wep-PSprite.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
TODO
|
||||
|
||||
# Global Objects
|
||||
|
||||
<!-- toc global-data -->
|
||||
<!-- inter-toc global-data -->
|
||||
|
||||
* [Client](api-global-data-Client.md)
|
||||
* [Constants](api-global-data-Constants.md)
|
||||
|
@ -167,12 +176,12 @@ TODO
|
|||
* [Information](api-global-data-Information.md)
|
||||
* [Player](api-global-data-Player.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
These variables are accessible in any context and are not bound by any specific
|
||||
object. Generally these mirror global information within the engine itself.
|
||||
|
||||
<!-- toc global-func -->
|
||||
<!-- inter-toc global-func -->
|
||||
|
||||
* [Classes](api-global-func-Classes.md)
|
||||
* [Game](api-global-func-Game.md)
|
||||
|
@ -181,19 +190,19 @@ object. Generally these mirror global information within the engine itself.
|
|||
* [Sound](api-global-func-Sound.md)
|
||||
* [System](api-global-func-System.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
These functions are accessible in any context and are not bound by any specific
|
||||
object. Generally these are utility functions.
|
||||
|
||||
<!-- toc global -->
|
||||
<!-- inter-toc global -->
|
||||
|
||||
* [DEHInfo](api-global-DEHInfo.md)
|
||||
* [FOptionMenuSettings](api-global-FOptionMenuSettings.md)
|
||||
* [GameInfoStruct](api-global-GameInfoStruct.md)
|
||||
* [LevelLocals](api-global-LevelLocals.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
These are the types used by global variables.
|
||||
|
||||
|
|
45
entry.md
45
entry.md
|
@ -1,5 +1,4 @@
|
|||
Entry Points
|
||||
============
|
||||
# Entry Points
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -23,8 +22,7 @@ itself, many interactions with the engine are not defined in ZScript. This
|
|||
section describes all ZScript interactions with the engine, both inside and
|
||||
outside of ZScript itself.
|
||||
|
||||
ACS
|
||||
===
|
||||
# ACS
|
||||
|
||||
ACS has several functions for interfacing with ZScript: `SetUserVariable`
|
||||
(callfunc `24`,) `GetUserVariable` (callfunc `25`,) `SetUserArray` (callfunc
|
||||
|
@ -57,8 +55,7 @@ values, although more than one value will be ignored. The returned value may be
|
|||
`double` (converted to fixed-point,) `name`, `sound` or `string` (converted to
|
||||
ACS string.) If it is not one of these types, it will be ignored.
|
||||
|
||||
Actors
|
||||
======
|
||||
# Actors
|
||||
|
||||
Actor classes can be replaced by the `replaces` class flag, which during
|
||||
dynamic actor replacement will choose to spawn this class over its replaced
|
||||
|
@ -73,52 +70,44 @@ class MyActor : Actor replaces OtherActor {} // OtherActor will be dynamically r
|
|||
class MyOtherActor : Actor replaces OtherActor {} // OtherActor will now be replaced with MyOtherActor instead of MyActor
|
||||
```
|
||||
|
||||
Console Commands
|
||||
================
|
||||
# Console Commands
|
||||
|
||||
While ZScript cannot be directly called by console commands, one can use the
|
||||
`event` and `netevent` console commands. `event` will call the `ConsoleProcess`
|
||||
event handler, or `NetworkProcess` if it was not called by a player. `netevent`
|
||||
acts the same as `EventHandler::SendNetworkEvent`.
|
||||
`event` and `netevent` console commands. `event` will dispatch a non-player
|
||||
network event, and `netevent` will dispatch a network event for the player that
|
||||
ran it.
|
||||
|
||||
CVARINFO
|
||||
========
|
||||
# CVARINFO
|
||||
|
||||
Any CVars declared as a server CVar in `CVARINFO` or by the engine will be
|
||||
accessible as a global variable in ZScript, which has a special type that can
|
||||
be implicitly cast to the type of the CVar. They cannot be set this way, only
|
||||
accessed.
|
||||
|
||||
DECALDEF
|
||||
========
|
||||
# DECALDEF
|
||||
|
||||
`DECALDEF` can set the decal generator for a specific `Actor` class with the
|
||||
`generator` keyword. An actor can also define its generator and inherited
|
||||
classes' generators with the `Decal` property.
|
||||
|
||||
DECORATE
|
||||
========
|
||||
# DECORATE
|
||||
|
||||
TODO: lots of things to note here
|
||||
|
||||
LOCKDEFS
|
||||
========
|
||||
# LOCKDEFS
|
||||
|
||||
Key and lock groups in `LOCKDEFS` are defined as groups of `Inventory` or `Key`
|
||||
descendants.
|
||||
|
||||
GLDEFS
|
||||
======
|
||||
# GLDEFS
|
||||
|
||||
Lights can be associated with `Actor` classes and frames in `GLDEFS`.
|
||||
|
||||
KEYCONF
|
||||
=======
|
||||
# KEYCONF
|
||||
|
||||
TODO: this can be used for custom buttons
|
||||
|
||||
MAPINFO
|
||||
=======
|
||||
# MAPINFO
|
||||
|
||||
In `MAPINFO`, the `GameInfo` block (referred to as `MAPINFO`/GameInfo in this
|
||||
document) the following properties interact directly with ZScript:
|
||||
|
@ -135,13 +124,11 @@ document) the following properties interact directly with ZScript:
|
|||
|
||||
TODO: there are other things here as well, like map event handlers
|
||||
|
||||
MENUDEF
|
||||
=======
|
||||
# MENUDEF
|
||||
|
||||
TODO: this directly uses ZScript classes
|
||||
|
||||
TERRAIN
|
||||
=======
|
||||
# TERRAIN
|
||||
|
||||
The `SmallSplash`, `SplashBase` and `SplashChunk` properties of `Splash` blocks
|
||||
use `Actor`s.
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
Glossary
|
||||
========
|
||||
# Glossary
|
||||
|
||||
<!-- toc glossary -->
|
||||
<!-- inter-toc -->
|
||||
|
||||
* [Classes](glossary-Classes.md)
|
||||
* [Concepts](glossary-Concepts.md)
|
||||
* [Structures](glossary-Structures.md)
|
||||
* [Versions](glossary-Versions.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
Miscallaneous information about ZScript, including code examples and version
|
||||
Miscallaneous information about ZScript, including class lists and version
|
||||
differences.
|
||||
|
||||
<!-- EOF -->
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Class Definitions
|
||||
=================
|
||||
# Class Definitions
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -112,8 +111,7 @@ int m_MyMember;
|
|||
// end of file
|
||||
```
|
||||
|
||||
Class Flags
|
||||
===========
|
||||
# Class Flags
|
||||
|
||||
| Flag | Description |
|
||||
| ---- | ----------- |
|
||||
|
@ -127,8 +125,7 @@ Class Flags
|
|||
`Replace-class` in this context is an `Identifier` denoting a class which
|
||||
inherits `Actor`.
|
||||
|
||||
Class Content
|
||||
=============
|
||||
# Class Content
|
||||
|
||||
Class contents are an optional list of various things logically contained
|
||||
within the class, including:
|
||||
|
@ -144,8 +141,7 @@ within the class, including:
|
|||
- Constant definitions
|
||||
- Static array definitions
|
||||
|
||||
Property Definitions
|
||||
====================
|
||||
# Property Definitions
|
||||
|
||||
Property definitions are used within classes to define defaultable attributes
|
||||
on actors. They are not valid on classes not derived from Actor.
|
||||
|
@ -185,8 +181,7 @@ class MyCoolActor : Actor
|
|||
}
|
||||
```
|
||||
|
||||
Flag Definitions
|
||||
================
|
||||
# Flag Definitions
|
||||
|
||||
*Version 3.7.0 and newer.*
|
||||
|
||||
|
@ -243,8 +238,7 @@ class MyCoolActorWithFlags : Actor
|
|||
}
|
||||
```
|
||||
|
||||
Default Blocks
|
||||
==============
|
||||
# Default Blocks
|
||||
|
||||
Default blocks are used on classes derived from Actor to create an overridable
|
||||
list of defaults to properties, allowing for swift creation of flexible actor
|
||||
|
@ -297,8 +291,7 @@ actor. Here is a list of them:
|
|||
Note that like any other property, they require a semicolon after them,
|
||||
although they do not use an expression.
|
||||
|
||||
State Definitions
|
||||
=================
|
||||
# State Definitions
|
||||
|
||||
These are the same as `DECORATE`, but states that do not have function blocks
|
||||
require terminating semicolons. Double quotes around `#` and `-` are no longer
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Constant Definitions
|
||||
====================
|
||||
# Constant Definitions
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -26,8 +25,7 @@ Making an integer constant from a double.
|
|||
const MY_COOL_INT = int(777.7777);
|
||||
```
|
||||
|
||||
Static array definitions
|
||||
=========================
|
||||
# Static array definitions
|
||||
|
||||
Similar to constants, static arrays are named values, but for an array. They
|
||||
are created with the syntax:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Expressions and Operators
|
||||
=========================
|
||||
# Expressions and Operators
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -23,8 +22,7 @@ Expressions and Operators
|
|||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
Literals
|
||||
========
|
||||
# Literals
|
||||
|
||||
Much like C or most other programming languages, ZScript has object literals,
|
||||
including string literals, integer literals, float literals, name literals,
|
||||
|
@ -157,8 +155,7 @@ The null pointer literal is spelled `null` and represents an object that does
|
|||
not exist in memory. Like C, it is not equivalent to the integer literal `0`,
|
||||
and is more similar to C++'s `nullptr`.
|
||||
|
||||
Expressions
|
||||
===========
|
||||
# Expressions
|
||||
|
||||
Expressions contain literals or other such *expressions* of objects, including
|
||||
arithmetic and various conditions.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Member Declarations
|
||||
===================
|
||||
# Member Declarations
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -30,8 +29,7 @@ private int m_CoolPrivateInt;
|
|||
protected meta int m_CoolMetaInt;
|
||||
```
|
||||
|
||||
Member Declaration Flags
|
||||
========================
|
||||
# Member Declaration Flags
|
||||
|
||||
| Flag | Description |
|
||||
| ---- | ----------- |
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Method Definitions
|
||||
==================
|
||||
# Method Definitions
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -43,8 +42,7 @@ All methods which are not `static` have an implicit `self` parameter which
|
|||
refers to this object, although if you wish to refer to a member of `self`, you
|
||||
do not need to reference it directly, as it is already implicitly in scope.
|
||||
|
||||
Method Argument List
|
||||
====================
|
||||
# Method Argument List
|
||||
|
||||
Method arguments must all have a name and type, and optionally the last
|
||||
arguments in the list may have a default value, (*Version 3.3.0 and newer*)
|
||||
|
@ -86,8 +84,7 @@ Fn(5, 6, 7);
|
|||
Fn(7, 8, 9, 10);
|
||||
```
|
||||
|
||||
Method Definition Flags
|
||||
=======================
|
||||
# Method Definition Flags
|
||||
|
||||
| Flag | Description |
|
||||
| ---- | ----------- |
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Statements
|
||||
==========
|
||||
# Statements
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -25,8 +24,7 @@ All functions are made up of a list of *statements* enclosed with left and
|
|||
right braces, which in and of itself is a statement called a *compound
|
||||
statement*, or *block*.
|
||||
|
||||
Compound Statements
|
||||
===================
|
||||
# Compound Statements
|
||||
|
||||
A compound statement is formed as:
|
||||
|
||||
|
@ -39,8 +37,7 @@ A compound statement is formed as:
|
|||
Note that the statement list is optional, so an empty compound statement `{}`
|
||||
is entirely valid.
|
||||
|
||||
Expression Statements
|
||||
=====================
|
||||
# Expression Statements
|
||||
|
||||
An expression statement is the single most common type of statement in just
|
||||
about any programming language. In ZScript, exactly like C and C++, an
|
||||
|
@ -64,8 +61,7 @@ m_MyCoolMember = 500;
|
|||
5 * 5; // does nothing of course, but valid
|
||||
```
|
||||
|
||||
Conditional Statements
|
||||
======================
|
||||
# Conditional Statements
|
||||
|
||||
A conditional statement will, conditionally, choose a statement (or none) to
|
||||
execute. They work the same as in C and ACS:
|
||||
|
@ -95,8 +91,7 @@ else
|
|||
e = f;
|
||||
```
|
||||
|
||||
Switch Statements
|
||||
=================
|
||||
# Switch Statements
|
||||
|
||||
A switch statement takes an expression of integer or name type and selects a
|
||||
labeled statement to run. They work the same as in C and ACS:
|
||||
|
@ -121,8 +116,7 @@ default:
|
|||
}
|
||||
```
|
||||
|
||||
Loop Statements
|
||||
===============
|
||||
# Loop Statements
|
||||
|
||||
ZScript has five loop statements, `for`, `while`, `until`, `do while` and `do
|
||||
until`. `for`, `while` and `do while` work the same as in C, C++ and ACS, while
|
||||
|
@ -160,8 +154,7 @@ do
|
|||
until ( Expression )
|
||||
```
|
||||
|
||||
Control Flow Statements
|
||||
=======================
|
||||
# Control Flow Statements
|
||||
|
||||
As in C, there are three control flow statements that manipulate where the
|
||||
program will execute statements next, which are available contextually. They
|
||||
|
@ -238,8 +231,7 @@ int, int ReturnsTwoInts()
|
|||
}
|
||||
```
|
||||
|
||||
Local Variable Statements
|
||||
=========================
|
||||
# Local Variable Statements
|
||||
|
||||
Local variable statements are formed in one of 2 ways. The `let` keyword can be
|
||||
used to automatically determine the type of the variable from the initializer,
|
||||
|
@ -259,8 +251,7 @@ let Identifier = Expression ;
|
|||
Type Variable $[ , Variable]$... ;
|
||||
```
|
||||
|
||||
Multi-assignment Statements
|
||||
===========================
|
||||
# Multi-assignment Statements
|
||||
|
||||
Expressions or functions that return multiple values can be assigned into
|
||||
multiple variables with the syntax:
|
||||
|
@ -281,13 +272,11 @@ bool spawned;
|
|||
[spawned, mo] = A_SpawnItemEx("MyCoolActor");
|
||||
```
|
||||
|
||||
Static Array Statements
|
||||
=======================
|
||||
# Static Array Statements
|
||||
|
||||
Static arrays can be defined normally as a statement.
|
||||
|
||||
Null Statements
|
||||
===============
|
||||
# Null Statements
|
||||
|
||||
A null statement does nothing, and is formed `;`. It is similar to an empty
|
||||
compound statement.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Structure Definitions
|
||||
=====================
|
||||
# Structure Definitions
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -46,8 +45,7 @@ struct MyCoolStructure
|
|||
}
|
||||
```
|
||||
|
||||
Structure Flags
|
||||
===============
|
||||
# Structure Flags
|
||||
|
||||
| Flag | Description |
|
||||
| ---- | ----------- |
|
||||
|
@ -57,8 +55,7 @@ Structure Flags
|
|||
| `ui` | Structure has UI scope. |
|
||||
| `version ( "ver" )` | Restricted to ZScript version `ver` or higher. |
|
||||
|
||||
Structure Content
|
||||
=================
|
||||
# Structure Content
|
||||
|
||||
Structure contents are an optional list of various things logically contained
|
||||
within the structure, including:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Types
|
||||
=====
|
||||
# Types
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -36,8 +35,7 @@ Most basic types have methods attached to them, and both integer and
|
|||
floating-point type names have symbols accessible from them. See the API
|
||||
section for more information.
|
||||
|
||||
Integer Types
|
||||
=============
|
||||
# Integer Types
|
||||
|
||||
Integer types are basic integral numbers. They include:
|
||||
|
||||
|
@ -72,8 +70,7 @@ for instance `int.Max`.
|
|||
|
||||
Minimum value of type.
|
||||
|
||||
Floating-point Types
|
||||
====================
|
||||
# Floating-point Types
|
||||
|
||||
Floating-point types hold exponents, generally represented as regular decimal
|
||||
numbers. There are two such types available to ZScript:
|
||||
|
@ -138,8 +135,7 @@ Floating-point types have symbols attached which can be accessed by
|
|||
|
||||
Not-a-Number value of type.
|
||||
|
||||
Strings
|
||||
=======
|
||||
# Strings
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -149,8 +145,7 @@ The `string` type is a mutable, garbage-collected string reference type.
|
|||
Strings are not structures or classes, however there are methods attached to
|
||||
the type, detailed in the API section.
|
||||
|
||||
Names
|
||||
=====
|
||||
# Names
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -165,8 +160,7 @@ Names can be converted to `int` with an explicit cast, and the negative of
|
|||
`int(name())` may be used to create an integer representation of a string
|
||||
usable by action specials, most prominently `ACS_NamedExecute`.
|
||||
|
||||
Colors
|
||||
======
|
||||
# Colors
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -180,8 +174,7 @@ color(R, G, B)
|
|||
color(A, R, G, B)
|
||||
```
|
||||
|
||||
Vectors
|
||||
=======
|
||||
# Vectors
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -196,8 +189,7 @@ as a `vector2` with `xy`.
|
|||
Vectors can use many operators and even have special ones to themselves. See
|
||||
the Expressions and Operators section for more information.
|
||||
|
||||
Fixed-size Arrays
|
||||
=================
|
||||
# Fixed-size Arrays
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -212,8 +204,7 @@ or greater.
|
|||
|
||||
Note that this kind of type can also be declared in variable names themselves.
|
||||
|
||||
Dynamic-size Arrays
|
||||
===================
|
||||
# Dynamic-size Arrays
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -239,8 +230,7 @@ Will result in an array with 5 elements.
|
|||
Dynamically sized arrays also cannot store other dynamically sized arrays, or
|
||||
user-defined `struct` objects.
|
||||
|
||||
Maps
|
||||
====
|
||||
# Maps
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -248,8 +238,7 @@ Maps
|
|||
|
||||
Map types take the form `map<Type, Type>`. They are not yet implemented.
|
||||
|
||||
Class Types
|
||||
===========
|
||||
# Class Types
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -261,8 +250,7 @@ object. They simply take the form `class`, and can be restrained to descendants
|
|||
of a type with the syntax `class<Type>`. Strings are implicitly cast to class
|
||||
type references.
|
||||
|
||||
User Types
|
||||
==========
|
||||
# User Types
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -281,8 +269,7 @@ A type name that is within a specific scope can be accessed by prefixing it
|
|||
with a `.`. The type `.MyClass.MySubStructure` will resolve to the type
|
||||
`MySubStructure` contained within `MyClass`.
|
||||
|
||||
Read-only Types
|
||||
===============
|
||||
# Read-only Types
|
||||
|
||||
| Name | Usable as argument |
|
||||
| ---- | :----------------: |
|
||||
|
@ -292,8 +279,7 @@ A read-only type, as its name implies, may only be read from, and is
|
|||
effectively immutable. They take the form `readonly<Type>`. Do note that this
|
||||
is separate from the member declaration flag.
|
||||
|
||||
Other Types
|
||||
===========
|
||||
# Other Types
|
||||
|
||||
| Name | Usable as argument | Description |
|
||||
| ---- | :----------------: | ----------- |
|
||||
|
@ -308,8 +294,7 @@ Other Types
|
|||
|
||||
Strings will implicitly convert to `sound` and `statelabel`.
|
||||
|
||||
Variable Name
|
||||
=============
|
||||
# Variable Name
|
||||
|
||||
Variable names can have an array's size on them, instead of on the type, or
|
||||
none. Variable names are formed as either:
|
||||
|
@ -319,8 +304,7 @@ Identifier
|
|||
Identifier Array-size
|
||||
```
|
||||
|
||||
Array Size
|
||||
==========
|
||||
# Array Size
|
||||
|
||||
Array sizes can be multi-dimensional or automatically sized, so all of the
|
||||
following syntaxes are available:
|
||||
|
|
25
lang.md
25
lang.md
|
@ -1,5 +1,4 @@
|
|||
Language
|
||||
========
|
||||
# Language
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
@ -40,8 +39,7 @@ the hope that it is useful reference and serves as a solid basis for further
|
|||
writings. This document was originally written by Alison Sanderson (Marrub.)
|
||||
Attribution is encouraged but not required.
|
||||
|
||||
Reading This Document
|
||||
=====================
|
||||
# Reading This Document
|
||||
|
||||
This document's syntaxes are written in a specific way to be easy to read but
|
||||
still close enough to a formal syntax that, for instance, someone writing a
|
||||
|
@ -58,8 +56,7 @@ element spellings:
|
|||
| `$[` and `]$` | An optional syntax element, which may be omitted by the user. |
|
||||
| `"text"` | Any string literal, contents do not necessarily have to be what is inside unless explicitly stated. |
|
||||
|
||||
Translation Unit
|
||||
================
|
||||
# Translation Unit
|
||||
|
||||
Full ZScript files are referred to as "translation units." This terminology
|
||||
comes from the C standard, and refers simply to the entirety of a ZScript
|
||||
|
@ -73,8 +70,7 @@ Included translation units may not have version directives.
|
|||
|
||||
All keywords and identifiers in ZScript are case insensitive.
|
||||
|
||||
Versions
|
||||
========
|
||||
# Versions
|
||||
|
||||
A version directive may be placed at the very beginning of a ZScript file, the
|
||||
syntax being:
|
||||
|
@ -88,8 +84,7 @@ Where `num` is the ZScript version to use. By default ZScript is version
|
|||
by this documentation and it is highly encouraged to always use the latest
|
||||
version of ZScript. The minimum version supported by this documentation is 3.0.
|
||||
|
||||
Top-level
|
||||
=========
|
||||
# Top-level
|
||||
|
||||
A ZScript file can have one of several things at the top level of the file,
|
||||
following a version directive:
|
||||
|
@ -101,8 +96,7 @@ following a version directive:
|
|||
- Include directives
|
||||
|
||||
|
||||
Include directives
|
||||
==================
|
||||
# Include directives
|
||||
|
||||
Include directives include other files to be processed by the ZScript compiler,
|
||||
allowing you to organize and separate code into different files. Their syntax
|
||||
|
@ -127,12 +121,11 @@ Basic includes.
|
|||
#include "zscript/MyCoolMod/MyCoolClasses.zsc"
|
||||
```
|
||||
|
||||
Table of Contents
|
||||
=================
|
||||
# Table of Contents
|
||||
|
||||
Finally, here is a table of contents for each language element:
|
||||
|
||||
<!-- toc glossary -->
|
||||
<!-- inter-toc -->
|
||||
|
||||
* [Classes](lang-Classes.md)
|
||||
* [Constants](lang-Constants.md)
|
||||
|
@ -144,6 +137,6 @@ Finally, here is a table of contents for each language element:
|
|||
* [Structures](lang-Structures.md)
|
||||
* [Types](lang-Types.md)
|
||||
|
||||
<!-- toc end -->
|
||||
<!-- end -->
|
||||
|
||||
<!-- EOF -->
|
||||
|
|
|
@ -15,7 +15,8 @@ def filter_emit r
|
|||
end
|
||||
|
||||
def find_toc_areas f
|
||||
f.to_enum(:scan, /^(<!-- toc (.+) -->)(?:.|\n)*?(<!-- toc end -->)/i).map{$~}
|
||||
re = /^(<!-- inter-toc ([^\s]+)\s+-->)(?:.|\n)*?(<!-- end -->)/i
|
||||
f.to_enum(:scan, re).map{$~}
|
||||
end
|
||||
|
||||
def filter_toc_areas f
|
||||
|
@ -41,8 +42,16 @@ def rewrite fnam
|
|||
File.write fnam, o
|
||||
end
|
||||
|
||||
rewrite "api.md" do |f| filter_toc_areas f do |a| /api-#{a}-(\w+).md/ end end
|
||||
rewrite "glossary.md" do |f| filter_toc_areas f do |a| /glossary-(\w+).md/ end end
|
||||
rewrite "lang.md" do |f| filter_toc_areas f do |a| /lang-(\w+).md/ end end
|
||||
rewrite "api.md" do |f|
|
||||
filter_toc_areas f do |a| /api-#{a}-(\w+).md/ end
|
||||
end
|
||||
|
||||
rewrite "glossary.md" do |f|
|
||||
filter_toc_areas f do |a| /glossary-(\w+).md/ end
|
||||
end
|
||||
|
||||
rewrite "lang.md" do |f|
|
||||
filter_toc_areas f do |a| /lang-(\w+).md/ end
|
||||
end
|
||||
|
||||
## EOF
|
||||
|
|
Loading…
Reference in New Issue