Difference between revisions of "Character Script External Code"

From Wolfire Games Wiki
Jump to: navigation, search
(Created page with "This is an alphabetical list of all the external code that is available to be used inside a character script - functions, variables, and classes that seem to "magically" exist. ...")
 
m
Line 6: Line 6:
  
 
'''TODO''': These functions can be documented individually, and can be presented in a grouped list as well
 
'''TODO''': These functions can be documented individually, and can be presented in a grouped list as well
 +
 
'''TODO''': De-dupe this with level scripts, hotspot scripts. Move "generic" functions to a shared script functions page
 
'''TODO''': De-dupe this with level scripts, hotspot scripts. Move "generic" functions to a shared script functions page
  

Revision as of 10:37, 4 November 2017

This is an alphabetical list of all the external code that is available to be used inside a character script - functions, variables, and classes that seem to "magically" exist.

This is pulled from the ~/Documents/Wolfire/Overgrowth/aschar_docs.h file, which is automatically generated by the game.

See this page to find the location for the Wolfire/Overgrowth folder on each OS - http://wiki.wolfire.com/index.php/How_to_clear_the_game's_cache

TODO: These functions can be documented individually, and can be presented in a grouped list as well

TODO: De-dupe this with level scripts, hotspot scripts. Move "generic" functions to a shared script functions page

Global Variables

Camera camera;
CharacterScriptGetter character_getter;
ASCollisions col; // Used to access collision functions
ASContext context;
float last_controller_event_time;  // The time the last game controller input event occurred
float last_keyboard_event_time;  // The time the last keyboard input event occurred
float last_mouse_event_time;  // The time the last mouse input event occurred
Level level;
ScriptParams params;
Physics physics;
ReactionScriptGetter reaction_getter;
SphereCollision sphere_col; // Stores results of collision functions
float the_time; // The current time in seconds since engine started (in-game time)
MovementObject this_mo;
float time_step; // Time in seconds between engine time steps
float ui_time; // The current time in seconds since engine started (absolute time)
uint UINT32MAX;

Constants

enum AnimationFlags : uint8;
enum AttachmentType;
enum AttackerDirectionType : int;
enum AttackerHeightType : int;
enum CameraFlags;
enum CollisionSides;
enum DebugDrawLifespanType : int;
enum EngineState;
enum EntityType;
enum ItemType : int;
enum JsonValueType;
enum KeyboardInputModeFlag;
enum KnockedOutType : int;
enum LogType;
enum MessageType : int;
enum NavPathFlag;
enum SDLNumeric;
enum SamplePolyFlag;
enum SoundGroupPriorityType : int;
enum TextAtlasFlags;
enum UserVote;

Global Functions

