ScummVM API documentation
Ultima::Ultima4::Script Class Reference

#include <script.h>

Classes

class  Provider
 

Public Types

enum  ReturnCode { RET_OK , RET_REDIRECTED , RET_STOP }
 
enum  State { STATE_UNLOADED , STATE_NORMAL , STATE_DONE , STATE_INPUT }
 
enum  InputType {
  INPUT_CHOICE , INPUT_NUMBER , INPUT_STRING , INPUT_DIRECTION ,
  INPUT_PLAYER , INPUT_KEYPRESS
}
 
enum  Action {
  ACTION_SET_CONTEXT , ACTION_UNSET_CONTEXT , ACTION_END , ACTION_REDIRECT ,
  ACTION_WAIT_FOR_KEY , ACTION_WAIT , ACTION_STOP , ACTION_INCLUDE ,
  ACTION_FOR_LOOP , ACTION_RANDOM , ACTION_MOVE , ACTION_SLEEP ,
  ACTION_CURSOR , ACTION_PAY , ACTION_IF , ACTION_INPUT ,
  ACTION_ADD , ACTION_LOSE , ACTION_HEAL , ACTION_CAST_SPELL ,
  ACTION_DAMAGE , ACTION_KARMA , ACTION_MUSIC , ACTION_SET_VARIABLE ,
  ACTION_ZTATS
}
 

Public Member Functions

 Script ()
 
void addProvider (const Common::String &name, Provider *p)
 
bool load (const Common::String &filename, const Common::String &baseId, const Common::String &subNodeName="", const Common::String &subNodeId="")
 
void unload ()
 
void run (const Common::String &script)
 
ReturnCode execute (Shared::XMLNode *script, Shared::XMLNode *currentItem=nullptr, Common::String *output=nullptr)
 
void _continue ()
 
void resetState ()
 
void setState (State state)
 
State getState ()
 
void setTarget (const Common::String &val)
 
void setChoices (const Common::String &val)
 
void setVar (const Common::String &name, const Common::String &val)
 
void setVar (const Common::String &name, int val)
 
void unsetVar (const Common::String &name)
 
Common::String getTarget ()
 
InputType getInputType ()
 
Common::String getInputName ()
 
Common::String getChoices ()
 
int getInputMaxLen ()
 

Detailed Description

An xml-scripting class. It loads and runs xml scripts that take information and interact with the game environment itself. Currently, it is mainly useful for writing vendor code; however, it should be possible to write scripts for other parts of the game.

  • Strip vendor-specific code from the language
  • Fill in some of the missing integration with the game

Member Enumeration Documentation

◆ ReturnCode

A script return code

◆ State

The current state of the script

◆ InputType

The type of input the script is requesting

◆ Action

The action that the script is taking

Constructor & Destructor Documentation

◆ Script()

Ultima::Ultima4::Script::Script ( )

Constructs a script object

Member Function Documentation

◆ addProvider()

void Ultima::Ultima4::Script::addProvider ( const Common::String &  name,
Provider *  p 
)

Adds an information provider for the script

◆ load()

bool Ultima::Ultima4::Script::load ( const Common::String &  filename,
const Common::String &  baseId,
const Common::String &  subNodeName = "",
const Common::String &  subNodeId = "" 
)

Loads the vendor script

◆ unload()

void Ultima::Ultima4::Script::unload ( )

Unloads the script

◆ run()

void Ultima::Ultima4::Script::run ( const Common::String &  script)

Runs a script after it's been loaded

◆ execute()

ReturnCode Ultima::Ultima4::Script::execute ( Shared::XMLNode *  script,
Shared::XMLNode *  currentItem = nullptr,
Common::String *  output = nullptr 
)

Executes the subscript 'script' of the main script

◆ _continue()

void Ultima::Ultima4::Script::_continue ( )

Continues the script from where it left off, or where the last script indicated

◆ resetState()

void Ultima::Ultima4::Script::resetState ( )

Set and retrieve property values


The documentation for this class was generated from the following file: