PowerQuest  0.15.3
IPowerQuest Interface Reference

Detailed Description

PowerQuest is the main hub for the adventure game engine (Access with E) - eg. E.Wait(2);.

Most adventure game functionality not tied to a room/character/item/etc is accessed through here. Including:

  • Pausing scripts with Wait commands
  • Displaying text boxes
  • Save/Restore games
  • Accessing Camera, Cursor, and other adventure game objects
  • Access to game settings
  • Triggering "interactions" of other objects
  • Little helper utilities
  • Eg.
       E.FadeOut(1);          
      E.Wait(3);
      if ( E.FirstOccurance("AteBadPie") )
          E.ChangeRoom(R.Vomitorium);
      E.Save(1);
      E.StartCutscene;

Properties

YieldInstruction Break [get]
 yield return this in an empty function (so it doesn't give an error, and doesn't consume an update cycle like a doing "yield break" does) More...
 
YieldInstruction ConsumeEvent [get]
 yield return this if nothing is happening in a function, but you don't want to fall back to an Unhandled Event More...
 
ICamera Camera [get]
 Convenient shortcut to the game camera. More...
 
ICursor Cursor [get]
 Convenient shortcut to the Cursor. More...
 
Color FadeColor [get, set]
 Get/Set the face colour. More...
 
bool Paused [get, set]
 Gets or sets whether the game is paused. More...
 
ICharacter Player [get, set]
 Gets or sets the current player controlled character. More...
 
IInventory ActiveInventory [get, set]
 Shortcut to the current player's active inventory (the one currently selected for use on things). You can use the shorter I.Active More...
 
int InlineDialogResult [get]
 Retrieves the option that was picked in the last call to WaitForInlineDialog() More...
 
float VerticalResolution [get]
 Returns the currentvertical resolution including any overrides from the current room. More...
 
float DefaultVerticalResolution [get]
 Returns the project's vertical resolution set in PowerQuest. More...
 
QuestSettings Settings [get]
 The game settings object. More...
 

Public Member Functions

Coroutine Wait (float time=0.5f)
 Wait for time (or default 0.5 sec) More...
 
Coroutine WaitSkip (float time=0.5f)
 Wait for time (or default 0.5 sec). Pressing button will skip the waiting. More...
 
Coroutine WaitFor (PowerQuest.DelegateWaitForFunction functionToWaitFor)
 Use this when you want to yield to another function that returns an IEnumerator Usage: yield return E.WaitFor( SimpleExampleFunction ); or yield return E.WaitFor( ()=>ExampleFunctionWithParams(C.Dave, "lol") ); More...
 
Coroutine WaitWhile (System.Func< bool > condition, bool skippable=false)
 Use this when you want to wait until a condition is net. You need the ()=> to Usage: yield return E.WaitWhile( ()=> C.Player.Walking ) More...
 
Coroutine WaitUntil (System.Func< bool > condition, bool skippable=false)
 Use this when you want to wait until a condition is net. You need the ()=> to Usage: yield return E.WaitUntil( ()=> C.Player.Position.x > 0 ) More...
 
Coroutine WaitForDialog ()
 Waits until the current dialog has finished. Useful for waiting to the end of SayBG commands. More...
 
Coroutine WaitForGui (IGui gui)
 Shows gui and waits for it to disappear. Useful for prompts. More...
 
void DelayedInvoke (float time, System.Action functionToInvoke)
 Invokes the specified function after the specified time has elapsed (non-blocking). EG: E.DelayedInvoke(1, ()=/>{ C.Player.FaceLeft(); } ); More...
 
bool GetBlocked ()
 Returns true if there's a blocking script currently running. More...
 
Coroutine Display (string dialog, int id=-1)
 Display narrator dialog. More...
 
Coroutine DisplayBG (string dialog, int id=-1)
 Display narrator dialog (without blocking) More...
 
void StartCutscene ()
 Starts a cutscene. If player presses esc, the game will skip forward until the next EndCutscene() More...
 
void EndCutscene ()
 Ends a cutscene. When plyer presses esc after a "StartCutscene", this is where they'll skip to. More...
 
bool GetSkippingCutscene ()
 Returns true when a cutscene is currently being skipped. Can be used to check if your own code should be skipped, or if a sequence you're in has been skipped. More...
 
Coroutine FadeIn (float time=0.2f, bool skippable=true)
 Fade the screen from the current FadeColor. More...
 
Coroutine FadeOut (float time=0.2f, bool skippable=true)
 Fade the screen to the current FadeColor. More...
 
void FadeInBG (float time=0.2f)
 Fade the screen from the current FadeColor (non-blocking) More...
 
void FadeOutBG (float time=0.2f)
 Fade the screen to the current FadeColor (non-blocking) More...
 
bool GetFading ()
 Returns true if a fadeout/in is currently active. More...
 
void FadeColorRestore ()
 Return fade color to it's original value. More...
 
void Pause (string source=null)
 Pauses the game. Pass a string as a source in case multiple things have paused/unpaused the game. More...
 
void UnPause (string source=null)
 Unpauses the game. Use the same source string you paused the game with (if any). More...
 
void SetTimer (string name, float time)
 
bool GetTimerExpired (string name)
 
float GetTimer (string name)
 Returns the time remaining on the timer with specified name. More...
 
void ChangeRoomBG (IRoom room)
 Change the current room. Same as calling C.Player.Room = room;. More...
 
Coroutine ChangeRoom (IRoom room)
 Change the current room. And blocks until after OnEnterAfterFade of the new room finishes. More...
 
Room GetCurrentRoom ()
 The room the player's in (R.Current) More...
 
Room GetRoom (string scriptName)
 Retrieve a room by it's name. More...
 
Character GetPlayer ()
 Get the current player controlled character. More...
 
void SetPlayer (ICharacter character)
 Set the current player controlled character. If in another room, will trigger room transition. More...
 
Character GetCharacter (string scriptName)
 Retrieve a character by it's name. eg E.GetCharacter("Dave"); Usually you would just use C.Dave More...
 
Inventory GetInventory (string scriptName)
 Retrieve an inventory item by it's name. Eg E.GetInventory("Screwdriver");, Usually you would just use I.Screwdriver More...
 
DialogTree GetDialogTree (string scriptName)
 Retrieve the currently active dialog. Eg. E.GetCurrentDialog().OptionOff(1);. Same as D.Current More...
 
Coroutine WaitForInlineDialog (params string[] options)
 
Gui GetGui (string scriptName)
 Retreive a Gui item by it's name. More...
 
GameObject GetSpawnablePrefab (string name)
 Find a prefab to spawn by name. Usage: E.GetSpawnablePrefab("SparkleEffect").Spawn(...);. More...
 
UnityEngine.Camera GetCameraGui ()
 Returns the Gui Camera. More...
 
Canvas GetCanvas ()
 Returns the Gui Canvas. More...
 
Vector2 GetMousePosition ()
 Returns the current mouse position. More...
 
IQuestClickable GetMouseOverClickable ()
 Returns the "clickable object" that the mouse is over (could be a character, hotspot, etc). Returns null of the mouse cursor isn't over anything. More...
 
eQuestClickableType GetMouseOverType ()
 Returns the type of clickable that the mouse is over as an eQuestClickableType (eg, could be a character, hotspot, etc). More...
 
string GetMouseOverDescription ()
 Returns the display name of the object the mouse is over. More...
 
Vector2 GetLastLookAt ()
 Returns the "Look at" position of the last thing clicked. More...
 
Vector2 GetLastWalkTo ()
 Returns the "Walk To" position of the last thing clicked. More...
 
void SetTextSpeedMultiplier (float multiplier)
 Sets the text speed multiplier, for slowing/speeding up game text. More...
 
float GetTextSpeedMultiplier ()
 Gets the text speed multiplier, for slowing/speeding up game text. More...
 
bool ProcessClick (eQuestVerb verb)
 Starts the specified action for the verb on whatever the mouse is over (whatever the current GetMouseOverClickable() happens to be ). More...
 
bool ProcessClick (eQuestVerb verb, IQuestClickable clickable, Vector2 mousePosition)
 
Coroutine HandleInteract (IHotspot target)
 Runs a "Use Hotspot" sequence. More...
 
Coroutine HandleLookAt (IHotspot target)
 Runs a "Look at Hotspot" sequence. More...
 
Coroutine HandleInventory (IHotspot target, IInventory item)
 Runs a "Use inventory on hostpot" sequence. More...
 
Coroutine HandleInteract (IProp target)
 Runs a "Use Prop" sequence. More...
 
Coroutine HandleLookAt (IProp target)
 Runs a "Look at Prop" sequence. More...
 
Coroutine HandleInventory (IProp target, IInventory item)
 Runs a "Use inventory on Prop" sequence. More...
 
Coroutine HandleInteract (ICharacter target)
 Runs a "Use Character" sequence. More...
 
Coroutine HandleLookAt (ICharacter target)
 Runs a "Look at Character" sequence. More...
 
Coroutine HandleInventory (ICharacter target, IInventory item)
 Runs a "Use inventory on Character" sequence. More...
 
Coroutine HandleInteract (IInventory target)
 Runs a "Use Inventory" sequence. More...
 
Coroutine HandleLookAt (IInventory target)
 Runs a "Look at Inventory" sequence. More...
 
Coroutine HandleInventory (IInventory target, IInventory item)
 Runs a "Use inventory on Inventory" sequence. More...
 
void DisableCancel ()
 Stops sequence from being cancelled when user clicks something else while walking there. Place either at start of script to prevent first WalkTo being cancelable. More...
 
bool FirstOccurance (string uniqueString)
 Registers something "occuring", and returns whether it's the first time it's occurred. More...
 
int Occurrance (string uniqueString)
 Registers something "occuring", and returns the number of time's it's occurred. Returns 0 the first time, then 1, etc. More...
 
int GetOccuranceCount (string uniqueString)
 Checks how many times something has occurred, without incrementing the occurance. More...
 
void Restart ()
 Restart the game from the first scene. More...
 
void DisableAllClickablesExcept (params string[] exceptions)
 Helper function that temporarily disables all clickables, except those specified. Useful when you want to set only certain props clickable for a short time. Eg: E.DisableAllClickablesExcept("Ropes","BrokenGlass"); More...
 
void RestoreAllClickables ()
 Helper function that restores clickables disabled with the DisableAllClickablesExcept function. More...
 
void SetAllClickableCursors (string cursor, params string[] exceptions)
 Set all clickables to have a specific cursor temporarily, restore using RestoreAllClickableCursors(). Eg: E.SetAllClickableCursors("None", "Ropes","BrokenGlass"); More...
 
void RestoreAllClickableCursors ()
 Resets all clickable cursors after a call to "SetAllClickableCursors". More...
 
List< QuestSaveSlotData > GetSaveSlotData ()
 Returns a list of all save slot data. More...
 
QuestSaveSlotData GetSaveSlotData (int slot)
 Returns save slot data for a particular save game. The data has info about the name, etc of the save file. More...
 
bool Save (int slot, string description)
 Saves the game to a particular slot with a particular description. More...
 
bool RestoreSave (int slot)
 Restores the game from a particular slot. More...
 
bool DeleteSave (int slot)
 Deletes a save game from a particular slot. More...
 
void AddSaveData (string name, object data, System.Action OnPostRestore=null)
 Advanced save/restore function: For saving data not in a QuestScript... More...
 
void RemoveSaveData (string name)
 Advanced save/restore function: For aving data not in a QuestScript. Call this when you've called AddSaveData, but no longer want to save that data. More...
 
GetScript< T > ()
 PowerQuest internal function: Retrieve a quest script by it's type. So you can access your functions/variables in your own scripts. Eg: E.GetScript<RoomKitchen>().m_tapsOn = true;. More...
 

Property Documentation

◆ Break

YieldInstruction Break
get

yield return this in an empty function (so it doesn't give an error, and doesn't consume an update cycle like a doing "yield break" does)

◆ ConsumeEvent

YieldInstruction ConsumeEvent
get

yield return this if nothing is happening in a function, but you don't want to fall back to an Unhandled Event

◆ Camera

ICamera Camera
get

Convenient shortcut to the game camera.

◆ Cursor

ICursor Cursor
get

Convenient shortcut to the Cursor.

◆ FadeColor

Color FadeColor
getset

Get/Set the face colour.

◆ Paused

bool Paused
getset

Gets or sets whether the game is paused.

◆ Player

ICharacter Player
getset

Gets or sets the current player controlled character.

◆ ActiveInventory

IInventory ActiveInventory
getset

Shortcut to the current player's active inventory (the one currently selected for use on things). You can use the shorter I.Active

◆ InlineDialogResult

int InlineDialogResult
get

Retrieves the option that was picked in the last call to WaitForInlineDialog()

◆ VerticalResolution

float VerticalResolution
get

Returns the currentvertical resolution including any overrides from the current room.

◆ DefaultVerticalResolution

float DefaultVerticalResolution
get

Returns the project's vertical resolution set in PowerQuest.

◆ Settings

QuestSettings Settings
get

The game settings object.

Member Function Documentation

◆ Wait()

Coroutine Wait ( float  time = 0.5f)

Wait for time (or default 0.5 sec)

◆ WaitSkip()

Coroutine WaitSkip ( float  time = 0.5f)

Wait for time (or default 0.5 sec). Pressing button will skip the waiting.

◆ WaitFor()

Coroutine WaitFor ( PowerQuest.DelegateWaitForFunction  functionToWaitFor)

Use this when you want to yield to another function that returns an IEnumerator Usage: yield return E.WaitFor( SimpleExampleFunction ); or yield return E.WaitFor( ()=>ExampleFunctionWithParams(C.Dave, "lol") );

Parameters
functionToWaitForA function that returns IEnumerator. Eg: SimpleExampleFunction or, ()=/>ExampleFunctionWithParams(C.Dave, 69) if it has params

◆ WaitWhile()

Coroutine WaitWhile ( System.Func< bool >  condition,
bool  skippable = false 
)

Use this when you want to wait until a condition is net. You need the ()=> to Usage: yield return E.WaitWhile( ()=> C.Player.Walking )

◆ WaitUntil()

Coroutine WaitUntil ( System.Func< bool >  condition,
bool  skippable = false 
)

Use this when you want to wait until a condition is net. You need the ()=> to Usage: yield return E.WaitUntil( ()=> C.Player.Position.x > 0 )

◆ WaitForDialog()

Coroutine WaitForDialog ( )

Waits until the current dialog has finished. Useful for waiting to the end of SayBG commands.

◆ WaitForGui()

Coroutine WaitForGui ( IGui  gui)

Shows gui and waits for it to disappear. Useful for prompts.

◆ DelayedInvoke()

void DelayedInvoke ( float  time,
System.Action  functionToInvoke 
)

Invokes the specified function after the specified time has elapsed (non-blocking). EG: E.DelayedInvoke(1, ()=/>{ C.Player.FaceLeft(); } );

◆ GetBlocked()

bool GetBlocked ( )

Returns true if there's a blocking script currently running.

◆ Display()

Coroutine Display ( string  dialog,
int  id = -1 
)

Display narrator dialog.

◆ DisplayBG()

Coroutine DisplayBG ( string  dialog,
int  id = -1 
)

Display narrator dialog (without blocking)

◆ StartCutscene()

void StartCutscene ( )

Starts a cutscene. If player presses esc, the game will skip forward until the next EndCutscene()

See also
StartCutscene
EndCutscene

◆ EndCutscene()

void EndCutscene ( )

Ends a cutscene. When plyer presses esc after a "StartCutscene", this is where they'll skip to.

See also
StartCutscene
EndCutscene

◆ GetSkippingCutscene()

bool GetSkippingCutscene ( )

Returns true when a cutscene is currently being skipped. Can be used to check if your own code should be skipped, or if a sequence you're in has been skipped.

eg: while ( m_boolToWaitFor && E.GetSkippingCutscene() == false ) yield return E.Wait(0);

See also
StartCutscene
EndCutscene

◆ FadeIn()

Coroutine FadeIn ( float  time = 0.2f,
bool  skippable = true 
)

Fade the screen from the current FadeColor.

◆ FadeOut()

Coroutine FadeOut ( float  time = 0.2f,
bool  skippable = true 
)

Fade the screen to the current FadeColor.

◆ FadeInBG()

void FadeInBG ( float  time = 0.2f)

Fade the screen from the current FadeColor (non-blocking)

◆ FadeOutBG()

void FadeOutBG ( float  time = 0.2f)

Fade the screen to the current FadeColor (non-blocking)

◆ GetFading()

bool GetFading ( )

Returns true if a fadeout/in is currently active.

◆ FadeColorRestore()

void FadeColorRestore ( )

Return fade color to it's original value.

◆ Pause()

void Pause ( string  source = null)

Pauses the game. Pass a string as a source in case multiple things have paused/unpaused the game.

◆ UnPause()

void UnPause ( string  source = null)

Unpauses the game. Use the same source string you paused the game with (if any).

◆ SetTimer()

void SetTimer ( string  name,
float  time 
)

Starts timer with a name, counting down from time in seconds.

Use the same name to check whether the timer has finished by calling the GetTimerExpired(string name) function. The name is NOT case sensitive.

You can check the current time remaining on a timer by calling the GetTimer(string name) function, using the same name used to start the timer.

Pass time as 0 to disable a currently running timer.

NOTE: the timer will not tick while the game is paused.

Example:

`E.SetTimer("egg",6) );`

Will set the timer "egg" to expire after 6 seconds.

Rolling your own timers:

AGS users are familiar with the SetTimer() function, which is why it is included. However, it's good to know how to make your own timers, it's a fundamental building block of game coding!

This is how most coders would implement a simple timer:

In your script body or header, add a float variable: float m_myTimer = 0;

When you want to start a timer, in an interaction script for example: m_myTimer = 4; // Set to 4 seconds

And in your Update function:

if ( m_myTimer > 0) // If the timer is started
{
    m_myTimer -= Time.deltaTime; // Subtract the time since last update
    if ( m_myTimer <= 0 ) // Check if the timer's elapsed
    {

The timer has elapsed! Do something! } }

See also
GetTimerExpired
GetTimer

◆ GetTimerExpired()

bool GetTimerExpired ( string  name)

Checks whether the timer with specified name has expired. If the timeout set with SetTimer has elapsed, returns true. Otherwise, returns false.

Note that this function will only return true once - after that, the timer will always return false until restarted

Example: (in UpdateBlocking)

if ( E.GetTimerExpired("egg") ) 
    Display: Egg timer expired

will display a message when timer "egg" expires.

See also
SetTimer
GetTimer

◆ GetTimer()

float GetTimer ( string  name)

Returns the time remaining on the timer with specified name.

See also
SetTimer
GetTimerExpired

◆ ChangeRoomBG()

void ChangeRoomBG ( IRoom  room)

Change the current room. Same as calling C.Player.Room = room;.

◆ ChangeRoom()

Coroutine ChangeRoom ( IRoom  room)

Change the current room. And blocks until after OnEnterAfterFade of the new room finishes.

Example: Have a player look through a window, show the other room, then change back, in a single script:

Display: You peer into the window
E.ChangeRoom(R.InsideHouse);
Dave: Sure looks interesting in there!
E.ChangeRoom(R.OutsideHouse);
Dave: But I'll stay out here for now
See also
ChangeRoomBG

◆ GetCurrentRoom()

Room GetCurrentRoom ( )

The room the player's in (R.Current)

◆ GetRoom()

Room GetRoom ( string  scriptName)

Retrieve a room by it's name.

◆ GetPlayer()

Character GetPlayer ( )

Get the current player controlled character.

◆ SetPlayer()

void SetPlayer ( ICharacter  character)

Set the current player controlled character. If in another room, will trigger room transition.

◆ GetCharacter()

Character GetCharacter ( string  scriptName)

Retrieve a character by it's name. eg E.GetCharacter("Dave"); Usually you would just use C.Dave

◆ GetInventory()

Inventory GetInventory ( string  scriptName)

Retrieve an inventory item by it's name. Eg E.GetInventory("Screwdriver");, Usually you would just use I.Screwdriver

◆ GetDialogTree()

DialogTree GetDialogTree ( string  scriptName)

Retrieve the currently active dialog. Eg. E.GetCurrentDialog().OptionOff(1);. Same as D.Current

Retrieve an dialog tree by it's name. Eg: E.GetDialogTree("ChatWithBarney"). Usually you would just use D.ChatWithBarney

◆ WaitForInlineDialog()

Coroutine WaitForInlineDialog ( params string []  options)

Shows a dialog with the specified text options, and waits until something's selected before continuing. Use IPowerQuest.InlineDialogResult to check what was clicked on afterwards

Barney: You fight like a dairy farmer!
E.WaitForInlineDialog("How appropriate, you fight like a cow", "I am rubber, you are glue", "I'm shakin' I'm shakin'");
if ( E.InlineDialogResult == 2 )
WinSwordFight();

◆ GetGui()

Gui GetGui ( string  scriptName)

Retreive a Gui item by it's name.

◆ GetSpawnablePrefab()

GameObject GetSpawnablePrefab ( string  name)

Find a prefab to spawn by name. Usage: E.GetSpawnablePrefab("SparkleEffect").Spawn(...);.

◆ GetCameraGui()

UnityEngine.Camera GetCameraGui ( )

Returns the Gui Camera.

◆ GetCanvas()

Canvas GetCanvas ( )

Returns the Gui Canvas.

◆ GetMousePosition()

Vector2 GetMousePosition ( )

Returns the current mouse position.

◆ GetMouseOverClickable()

IQuestClickable GetMouseOverClickable ( )

Returns the "clickable object" that the mouse is over (could be a character, hotspot, etc). Returns null of the mouse cursor isn't over anything.

◆ GetMouseOverType()

eQuestClickableType GetMouseOverType ( )

Returns the type of clickable that the mouse is over as an eQuestClickableType (eg, could be a character, hotspot, etc).

◆ GetMouseOverDescription()

string GetMouseOverDescription ( )

Returns the display name of the object the mouse is over.

◆ GetLastLookAt()

Vector2 GetLastLookAt ( )

Returns the "Look at" position of the last thing clicked.

◆ GetLastWalkTo()

Vector2 GetLastWalkTo ( )

Returns the "Walk To" position of the last thing clicked.

◆ SetTextSpeedMultiplier()

void SetTextSpeedMultiplier ( float  multiplier)

Sets the text speed multiplier, for slowing/speeding up game text.

◆ GetTextSpeedMultiplier()

float GetTextSpeedMultiplier ( )

Gets the text speed multiplier, for slowing/speeding up game text.

◆ ProcessClick()

bool ProcessClick ( eQuestVerb  verb)

Starts the specified action for the verb on whatever the mouse is over (whatever the current GetMouseOverClickable() happens to be ).

This would usually be called from the OnMouseClick function in your global script Returns true if the click resulted in a blocking function

◆ HandleInteract() [1/4]

Coroutine HandleInteract ( IHotspot  target)

Runs a "Use Hotspot" sequence.

◆ HandleLookAt() [1/4]

Coroutine HandleLookAt ( IHotspot  target)

Runs a "Look at Hotspot" sequence.

◆ HandleInventory() [1/4]

Coroutine HandleInventory ( IHotspot  target,
IInventory  item 
)

Runs a "Use inventory on hostpot" sequence.

◆ HandleInteract() [2/4]

Coroutine HandleInteract ( IProp  target)

Runs a "Use Prop" sequence.

◆ HandleLookAt() [2/4]

Coroutine HandleLookAt ( IProp  target)

Runs a "Look at Prop" sequence.

◆ HandleInventory() [2/4]

Coroutine HandleInventory ( IProp  target,
IInventory  item 
)

Runs a "Use inventory on Prop" sequence.

◆ HandleInteract() [3/4]

Coroutine HandleInteract ( ICharacter  target)

Runs a "Use Character" sequence.

◆ HandleLookAt() [3/4]

Coroutine HandleLookAt ( ICharacter  target)

Runs a "Look at Character" sequence.

◆ HandleInventory() [3/4]

Coroutine HandleInventory ( ICharacter  target,
IInventory  item 
)

Runs a "Use inventory on Character" sequence.

◆ HandleInteract() [4/4]

Coroutine HandleInteract ( IInventory  target)

Runs a "Use Inventory" sequence.

◆ HandleLookAt() [4/4]

Coroutine HandleLookAt ( IInventory  target)

Runs a "Look at Inventory" sequence.

◆ HandleInventory() [4/4]

Coroutine HandleInventory ( IInventory  target,
IInventory  item 
)

Runs a "Use inventory on Inventory" sequence.

◆ DisableCancel()

void DisableCancel ( )

Stops sequence from being cancelled when user clicks something else while walking there. Place either at start of script to prevent first WalkTo being cancelable.

◆ FirstOccurance()

bool FirstOccurance ( string  uniqueString)

Registers something "occuring", and returns whether it's the first time it's occurred.

Usage: if ( FirstOccurance("unlockdoor") ) C.Display("You unlock the door"); else C.Display("It's already unlocked");

See also
Occurrance
GetOccuranceCount

◆ Occurrance()

int Occurrance ( string  uniqueString)

Registers something "occuring", and returns the number of time's it's occurred. Returns 0 the first time, then 1, etc.

Usage: if ( Occurance("knocked on door") < 3 ) C.Display("You knock on the door");

See also
FirstOccurance
GetOccuranceCount

◆ GetOccuranceCount()

int GetOccuranceCount ( string  uniqueString)

Checks how many times something has occurred, without incrementing the occurance.

Usage: if ( GetOccuranceCount("knocked on door") == 3 ) C.Doorman("Who's there?");

See also
FirstOccurance
Occurrance

◆ Restart()

void Restart ( )

Restart the game from the first scene.

◆ DisableAllClickablesExcept()

void DisableAllClickablesExcept ( params string []  exceptions)

Helper function that temporarily disables all clickables, except those specified. Useful when you want to set only certain props clickable for a short time. Eg: E.DisableAllClickablesExcept("Ropes","BrokenGlass");

◆ RestoreAllClickables()

void RestoreAllClickables ( )

Helper function that restores clickables disabled with the DisableAllClickablesExcept function.

◆ SetAllClickableCursors()

void SetAllClickableCursors ( string  cursor,
params string []  exceptions 
)

Set all clickables to have a specific cursor temporarily, restore using RestoreAllClickableCursors(). Eg: E.SetAllClickableCursors("None", "Ropes","BrokenGlass");

◆ RestoreAllClickableCursors()

void RestoreAllClickableCursors ( )

Resets all clickable cursors after a call to "SetAllClickableCursors".

◆ GetSaveSlotData() [1/2]

List<QuestSaveSlotData> GetSaveSlotData ( )

Returns a list of all save slot data.

◆ GetSaveSlotData() [2/2]

QuestSaveSlotData GetSaveSlotData ( int  slot)

Returns save slot data for a particular save game. The data has info about the name, etc of the save file.

◆ Save()

bool Save ( int  slot,
string  description 
)

Saves the game to a particular slot with a particular description.

◆ RestoreSave()

bool RestoreSave ( int  slot)

Restores the game from a particular slot.

◆ DeleteSave()

bool DeleteSave ( int  slot)

Deletes a save game from a particular slot.

◆ AddSaveData()

void AddSaveData ( string  name,
object  data,
System.Action  OnPostRestore = null 
)

Advanced save/restore function: For saving data not in a QuestScript...

To use, call AddSaveData in Start, passing in a name for what you want to save, and the object containing the data you want to save.

If you want to do things when the game is restored, pass the function you want ot be called as OnPostRestore

Notes:

  • The object to be saved must be a class containing the data to be saved (can't just pass in a value type like an int, float or Vector2).
  • By default all data in a class is saved, except for:
    • GameObjects, and MonoBehaviours
    • Variables with the [QuestDontSave] attribute (NOTE: THIS IS NOT YET IMPLEMENTED, BUG DAVE IF NEEDED!)
    • If you store references to other things that shouldnt be saved in your scripts, that may cause problems. Best thing is to dave know, he can add a feature tohelp with that
  • you can add the [QuestSave] attribute to the class
    • When you do that, ONLY the variables that also have the [QuestSave] attribute are saved.
    • You can put this tag on a Monobehaviour class, when you just want to save a few of its variables without having to put them in their own seperate class

Examples saving a simple data class:

class MyComponent : Monobehaviour
{
// Class to store the save data in
class SaveData
{
public int myInt;
public float myFloat;
[QuestDontSave] public bool myNotSavedBool;
}
SaveData m_saveData;
void Start()
{
PowerQuest.Get.AddSaveData( "myData", m_saveData );
}
void OnDestroy()
{
Powerquest.Get.RemoveSaveData("myData");
}
}

Example using the [QuestSave] attribute:

[QuestSave]
class MyComponent : Monobehaviour
{
[QuestSave] int myInt;
[QuestSave] float myFloat;
bool myNotSavedBool;
SaveData m_saveData;
void Start()
{
PowerQuest.Get.AddSaveData( "myData", this );
}
void OnDestroy()
{
Powerquest.Get.RemoveSaveData("myData");
}
}

◆ RemoveSaveData()

void RemoveSaveData ( string  name)

Advanced save/restore function: For aving data not in a QuestScript. Call this when you've called AddSaveData, but no longer want to save that data.

◆ GetScript< T >()

T GetScript< T > ( )

PowerQuest internal function: Retrieve a quest script by it's type. So you can access your functions/variables in your own scripts. Eg: E.GetScript<RoomKitchen>().m_tapsOn = true;.

Type Constraints
T :QuestScript