Raised This Month: $51 Target: $400
 12% 

EventScripts Plugin Information and News


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Mattie
Veteran Member
Join Date: Jan 2005
Old 05-22-2005 , 16:16   EventScripts v0.7.7 beta has released!
#11

This is the Please-the-Advanced-Script-Writers release. I put a number of things in here that I've tried to argue around for ages. I'm at the point now where I think these will help things more than they'd hurt. Hopefully you'll be pleasantly surprised.

Changed in this version:
  • 1. Added es_getmoney command for looking-up a players cash level. Also added eventscripts_cflags to help out once Valve breaks this function (just a matter of time).
    2. Support for nested server_var and event_var syntax. E.g. This syntax should now work: server_var(server_var(event_var(userid))).
    3. if and es_xif have been updated to support the lessthan and greaterthan operators. (I.e. goodbye IsGreaterThan.cfg)
    4. Added es_attackersteamid extended event variable.
    5. Fixed crashes caused by "exec player_say.cfg". This is inappropriate usage, but it certainly shouldn't crash the server. As such, I fixed it such that an event_var() reference outside of an event doesn't crash (but is still undefined in behavior).

Here's the sections of documentation that were updated:
Quote:
Nested Variable Expansion
In EventScripts v0.7.7, support was added such that a nested variable syntax could be used. This allows you to look-up server and event variables indirectly. For example, you could write the following code in a cfg file:
Code:
// EventScripts v0.7.7 
setinfo varname sv_gravity
es_msg The gravity is currently server_var(server_var(varname))
The es_msg line would first look-up the variable "varname" and see that it's "sv_gravity". It would then look-up what is stored in the variable named "sv_gravity" and place that in the text of the command. So the output would be:
Quote:
The gravity is currently 800
The above is an unlikely example. Script writers, though, commonly need to build custom variable names. For example, here's a player_death.cfg that assume variables have been created called "playerteamkills_x" for each player:
Code:
// EventScripts v0.7.7
setinfo varname 0
es_format varname "%1_%2" "playerteamkills" event_var(userid)
es_tell event_var(userid) You have killed server_var(server_var(varname)) team members. Shame on you!
This code uses es_format to build a custom variable name and uses the "server_var(server_var(" syntax to look-up the value indirectly.

...


Conditional Expressions
Last but not least, I added support for if/then statements-- conditional expressions. Here's the syntax:
  • if (token1 equalto token2) then commandstring
    In addition to "equalto", it also supports "notequalto", "lessthan", and "greaterthan". token1 and token2 above must each be a single word, quoted string, or number. EventScripts will expand any variables it finds. (Equivalent to calling "es es_xif".)
    es_xif (token1 equalto token2) then commandstring
    In addition to "equalto", it also supports "notequalto", "lessthan", and "greaterthan". token1 and token2 above must each be a single word, quoted string, or number. No variables are expanded as it is assumed everything is already perfect.
So, if we bundle all of this together, we get a really neat player_death.cfg file:
Code:
// EventScripts v0.2.0 Example
// Some example player_death commands.
if (event_var(headshot) equalto 1) then es_tell event_var(attacker) Now THAT was a good shot!
if (event_var(weapon) equalto "knife") then es_tell event_var(attacker) You humiliated him!
This script will cause a player to get a personalized notification when a player is headshot, as well as when they kill someone with a knife. You can replace the "es_tell" part with anything else you want-- for example, when combined with Mani Admin's plugin, you could play a particular sound. E.g. "[...] then ma_play headshot".

As of EventScripts v0.7.7, the operators lessthan and greaterthan were added. These work just as you'd expect on numbers. Their behavior is undefined when strings are compared, though. Here's an example of its use:
Code:
// EventScripts v0.7.7
// never let the gravity get higher than 800
if (server_var(sv_gravity) greaterthan 800) then sv_gravity 800
...

Extended Event Variables
...
es_attackersteamid - Anytime an event is received that provides "attacker", EventScripts will also set es_attackersteamid to the player's Steam ID. It's accessible like normal event variables as such: event_var(es_attackersteamid).

...

Lookup Functions
...
In EventScripts v0.7.7, support was added for es_getmoney which will look-up a Counter-Strike: Source player's current money supply. Warning this command has a dependency on internal Valve structures which can change on a Steam update. The server variable eventscripts_cflags will need to be alterred at times to prevent this function from causing undefined behavior in your scripts. (Just be aware that using it might cause problems after a Steam update until the new cflags value is available.)

