Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Osiris/Functions: Difference between revisions

From MoonGlasses Wiki
Created page with "== Osiris Functions: Queries, Calls and Events == ----This page outlines different types of Osiris functions and how to use them. '''TODO''': link to story editor and Osiris Terms (for terminology section): * Osiris Function * Binding, Known value * Query * Call * Event * Story (script) * Procedure * Rule * Return * Patter Matching ---- === Table of Contents === * Overview: Disambiguation, kinds of functions, IO, "binding" and argument types * All Functions * Func..."
Tag: 2017 source edit
m 1 revision imported
 
(No difference)

Latest revision as of 23:44, 16 January 2025

Osiris Functions: Queries, Calls and Events


This page outlines different types of Osiris functions and how to use them.

TODO: link to story editor and Osiris

Terms (for terminology section):

  • Osiris Function
  • Binding, Known value
  • Query
  • Call
  • Event
  • Story (script)
  • Procedure
  • Rule
  • Return
  • Patter Matching

Table of Contents

  • Overview: Disambiguation, kinds of functions, IO, "binding" and argument types
  • All Functions
  • Functions Listed by Kind
    • Calls
    • Queries
    • Events

Overview: Disambiguation, kinds of functions, IO, "binding" and argument types

In this context functions describes the intrinsic (build-in) functions of the Story script, which differ from customly defined Queries, Procedures and Rules, which are all prefixed with QRY, PROC and IF respectively.

There are three kinds of (intrinsic) functions: Calls, Events and Queries. In short Calls do something, Events trigger when something happens to enable responding to the event and Queries (broadly) ask questions about some game state and return (output) answers, though queries may also modify some game state.

Functions have a number of arguments which have a type. Arguments can either be inputs or outputs, outputs can also be pattern matched. Calls only have inputs and can only appear in a THEN part of an expression (TODO!). Events only have outputs and can only appear at the beginning of Rules; to have things happen conditioned on multiple events, they need to be broken up into smaller helper Rules. Queries can perform actions depending on some inputs and then (for purposes of the code flow "instantaneously") return some outputs.

Inputs to queries or calls have to be constants or bound variables (known value), outputs can be either unbound variables, in which case the variable binds to the output, or constants or bound variables too, in which case the output is compared to the value of the known value and the rule only proceeds if it matches (equals) the output. (TODO clarify, perhaps with examples)

The same applies to events, where a known value results in an equality check and an unbound variable is bound to the corresponding output.

Examples

IF
Event("Constant String", (TYPE) _Variable)
AND
Query(_Variable, "Example", _Amount)
THEN
Call(_Variable, _Amount);



All Functions

See Osiris/Functions/All


Go up Osiris

MediaWiki Appliance - Powered by TurnKey Linux