Es

From EventScripts Community Encyclopedia


Module: es

Module Overview

EventScripts version: 2.0

Table of Contents

Contents


Description

This the core EventScripts module. Very, very heavily used as it provides direct access to the game. It is intended as the sole gateway to the Source engine from Python scripts.

Quick Example

import es
 
def player_say(event_var):
    es.msg("Hello world!")

Module Content

Classes

Methods

IMPORTANT NOTE: The parameters for es functions are very similar to their original counterpart in the classic EventScripts. Typically the only difference is that no server variables are required for return values. See the Classic ES wiki command list to fill in gaps of documentation below.


es.ForceServerCommand(...)

Inserts a command to the server queue at the beginning and forces execution.

es.InsertServerCommand(...)

Inserts a command to the server queue at the beginning.

es.ServerCommand(...)

Adds a command to the end of the server queue.

es.botsetvalue(...)

Sets a convar value for a fake client.

es.centermsg(...)

Broadcasts a centered HUD message to all players.

es.centertell(...)

Sends a centered HUD message to all players.

es.cexec(...)

Forces a userid to execute a command in their console.

es.cexec_all(...)

Forces all users to execute a command in their console.

es.changeteam(...)

Changes the team of a player.

es.commandv(...)

Just runs a command-string inside of the variable.

es.copy(...)

Reads the server variable referenced by varname2 and copies it into the variable referenced by varname.

es.createbot(...)

Adds a bot to the server.

es.createentitylist(...)

Creates a keygroup for an entity class or for all entities.

es.createplayerlist(...)

Creates a new keygroup containing the current list of players.

es.createscriptlist(...)

Creates a new keygroup containing the current list of players.

es.createvectorfrompoints(...)

Creates a vector-string that goes from point/vector A to point/vector B.

es.createvectorstring(...)

Creates a string form of three x y z variables representing a vector.

es.dbgmsg(...)

Prints a debug message for EventScripts

es.dbgmsgv(...)

Prints a debug message for EventScripts

es.delayed(...)

Will run <commandstring>, after <seconds> seconds.

es.disable(...)

Disables a script that has been loaded.

es.doblock(...)

Executes a block.

es.dumpstringtable(...)

Update an entry in a stringtable

es.effect(...)

Performs a particular effect.

es.emitsound(...)

Plays a sound from an entity.

es.enable(...)

Enables a script that has been loaded.

es.entcreate(...)

Creates an entity where a player is looking.

es.entsetname(...)

Names the entity the player is looking at. (DOES NOT SET PLAYER NAME)

es.escinputbox(...)

Sends an ESC input box to a player.

es.escmenu(...)

Sends an ESC menu to a player.

es.esctextbox(...)

Sends an ESC textbox to a player.

es.event(...)

Create and fire events to signal to plugins that an event has happened. It must be an event loaded via es_loadevents.

es.exists(...)

Checks whether a keygroup, keys, variable, or function exists.
es.fadevolume(...)
Fades the volume for a client.
es.fire(...)
Fires an entity trigger.
es.flags(...)
Adds or removes the cheat flag from a command or variable. (EXPERIMENTAL/UNSUPPORTED)
es.forcevalue(...)
Forces a variable to a particular value
es.foreachkey(...)
EXPERIMENTAL. Loops through a keygroup and performs a single command on each key, providing a single variable with the key name.
es.foreachval(...)
EXPERIMENTAL. Loops through a keygroup and performs a single command on each key, providing a single variable with the key name.
es.format(...)
Allows you to format a string by filling in a list of strings into a format string.
es.formatqv(...)
Allows you to format a string by filling in a list of strings into a format string.
es.formatv(...)
Allows you to format a string by filling in a list of variable's strings into a format string.
es.getAddonPath(addon)

es.getEventInfo(...)

Gets the value of a particular event variable.

es.getFloat(...)

Gets the float value for a server variable

es.getInt(...)

Gets the integer value for a server variable

es.getString(...)

Gets the string value for a server variable

es.getUseridList(...)