Here's an example of its use in player_spawn.cfg:
Code:
// EventScripts v0.7.7
es_setinfo cash1 0
es_getmoney cash1 event_var(userid)
es_tell event_var(userid) You have server_var(cash1) dollars in your pocket.
Enjoy, and let me know if you have any problems,
-Mattie
Mattie is offline
Mattie
Veteran Member
Join Date: Jan 2005
Old 06-14-2005 , 23:35   EventScripts v0.8.0 beta has released!
#12

http://mattie.info/cs/

Changes in v0.8.0:

Lots of fixes/tweaks:
  • * Tweaked es_delayed such that it no longer adds 2-3 milliseconds to every GameFrame. It should now only check for delayed commands if any are queued-up.
    * Changed all paths to default to using forward slash (/) instead of backslash (\). This should work on both Windows and Linux machines. (Fixes scriptpack_dir bug)
    * Changed the event loader to look for both "cstrike/Resource/modevents.res" and "cstrike/resource/modevents.res". (Fixes problem on some Linux versions of srcds.)
    * Added additional debug information to help track down event misinformation issues.
    * Changed internal command syntax to hopefully help some of the event misinformation issues on Linux.
    * Increased the performance of the es_math functions: cleaned-up float/int detection, disabled console spam, reordered it such that common operators (e.g. add/subtract) are checked before uncommon ones (e.g. multiply/divide)
ServerMail script pack example showing-off a lot of v0.8.0 features:
  • 1. Allows users to leave the server admin a message by saying
    Quote:
    !report <message>
    2. A single admin can check the messages in their client console by saying
    Quote:
    !checkmsgs
    3. Download http://mattie.info/downloads/servermail.zip
    4. Extract it into the 'servermail' directory underneath your eventscripts_subdirectory.
    5. Add the following lines to your autoexec.cfg (use your STEAMID):
    Quote:
    eventscripts_register servermail
    setinfo servermailid "STEAM_0:0:0000000"
    6. Restart your server
    7. The script probably won't be actively supported by me-- it's mainly a proof of concept example.
Two new variables, both of which I recommend you ignore:
  • * eventscripts_datadirectory "cfg"
    Allows users to change the directory where keygroup data files are stored. It must be a subdirectory of your cstrike directory and it is highly recommended that you do not change it. This variable exists for those people who must change it due to situations beyond their control.
    * eventscripts_cmdline <server command-line>
    Read-only variable that just captures the server's command-line at start-up. Useful for diagnostics purposes.