float abs(float);
float acos(float);
float asin(float);
void assert(bool val);
float atan(float);
float atan2(float, float);
float atof(const string &in str);
int atoi(const string &in str);
float ceil(float);
float cos(float);
vec3 cross(const vec3 &in, const vec3 &in);
float distance(const vec2 &in, const vec2 &in);
float distance(const vec3 &in, const vec3 &in);
float distance_squared(const vec2 &in, const vec2 &in);
float distance_squared(const vec3 &in, const vec3 &in);
float dot(const vec2 &in, const vec2 &in);
float dot(const vec3 &in, const vec3 &in);
float floor(float);
double fpFromIEEE(uint64);
float fpFromIEEE(uint);
uint fpToIEEE(float);
uint64 fpToIEEE(double);
BoneTransform invert(const BoneTransform &in);
mat4 invert(mat4);
quaternion invert(quaternion quat);
float length(const vec2 &in);
float length(const vec3 &in);
float length_squared(const vec2 &in);
float length_squared(const vec3 &in);
float log(float);
float log10(float);
float max(float, float);
int max(int, int);
float min(float, float);
int min(int, int);
float mix(float a, float b, float amount);
BoneTransform mix(const BoneTransform &in a, const BoneTransform &in b, float alpha);
mat4 mix(const mat4 &in a, const mat4 &in b, float alpha);
quaternion mix(const quaternion &in a, const quaternion &in b, float alpha);
vec2 mix(vec2 a, vec2 b, float alpha);
vec3 mix(vec3 a, vec3 b, float alpha);
vec4 mix(vec4 a, vec4 b, float alpha);
vec2 normalize(const vec2 &in);
vec3 normalize(const vec3 &in);
float pow(float val, float exponent);
int rand();
vec2 reflect(const vec2 &in vec, const vec2 &in normal);
vec3 reflect(const vec3 &in vec, const vec3 &in normal);
float sin(float);
float sqrt(float);
float tan(float);
mat4 transpose(mat4);
float xz_distance(const vec3 &in, const vec3 &in);
float xz_distance_squared(const vec3 &in, const vec3 &in);
void ActivateKeyboardEvents();
void AddDebugDrawRibbonPoint(int which, vec3 pos, vec4 color, float width);
bool AddMusic(const string &in);
void Breakpoint(int);
bool CheckSaveLevelChanges();
void ClearTemporaryDecals();  // Like blood splats and footprints
void ClearUndoHistory();
void ConnectParticles(uint32 id_a, uint32 id_b);  // Used for ribbon particles, like throat-cut blood
void CreateCustomHull(const string &in key, const array<vec3> &vertices);
int CreateObject(const string &in path);
int CreateObject(const string &in path, bool exclude_from_save);
void DeactivateAllMods();
void DeactivateKeyboardEvents();
int DebugDrawBillboard(const string &in path, vec3 center, float scale, vec4 color, int lifespan);
int DebugDrawCircle(mat4 transform, vec4 color, int lifespan);
int DebugDrawLine(vec3 start, vec3 end, vec3 color, int lifespan);
int DebugDrawLine(vec3 start, vec3 end, vec3 start_color, vec3 end_color, int lifespan);
int DebugDrawLine(vec3 start, vec3 end, vec4 start_color, vec4 end_color, int lifespan);
int DebugDrawLines(const array<vec3> &vertices, vec4 color, int lifespan);
int DebugDrawPoint(vec3 pos, vec4 color, int lifespan);
void DebugDrawRemove(int id);
int DebugDrawRibbon(int lifespan);
int DebugDrawRibbon(vec3 start, vec3 end, vec4 start_color, vec4 end_color, float start_width, float end_width, int lifespan);
int DebugDrawText(vec3 pos, string text, float scale, bool screen_space, int lifespan);
int DebugDrawWireBox(vec3 pos, vec3 dimensions, vec3 color, int lifespan);
int DebugDrawWireCylinder(vec3 pos, float radius, float height, vec3 color, int lifespan);
int DebugDrawWireMesh(string path, mat4 transform, vec4 color, int lifespan);
int DebugDrawWireScaledSphere(vec3 pos, float radius, vec3 scale, vec3 color, int lifespan);
int DebugDrawWireScaledSphere(vec3 pos, float radius, vec3 scale, vec4 color, int lifespan);
int DebugDrawWireSphere(vec3 pos, float radius, vec3 color, int lifespan);
bool DebugKeysEnabled();
int DebugSetPosition(int id, vec3 pos);
void DebugText(string key, string display_text, float lifetime);
void DeleteObjectID(int);
void DeselectAll();
void DisplayError(const string &in title, const string &in contents);
void DisposeTextAtlases();
bool DoesItemFitInItem(int item_id, int holster_item_id);
void DrawTextAtlas(const string &in path, int pixel_height, int flags, const string &in txt, int x, int y, vec4 color);
void DrawTextAtlas2(const string &in path, int pixel_height, int flags, const string &in txt, int x, int y, vec4 color, uint char_limit);
int DuplicateObject(Object@ obj);
bool EditorEnabled();
bool EditorModeActive();
void EnterTelemetryZone(const string &in name);
bool FileExists(string &in);
int FindFirstCharacterInGroup(int id);
string FloatString(float val, int digits);
array<ModID>@ GetActiveModSids();
float GetAnimationEventTime( string &in anim_path, string &in event_label );
array<string>@ GetAvailableBindingCategories();
array<string>@ GetAvailableBindings(const string &in);
vec3 GetBaseSkyTint();
string GetBindingValue(string binding_category, string binding);
int GetBloodLevel();
const vec3 &GetBloodTint();
string GetBuildTimestamp( );
string GetBuildVersionFull( );
string GetBuildVersionShort( );
Campaign GetCampaign(string& campaign_id);
array<Campaign>@ GetCampaigns();
void GetCharacters(array<int>@ id_array);
void GetCharactersInHull(string model_path, mat4, array<int>@ id_array);
void GetCharactersInSphere(vec3 position, float radius, array<int>@ id_array);
int GetCodeForKey(string key_name);
uint GetCodepointCount( const string &in );
bool GetConfigValueBool(string index);
float GetConfigValueFloat(string index);
int GetConfigValueInt(string key);
array<string>@ GetConfigValueOptions(string index);
string GetConfigValueString(string index);
string GetCurrCampaignID();
string GetCurrLevel();
string GetCurrLevelAbsPath();
string GetCurrLevelID();
string GetCurrLevelName();
string GetCurrLevelRelPath();
string GetCurrentLevelModsourceID();
string GetCurrentMenuModsourceID();
int GetFontFaceID(const string &in path, int pixel_height);
float GetFriction(const vec3 &in position);
float GetHDRBlackPoint(void);
float GetHDRBloomMult(void);
float GetHDRWhitePoint(void);
bool GetInputDown(int controller_id, const string &in input_label);
bool GetInputDownFiltered(int controller_id, const string &in input_label, uint filter);
uint GetInputMode();
bool GetInputPressed(int controller_id, const string &in input_label);
bool GetInputPressedFiltered(int controller_id, const string &in input_label, uint filter);
string GetInterlevelData(const string &in);
float GetLayerGain(const string &in layer);
array<string>@ GetLayerNames();
uint GetLengthInBytesForNCodepoints( const string &in, uint codepoint_index );
string GetLevelName(const string& path);
string GetLocaleStringForScancode(int scancode);
float GetLookXAxis(int controller_id);
float GetLookYAxis(int controller_id);
bool GetMenuPaused();  // Is game paused by a menu
array<ModID>@ GetModSids();
float GetMoveXAxis(int controller_id);
float GetMoveYAxis(int controller_id);
NavPoint GetNavPoint(vec3);
vec3 GetNavPointPos(vec3);
int GetNumCharacters();
int GetNumHotspots();
int GetNumItems();
array<int> @GetObjectIDs();
array<int> @GetObjectIDsType(int type);
void GetObjectsInHull(string model_path, mat4, array<int>@ id_array);
NavPath GetPath(vec3 start, vec3 end);
NavPath GetPath(vec3 start, vec3 end, uint16 include_poly_flags, uint16 exclude_poly_flags);
uint64 GetPerformanceCounter();  // Get high precision time info for profiling
uint64 GetPerformanceFrequency();  // Used to convert PerformanceCounter into seconds
array<vec2>@ GetPossibleResolutions();
array<KeyboardPress>@ GetRawKeyboardInputs();
void GetRotationBetweenVectors(const vec3 &in start, const vec3 &in end, quaternion &out rotation);
int GetScreenHeight();
int GetScreenWidth();
string GetSegment();
vec3 GetSkyTint();
string GetSong();
bool GetSplitscreen();
string GetStringDescriptionForBinding( const string &in, const string &in );
float GetSunAmbient();
vec3 GetSunColor();
vec3 GetSunPosition();
TextMetrics GetTextAtlasMetrics(const string &in path, int pixel_height, int flags, const string &in txt );
TextMetrics GetTextAtlasMetrics2(const string &in path, int pixel_height, int flags, const string &in txt, uint char_limit );
bool IsGroupDerived(int id);
bool IsKeyDown(int key_code);
bool IsWorkshopAvailable();
bool IsWorkshopMod(ModID& id);
bool IsWorkshopSubscribed(ModID& id);
void LeaveTelemetryZone();
vec3 LineLineIntersect(vec3 start_a, vec3 end_a, vec3 start_b, vec3 end_b);  // Get closest point between two line segments
void LoadEditorLevel();
void LoadLevel(string level_path);
void LoadLevelID(string id);
void Log( LogType level, const string &in str );
uint32 MakeParticle(string path, vec3 pos, vec3 vel);
uint32 MakeParticle(string path, vec3 pos, vec3 vel, vec3 color);
mat3 Mat3FromQuaternion(const quaternion &in);
mat4 Mat4FromQuaternion(const quaternion &in);
bool MediaMode();
bool ModActivation(ModID& sid, bool active);
bool ModCanActivate(ModID& id);
string ModGetAuthor(ModID& id);
array<ModLevel>@ ModGetCampaignLevels(ModID& sid);
string ModGetDescription(ModID& id);
string ModGetID(ModID& id);
array<MenuItem>@ ModGetMenuItems(ModID& sid);
string ModGetName(ModID& id);
string ModGetPath(ModID& sid);
array<ModLevel>@ ModGetSingleLevels(ModID& sid);
int ModGetSource(ModID& id);
string ModGetTags(ModID& id);
string ModGetThumbnail(ModID& sid);
UserVote ModGetUserVote(ModID& sid);
string ModGetValidityString(ModID& sid);
string ModGetVersion(ModID& id);
bool ModIsActive(ModID& id);
bool ModIsCore(ModID& id);
bool ModIsFavorite(ModID& id);
bool ModIsValid(ModID& id);
bool ModNeedsRestart(ModID& id);
bool MovementObjectExists(int id);
vec3 Mult(quaternion, vec3);  // Applies a quaternion rotation to a vector
vec3 NavRaycast(vec3 start, vec3 end);
vec3 NavRaycastSlide(vec3 start, vec3 end, int depth);
bool ObjectExists();
bool ObjectExists(int id);
void OpenModAuthorWorkshopPage(ModID& id);
void OpenModWorkshopPage(ModID& id);
void OpenWorkshop();
void PlaySegment(const string &in);
void PlaySong(const string &in);
int PlaySound(string path);
int PlaySound(string path, vec3 position);
int PlaySoundGroup(string path);
int PlaySoundGroup(string path, float gain);
int PlaySoundGroup(string path, vec3 position);
int PlaySoundGroup(string path, vec3 position, float gain);
int PlaySoundGroup(string path, vec3 position, int priority);
int PlaySoundLoop(const string &in path, float gain);
int PlaySoundLoopAtLocation(const string &in path, vec3 pos, float gain);
void PrintCallstack();
quaternion QuaternionFromMat4(const mat4 &in);
void QueueDeleteObjectID(int);
void QueueSegment(const string &in);
float RangedRandomFloat(float min, float max);
MovementObject@ ReadCharacter(int index);  // e.g. first character in scene
MovementObject@ ReadCharacterID(int id);  // e.g. character with object ID 39
EnvObject@ ReadEnvObjectID(int id);
Hotspot@ ReadHotspot(int index);
ItemObject@ ReadItem(int index);
ItemObject@ ReadItemID(int id);
Object@ ReadObjectFromID(int);
void ReloadMods();
void ReloadStaticValues();
bool RemoveMusic(const string &in);
void RequestModSetFavorite(ModID& id, bool fav);
void RequestModSetUserVote(ModID& id, bool voteup);
void RequestWorkshopSubscribe(ModID& id);
void RequestWorkshopUnSubscribe(ModID& id);
void ResetBinding(string binding_category, string binding);
void ResetLevel();
void RibbonItemFlash(const string &in);
void RibbonItemSetEnabled(const string &in, bool);
void RibbonItemSetToggled(const string &in, bool);
string SaveConfig();
void SendGlobalMessage(string msg);
void SendMessage(int target, int type, vec3 vec_a, vec3 vec_b);
void SendMessage(int type, string msg);
void SetAirWhoosh(float volume, float pitch);
void SetBindingValue(string binding_category, string binding, string value);
void SetCampaignID(string id);
void SetConfigValueBool(string key, bool value);
void SetConfigValueFloat(string key, float value);
void SetConfigValueInt(string key, int value);
void SetConfigValueString(string key, string value);
void SetFlareDiffuse(float);
void SetGrabMouse(bool);
void SetHDRBlackPoint(float);
void SetHDRBloomMult(float);
void SetHDRWhitePoint(float);
void SetInterlevelData(const string &in, const string &in);
void SetKeyboardBindingValue(string binding_category, string binding, uint32 scancode);
void SetLayerGain(const string &in layer, float gain);
void SetMediaMode(bool);
void SetPaused(bool paused);
void SetSegment(const string &in);
void SetSkyTint(vec3);
void SetSong(const string &in);
void SetSoundGain(int handle, float gain);
void SetSoundPitch(int handle, float pitch);
void SetSoundPosition(int handle, vec3 pos);
void SetSunAmbient(float);
void SetSunColor(vec3);
void SetSunPosition(vec3);
void StartStopwatch();
void StartTextInput();
uint64 StopAndReportStopwatch();
void StopSound(int handle);
void StopTextInput();
int StorageGetInt32(string index);
string StorageGetString(string index);
bool StorageHasInt32(string index);
bool StorageHasString(string index);
void StorageSetInt32(string index, int value);
void StorageSetString(string index, string value);
void TimedSlowMotion(float target_time_scale, float how_long, float delay);  // Used to trigger brief periods of slow motion
void TintParticle(uint32 id, const vec3 &in color);
string ToUpper(string &in);
void UpdateListener(vec3 pos, vec3 vel, vec3 facing, vec3 up);
uint WorkshopDownloadPendingCount();
uint WorkshopDownloadingCount();
uint WorkshopNeedsUpdateCount();
uint WorkshopSubscribedNotInstalledCount();
float WorkshopTotalDownloadProgress();

Classes

class array<T>;
class mat3;
class mat4;
class quaternion;
class vec2;
class vec3;
class vec4;
class ASCollisions;
class ASContext;
class AnimationClient;
class AttackScriptGetter;
class BoneTransform;
class Camera;
class Campaign;
class CharacterScriptGetter;
class CollisionPoint;
class EnvObject;
class Hotspot;
class ItemObject;
class JSON;
class JSONValue;
class KeyboardPress;
class Level;
class LevelDetails;
class MenuItem;
class ModID;
class ModLevel;
class MovementObject;
class NavPath;
class NavPoint;
class Object;
class PathPointObject;
class Physics;
class ReactionScriptGetter;
class RiggedObject;
class ScriptParams;
class Skeleton;
class SphereCollision;
class TextCanvasTexture;
class TextMetrics;
class TextStyle;
class TokenIterator;