Returns a list of the userids of all players on the server.
es.getargc(...)
Gets the count of parameters passed to the current ES console command.
es.getargs(...)
Gets the commandstring passed to the current ES console command.
es.getargv(...)
Gets the command parameter passed to the current ES console command.
es.getclientvar(...)
Reads a console variable from a given player.
es.getcmduserid(...)
Gets the commandstring passed to the current Valve console command.
es.getentityindex(...)
Gets the index for the first named entity found by that name. Returns -1 if not found.
es.getgame(...)
Returns the name of the Source game being played.
es.getgravityvector(...)
Returns the gravity vector.
es.getindexprop(...)
Gets a server class property for a particular entity index
es.getlivingplayercount(...)
Stores the count of living players on the server into a variable. Optionally a team can be specified. Returns -1 on error.
es.getmoney(...)
Stores the player's money value in a variable. (CS:S only)
es.getplayercount(...)
Stores the count of players on the server into a variable. Optionally a team can be specified. Returns -1 on error.
es.getplayerhandle(...)
Gets the handle for a player class property using an entity handle (Untested)
es.getplayerlocation(...)
Stores the player's current x, y, and z location (in 3 different variables).
es.getplayermovement(...)
Stores the player's current forward movement value, side movement value, and upward movement value (in 3 different variables).
es.getplayername(...)
Stores the player's name in the variable.
es.getplayerprop(...)
Gets a server class property for a particular player
es.getplayersteamid(...)
Stores the player's STEAMID in the variable.
es.getplayerteam(...)
Stores the player's team # in the variable.
es.gettime(...)
Stores the server time in a variable.
es.gettimestamp(...)
Stores a timestamp in seconds in a variable. gettimestamp provides a shorter timestamp only for comparing against other es_gettimestamp values.
es.gettimestring(...)
Stores the server time string in a variable.
es.getuserid(...)
Looks-up a userid based on the string provided. Checks it against a userid, steamid, exact name, and partial name. (Based on Mani's algorithm.)
es.give(...)
Gives the player a named item.

es.import_addon(name)

Returns the module for the addon you specified (if it's loaded)
es.isbot(...)
Checks a userid to see if it's a bot, stores 1 in the variable if so, 0 if not.
es.keycreate(...)
Creates a key that can be free-floating or associated with a group. Must call es_keydelete to free this memory when you're done.
es.keydelete(...)
Deletes a key from memory so that it's not leaked when you're done with it.
es.keygetvalue(...)
Gets a value within a given key (where the key could be free-floating or associated with a group).
es.keygroupcopy(...)
Copies a keygroup.
es.keygroupcreate(...)
Creates a keygroup that can be loaded and saved to a file. Must call es_keygroupdelete to free this memory!
es.keygroupdelete(...)
Deletes a keygroup from memory so that it's not leaked.
es.keygroupfilter(...)
Deletes keys from a keygroup that match or don't match a certain value.
es.keygroupgetpointer(...)
Returns the C++ pointer to a keygroup.
es.keygroupload(...)
Loads a keygroup from file based on its name.
es.keygroupmsg(...)
Sends a keygroup-based message to a player.
es.keygrouprename(...)
Renames an existing keygroup.
es.keygroupsave(...)
Saves a keygroup to a file based on its name.
es.keylist(...)
Lists all key values in memory that aren't groups. Optionally can look up a group, if you provide one.
es.keypcreate(...)
Returns the C++ pointer to a new keyvalues object.
es.keypcreatesubkey(...)
Creates a subkey as an integer.
es.keypdelete(...)
Deletes a key by pointer (not recommended)
es.keypdetachsubkey(...)
Detaches a subkey by pointer.
es.keypfindsubkey(...)
Finds or creates a subkey by a particular name.
es.keypgetdatatype(...)
Returns the data type id of the value in the key.
es.keypgetfirstsubkey(...)
Retrieves the first subkey underneath this pointer
es.keypgetfirsttruesubkey(...)
Retrieves the first true subkey for this pointer.
es.keypgetfirstvaluekey(...)
Retrieves the first value in this pointer.
es.keypgetfloat(...)
Retrieves the float value in this pointer by name.
es.keypgetint(...)
Retrieves the int value in this pointer by name.
es.keypgetname(...)
Gets a key name by pointer
es.keypgetnextkey(...)
Retrieves the next key (peer) to this pointer.
es.keypgetnexttruesubkey(...)
Retrieves the next true subkey to this pointer (ignores 'values')
es.keypgetnextvaluekey(...)
Retrieves the next value in this pointer.
es.keypgetstring(...)
Retrieves the string value in this pointer by name.
es.keypisempty(...)
Check if the keyvalue pointer is empty.
es.keyploadfromfile(...)
Saves the keyvalue pointer to filepath with all subkeys and values
es.keyprecursivekeycopy(...)
Recursively copies a key into another key
es.keypsavetofile(...)
Saves the keyvalue pointer to filepath with all subkeys and values
es.keypsetfloat(...)
Sets the float value in this pointer by name.
es.keypsetint(...)
Sets the int value in this pointer by name.
es.keypsetname(...)
Sets a key name by pointer
es.keypsetstring(...)
Sets the string value in this pointer by name.
es.keyrename(...)
Rename a key.
es.keysetvalue(...)
Sets a value within a given key (where the key could be free-floating or associated with a group).
es.lightstyle(...)
Set light style.
es.load(...)
Loads a script or lists all loaded scripts if no script is provided.
es.loadevents(...)
Reads an event file and registers EventScripts as a handler for those events.
es.local_language()
Returns the server's local language abbreviation
es.log(...)
Logs a message to the server log.
es.logv(...)
Logs the text inside of a variable.
es.makepublic(...)
Makes a console variable public such that changes to it are announced to clients.
es.mathparse(...)
Adds a say command that refers to a particular block.
es.menu(...)
Sends an AMX-Style menu to the users
es.mexec(...)
Runs an exec file from memory.
es.msg(...)
Broadcasts a message to all players. Will not expand any EventScripts variables. If the first word of the message is 'GREEN', or 'LIGHTGREEN' then the message is displayed in that color.

es.physics(...)

Interface to the Source physics engine

es.playsound(...)

Plays a sound to a player.
es.precachedecal(...)
Precache a decal and return its index.
es.precachemodel(...)
Precache a model and return its index.
es.precachesound(...)
Precache sound.
es.prop_dynamic_create(...)
See prop_dynamic_create for syntax, but requires a userid first
es.prop_physics_create(...)
See prop_physics_create for syntax, but requires a userid first.
es.queryclientvar(...)
Sends a request to query a client's console variable.
es.regclientcmd(...)
Adds a client command that refers to a particular block.
es.regcmd(...)
Adds a console command that refers to a particular block.
es.regex(...)
Various regular expression commands.
es.regsaycmd(...)
Adds a say command that refers to a particular block.
es.reload(...)
Reloads a script that is loaded.
es.remove(...)
Removes an entity class
es.scriptpacklist(...)
Lists the script packs running on the server. If a userid is provided, will es_tell the list to the user.
es.sendkeypmsg(...)
Sends a client message based on a KeyValues pointer. sendkeypmsg(userid,type,keyid)
es.set(...)
Adds/sets a new server/global variable.

es.setFloat(...)

Sets the server variable to the given float value. Creating it if necessary.

es.setInt(...)

Sets the server variable to the given integer value. Creating it if necessary.

es.setString(...)

Sets the server variable to the given string value. Creating it if necessary.

es.setang(...)

Sets player view angle.
es.setindexprop(...)
Sets a server class property for the given entity index
es.setinfo(...)
Adds a new server/global variable.
es.setplayerprop(...)
Sets a server class property for the given player
es.setpos(...)
Teleports a player.
es.setview(...)
Adds a console command that refers to a particular block.
es.sexec(...)
Forces a userid to execute a command on the server console (bypassing client console).
es.sexec_all(...)
Forces all users to execute a command on the server console.
es.soon(...)
Adds a command to the end of the command queue.
es.splitvectorstring(...)
Stores the vector's current x, y, and z as read from the vector in string form.
es.sql(...)
Local database support
es.stopsound(...)
Stops a specific sound for a player.
es.strcmp(...)
Compares two strings.
es.stringtable(...)
Update an entry in a stringtable
es.strlen(...)
Returns the length of a string.
es.tell(...)
Sends HUD message to one player. If the first word of the message is '#green', or '#lightgreen' then the message is displayed in that color.
es.toptext(...)
Sends HUD message to one player.
es.trick(...)
Miscellaneous tricky things.
es.unload(...)
Unloads a script that has been loaded.

es.unregclientcmd(...)

Removes a client command that refers to a particular block.
es.unregsaycmd(...)
Removes a say command that refers to a particular block.
es.usermsg(...)
Create and send a usermsg to a client.

es.voicechat(...)

Allows you to control listening players.

See Also

Coming Soon

blog comments powered by Disqus