Lots of new/updated commands:
  • * eventscripts_version
    Outputs the version of EventScripts that you have loaded. New in v0.8.0: This also works from the client console without rcon access.
    * es_getclientvar <variable> <userid> <varname>
    * es_xgetclientvar <variable> <userid> <varname>
    Reads a console variable from a given player and stores its value in the variable. Please note that some client console variables are not accessible to the server.
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayercount <variable> [team#]
    * es_xgetplayercount <variable> [team#]
    Stores the count of players on the server into a variable. Optionally, a team can be specified and the count of that team will be returned. This function returns -1 if an error occurs (e.g. you specify a non-existent team index).
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_string <variable> replace <text> <with text>
    * es_xstring <variable> replace <text> <with text>
    Within the variable provided, replaces all instances of text with with text. A search and replace function. (Note that es_string currently only supports the 'replace' operator.)
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygroupcreate <groupname>
    * es_xkeygroupcreate <groupname>
    Creates an internal keygroup that can be used for storing other keys and values. These groups can be written to file in Valve's KeyValues format (see es_keygroupsave). It's recommended that you call es_keygroupdelete when you are done with a group so that the memory can be freed on the server.
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygroupdelete <groupname>
    * es_xkeygroupdelete <groupname>
    Deletes a keygroup from memory so that it's not leaked.
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygrouplist <groupname>
    * es_xkeygrouplist <groupname>
    Prints to console a list of all keygroups currently in memory on the server. (Useful for script writers, but probably doesn't work over rcon.)
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygroupsave <groupname> [path]
    * es_xkeygroupsave <groupname> [path]
    Saves a keygroup from memory to a text file based on the group's name (e.g. es_groupname_db.txt). Optionally, a path can be provided. If a path is not specified, it is placed in your eventscripts_subdirectory. If a path is specified, it will look under eventscripts_datadirectory. It is recommended that you do not change eventscripts_datadirectory because it might break script packs.. The file uses Valve's KeyValues text file structure.
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygroupload <groupname> [path]
    * es_xkeygroupload <groupname> [path]
    Loads a keygroup from a text file to memory. Optionally, a path can be provided. If a path is not specified, it is loaded from your eventscripts_subdirectory. If a path is specified, it will look relative to the eventscripts_datadirectory. It is recommended that you do not change eventscripts_datadirectory because it might break script packs.. The file uses Valve's KeyValues text file structure.
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keycreate [groupname] <key>
    * es_xkeycreate [groupname] <key>
    Creates a key that can be free-floating or associated with a keygroup (so its values can be saved to a file). Keys created this way must be deleted with es_keydelete when you no longer need them (to prevent leaking memory on the server).
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keydelete [groupname] <key>
    * es_xkeydelete [groupname] <key>
    Deletes a key created with es_keycreate. If a group is specified, it deletes the key from that group, otherwise it deletes the key from the global free-floating keys. Keys created with es_keycreate must be deleted with es_keydelete when you no longer need them (to prevent leaking memory on the server).
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keylist [groupname]
    * es_xkeylist [groupname]
    Lists all keys in memory that are not associated with a group. If a group name is specified, it will list all keys and all values from that keygroup. (Useful for script writers, but probably doesn't work over rcon.)
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keysetvalue [groupname] <key> <valuename> <value>
    * es_xkeysetvalue [groupname] <key> <valuename> <value>
    Sets/creates a value named by valuename in the given key (and, optionally, keygroup). The value can be retrieved with es_keygetvalue.
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygetvalue <variable> [groupname] <key> <valuename>
    * es_xkeygetvalue <variable> [groupname] <key> <valuename>
    Looks up the value from valuename from key and stores it in the server variable you probide in variable. These values can be set with es_keysetvalue.
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_foreachkey <variable> in <groupname> <command>
    * es_xforeachkey <variable> in <groupname> <command>
    (EXPERIMENTAL) This command will loop through each key in the specified keygroup. Each iteration through the loop, it will set the specified variable to the name of the current key from the keygroup. It will then execute the command-string. It will repeat this for all keys in the keygroup. Note: Please be careful using complex commands with es_foreachkey; the server might dramatically slow down and/or stop accepting commands until the command queue is addressed.
    Code:
    (<i>es_x</i> versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)

Whew. I'll update the full documentation with step-by-step usage instructions when I can. I just wanted to be sure you guys had access to play with this before I went to bed tonight.

Enjoy!
-Mattie
Mattie is offline
Mattie
Veteran Member
Join Date: Jan 2005
Old 06-15-2005 , 23:23   EventScripts v0.8.2 beta has released!
#13

What's New in v0.8.2?

Bug fixes:
  • 1. Stopped "couldn't exec cfg/events/player_say.cfg" console messages when a script pack is registered and no similar .cfg exists in the events directory.
    2. Reverted a v0.8.0 change to internal event command handling because at least one person reported problems.
    3. Cleaned-up additional console spam for commands like es_gettime, es_copy, es_getuserid, es_rand, etc.
New variables:New commands:
  • * es_gettimestring <variable>
    * es_xgettimestring <variable>
    Returns (in the variable you provide), the current server time in string form. It formats the text according to the eventscripts_timeformat variable. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getlivingplayercount <variable> [team number]
    * es_xgetlivingplayercount <variable> [team number]
    Similar to es_getplayercount, but only counts players that are not dead. Note: Valve takes a second or two to register a player as fully dead, so this value is not so reliable in player_death.cfg, etc. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayerlocation <variable x> <variable y> <variable z> <userid>
    * es_xgetplayerlocation <variable x> <variable y> <variable z> <userid>
    Stores a player's current x, y, and z coordinates in the variables you provide. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayermovement <variable forward> <variable side> <variable up> <userid>
    * es_xgetplayermovement <variable forward> <variable side> <variable up> <userid>
    Stores a player's current forward, side, and upwards movement in the variables provided. These floating point values typically reflect the player's desired direction (i.e. the keys they're holding down) and likely isn't affected by that player's environment (falling, walking into a wall, bullets, etc).(es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_isbot <variable> <userid>
    * es_xisbot <variable> <userid>
    Sets the provided variable to 1 if the userid belongs to a bot, 0 if it belongs to a legit player, or -1 if it's an invalid userid. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
Enjoy,
-Mattie

Mattie is offline
Mattie
Veteran Member
Join Date: Jan 2005
Old 06-18-2005 , 13:05   Documentation moved to new forums
#14


Documentation has moved to my new forums:
Mattie is offline
Mattie
Veteran Member
Join Date: Jan 2005
Old 07-07-2005 , 07:54   MAJOR Update: EventScripts v0.9.0 Released!
#15

See my new forums:
http://www.mattie.info/cs/forums/viewtopic.php?t=285
Mattie is offline
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode