Difference between revisions of "Mission Task Events"

From Bit Phoenix Software
Jump to navigation Jump to search
(CommandComplete)
 
Line 41: Line 41:
 
This is because the <code>cd</code> command uses '''Docopt''' for argument parsing, and thus has an internal map of keys to values.  This map is sent along with the command event for your convenience, but not all commands will do this.
 
This is because the <code>cd</code> command uses '''Docopt''' for argument parsing, and thus has an internal map of keys to values.  This map is sent along with the command event for your convenience, but not all commands will do this.
  
 +
=== <code>CryptoTransaction</code> ===
 +
 +
Occurs when a cryptocurrency transaction between two wallets succeeds.
 +
 +
==== Arguments ====
 +
 +
From: <wallet address>
 +
To: <wallet address>
 +
Amount: <amount of currency exchanged>
  
 
[[Category:Peacenet]]
 
[[Category:Peacenet]]
 
[[Category:Peacenet Developer Reference]]
 
[[Category:Peacenet Developer Reference]]

Latest revision as of 15:26, 8 April 2019

The Peacenet's mission system can be signaled by the rest of the game when the player performs certain actions. This signals are called Mission Task Events and are the basis for many of the supported Mission Tasks in the game. If you want to write your own Mission Tasks or send your own signals to the mission system, it is helpful to know how these work.

Anatomy

A Mission Task Event is simply a signal that flows into the mission system, with a name and arguments. Everything is a glorified string. The arguments come in the form of key-value-pairs.

The event name is used to signal to the mission what event occurred, while the arguments are used to supply extra data along with the event for context.

For example, an event signalling a Terminal Command running may come in with the name CommandComplete and the arguments

Command: cat
Arguments: /etc/hostname

signifying that the player ran the command cat /etc/hostname.

Pipeline

Mission task events can be pushed out from anywhere in the game where one has access to a Peacenet World State Actor. In Blueprint, this can be done by using the Get Peacenet nodes on a User Context or System Context.

The event is pushed to the World State Actor, which first determines if the player is in a mission at the moment. If so, the Mission State Actor receives the event, which then forwards it to the currently running Mission Task through an overrideable function.

Common events

Below are some details about some common events sent by the game.

CommandComplete

Occurs when a Terminal command is finished running.

Arguments

Command: <name of command>
Arguments: <command-line arguments>

Note: Commands may send extra data along with the event, but this isn't guaranteed. This data is that of the command's Docopt Argument Map. So in the case of cd, the event arguments may look like this:

Command: cd
Arguments: /etc
<path>: /etc

This is because the cd command uses Docopt for argument parsing, and thus has an internal map of keys to values. This map is sent along with the command event for your convenience, but not all commands will do this.

CryptoTransaction

Occurs when a cryptocurrency transaction between two wallets succeeds.

Arguments

From: <wallet address>
To: <wallet address>
Amount: <amount of currency exchanged>