EventScripts Forums
Mattie's EventScripts and Source Forums
Script Categories
16000 (15) abilities (15) addon (72) addons (18) admin (355) admins (24) advert (30) adverts (32) afk (18) alerts (12) ammo (25) anti (21) armor (11) auth (16) automatic (15) awp (29) ban (25) bank (11) ba_jail (35) bhop (46) block (27) bomb (48) bonus (25) boost (22) bot (36) bot-management (20) bots (24) bullet (13) bunnyhop (19) Buy (27) buymenu (13) c4 (12) cash (77) Change (14) chat (77) cheat (15) clan (17) classes (24) color (30) colors (21) command (23) commands (21) config (28) configurable (11) connect (58) counter (12) Counter-Strike-Source (20) CS:S (20) css (3404) custom (13) Damage (49) database (14) dead (19) Deagle (11) death (20) deathmatch (79) deathrun (17) deutsch (15) dice (12) disconnect (26) Dissolve (12) dm (24) dod:s (11) dods (502) download (13) easy (26) effect (14) effects (126) English (20) entity (24) est (12) es_tools (14) Eventscript (12) exploit (11) flashbang (27) français (104) french (36) fun (312) funny (18) Gabeee (11) game (12) gamemode (13) gameplay (175) German (11) give (22) gravity (16) grenade (28) grenades (32) gun (16) GunGame (31) GunGame5 (11) guns (20) Hack (16) headshot (37) health (72) hegrenade (15) help (11) hit (13) hl2dm (444) HP (26) hudhint (13) hun (18) hungarian (26) info (53) information (19) invisible (11) IP (13) jail (82) jailbreak (14) join (47) jump (19) kick (25) kill (51) kills (24) knife (66) leveling (38) LnD (14) lol (11) magyar (49) management (14) manager (11) mani (16) map (32) map-management (26) maps (17) match (25) Memphis-84 (13) menu (144) message (34) messaging (52) minecraft (12) mod (121) model (18) models (33) modye (16) money (50) motd (13) music (33) mute (20) nades (20) name (15) new (13) noblock (54) orangebox (23) player (49) player-management (31) player-tracking (28) popup (72) prop (13) propmenu (14) props (34) protect (12) protection (32) punish (11) punishment (51) python (80) quake (33) QuakeSounds (12) race (13) races (20) radio (31) random (47) rank (42) rates (15) rcon (12) realism (22) Regeln (23) respawn (69) restrict (41) round (26) rpg (32) rules (63) say (17) score (16) scout (29) Script (25) script-helper (25) scriptpack (33) sdk (171) server (63) server-tools (42) shop (12) showdamage (20) silly (31) simple (33) skin (17) skins (35) slay (13) soccer (14) sound (68) sounds (109) source (14) spanish (20) spawn (82) speed (26) statistics (14) stats (57) status (15) Steam (11) STEAMID (30) Superhero (15) surf (41) Team (30) team-balance (14) teleport (17) text (19) TF2 (142) time (23) timer (15) tools (15) tracers (19) triggers (11) uedi (17) uses_auth (18) vip (24) vote (40) voting (22) war (25) Warcraft (12) warcraft-source (20) wc3 (14) wcs (47) wcs:Python (32) weapon (88) weapons (120) web (16) welcome (14) wuerfeln (11) zm (26) zombie (100) zombiemod (55) zombies (12)
Script Authors
*XYZ*SaYnt (12) .:MiB:. (20) .:modye:. (14) .eMko* (6) 101satoon101 (12) 3R10N (24) 4u571n91 (5) 7355608 (9) Absolute (9) Ace Rimmer (40) adminc (5) adyshor37 (5) Adz (8) AgathaKnuppelkuh (8) aidden (8) ajax (5) ak_47 (6) Al3c Tr3v3lyan (6) allstareng (5) ashbash1987 (9) ATAMAH (7) Ayuto (5) aznone (5) B00M (5) BackRaw (41) BFH_RedBull (8) bigfabi (8) Bioko (10) blackshoxx (9) Blade (10) bladesback (13) bobdole (11) bodzsar1 (8) bonbon (36) Brainsucker (32) cagemonkey (8) capo azzlack (7) captain master (6) carbon-14 (10) CaskioUTF (5) cbirou (15) CbRRR (16) ChaCaLz2psy4 (5) CharlesT (5) Chris1888 (5) Chrisber (5) chrismrulz (10) Chun (6) cladiron (10) clipz934 (8) Colster (21) Cookieman8 (7) CrAzD (6) craziest (11) dani12356 (12) DanielB (19) Darkness123 (8) Dave (9) dbozan99 (7) dead man walker (12) deathx9 (5) Deathyy (16) dhack (17) Di[M]aN (12) DJ Fire-Black prod (8) DoCky (31) Don (15) dordtcore (9) DragonFreddo (8) Drassil (5) dretax14 (11) Einlanzers (47) EmbouT (10) emilplov (7) Errant (10) Eun (6) Fantole (10) FMIS (5) Franc1sco (17) freddukes (18) Frequency (6) Fridge (5) Fugi91 (6) Fulmine (5) G4ME (5) GAMEREN2 (8) german9114 (13) GODJonez (40) GoodfellaDeal (5) Hansi (6) Hisoka (6) HitThePipe (7) HOLLDIDAY (24) Icetouch (6) ichthys (25) Im the new guy (14) iNexus (13) infamous1 (9) isivisi (13) ispaine (7) Jackmaster (9) Jeff91 (45) JoeyT2006 (30) Juba_PornBorn (12) jxl180 (11) KDBFame (6) L'In20Cible (11) L.P.H (8) Largo Usagi (10) LnD (14) Lobe (11) loKkdoKk (8) lolo-le-haricot (7) LosNir (5) [email protected] (9) M4rc3L-XCN (7) macshot (7) magyar-oneill (9) Matth (7) Mattie (21) mave1993 (5) MBchrono (15) McFly (20) Medda (5) Memphis-84 (15) Messiah93 (20) Mickyy (5) micmacx (6) minimal42O (5) Mitchell (5) Mixer57 (5) modye (6) Monster_Bitch1 (9) Mordavolt (7) motomoto (23) MrScriptaz (6) mryoung (6) MyTechZone.de (9) NicolasConfigz (9) Nicolous (23) ojii (31) oliVier (10) Omega68 (6) Omega_K2 (11) Owned|Myself (8) P3N (7) pand3mic (6) parsimba (5) Pascal257 (9) PatPeter (7) PDrop (10) Phaedrus (18) PhantOm Fury (7) phoenix131 (9) pinkyyy -.- (5) pitbull0993 (7) PixelGamer (7) qwern (5) randomknifer (9) Raptor150 (31) Ratzee (6) ReaCtioN2oo9 (6) RedCliff (5) Rennnyyy (17) revolutionfighters (8) RideGuy (12) Rio (9) Roeliekt (6) roof (16) runamagic (13) Ryezin (5) sandking220 (6) Sarcasm_Poisoning (10) saRs| Johnny-5 (13) Schubaal (10) sea212 (5) sega74rus (15) sgt.angel (6) Shad0w (11) ShoTaXx# (7) sicilia (7) sicman_adrian (22) skillz92 (7) sn4k3 (18) Snake12 (7) snake38 (10) sonicsight (7) SpeedFreak (9) spoonman184 (12) stabby (22) stas (27) Stirni (6) stonedegg (8) Strontium Dog (30) SumGuy14 (25) SuperDave (49) surfteam (5) TaCo (5) TanaToS (17) Tealk (6) teowow (16) TheCheeTaH (27) TheDonFather (5) theresthatguy (6) Tiny Tod (7) tooshkan4uk (8) Totyahun (9) uedi (38) ultimatebuster (6) Undead (25) usernamesaretaken (15) wanted241 (9) Warren (13) westham (6) WhiteAvenger (7) Wonder (14) Wundermaxe (5) X-Mania (5) XE_ManUp (14) xfalcon61 (5) zSweetXz (5) ZZMatty (6) [Cs]Lord_Inferno2 (11) [DAP]Kickbutt (5) [NATO]Hunter (28) ||Wolf|| (10)
Search

Post new topic Reply to topic
Author Message
User avatar
Experienced
Profile

Posts: 379
Location:
Germany
 
New postPosted: 2009-05-21, 12:21 am 
   Post subject: Empires - Python API [V 0.10 Alpha] [Updated 9th June 09]

Empires API - Version 0.10 Alpha
Posted by:Omega_K2 on 2009-06-09.

Requirements:Description:
    Empires API - Version 0.10 Alpha

    Release Notes:

    This is an APLHA RELEASE which means it is not feature complete, likly to change and probably partially broken. Mainly this is untested.

    What is Empires API?:

    Empires API has been provided to create some easy to use and more natrual functions/classes for empiresmod instead of using playerprops etc directly.
    In addition, it is supposed to provide some convience functions for features which might be used a lot during scripting for empires.

    As of now it only features a PYTHON import version, but a ESS script is in the works. That ESS script can be loaded by es_load empapi.

    Which naming convention are you following?:

    All functions in the script follow the follwing convention:
    • Each part of the function name is captilised (ex. game.GetCurrentResearchName)
    • Incase a function returns multiple values it will use Get<name> (ex. player.GetTurretsAllotted)
    • If possible, each get funciton also provides a Set function (ex. player.SetTurretsAllotted)
    • Functions returning a boolean will use Is or Has instead of Get (ex. player.IsProne, game.HasRadar)
    • Functions setting a boolean will use Set<name>State (ex. building.SetBuiltState)
    • Dict keys ingore captilaisation (ex. player['class'], player['CLASS'], player['ClAsS'] will work)
    • Dict keys equal to the function names with Get/Set stripped (ex. player['health'])
    • Dict keys using Is/Has functions will have their name stripped aswell, however Has/Is is provided, too (player['prone'] and player['isprone] possible)
    • Classes are lower case (except for Help class to prevent overriding python's help)
    Which features are planned?:

    Since this is an Alpha release there are more upcoming features. These features include, but are not limited to:
    • ESS Support
    • Optimised python code
    • Improved error checking/handling in the python module
    • More features
    • Possible support for attribute usage
    • Extended help feature
Download: Installation:
    Extract the zip into your Empires folder.

    Incase you are upgrading from an old version, a server restart is recommended.
    However, as of 0.10 it is possible to reload the api scripts manually. To do so please execute es_load empapi/update.
    In addition, you'll need to reload any script that uses empires_api.
Functions/Help:
    As this is a pretty huge script I added several comments aswell as a Helper class to provide "easy to use" help. This feature might be improved in the future.

    However these help functions shouldn't be used on a 24/7 server; they are intended to be used on a local test server or on a server with direct access to the server console.

    See the examples below for get an idea how to use it:

    Information on aviable dictsfuncs:
    PYTHON:
      import empires_api

      def es_load(ev):
          # Used for getting a list of Get functions supported as dict
          game('NF')['help']
          # Used for getting a list of Set functions supported as dict
          # (Yeah, looks wierd-- I know <img src="./images/smilies/icon_razz.gif" alt=":P" title="Razz" />)
          game('NF')['help'] = 1
       


    Information about classes or functions:
    PYTHON:
      import empires_api

      def es_load(ev):
          # Load our helper
          helper = empires_api.Help()
          # Print help about the entire script
          helper.Help(empires_api)
          # Print help about the game class and all all it's functions
          helper.Help(empires_api.game)
          # Print help about the function GetCurrentResearch of the game class
          helper.Help(empires_api.game.GetCurrentResearch)
       


    Print current loaded datatables (only specific):
    PYTHON:
      import empires_api

      def es_load(ev):
          # Load our helper and set the items displayed per "page" to 10
          helper = empires_api.Help(10)
          # Print everything parsed (from emp_descriptions.txt) regarding weapons & skills
          helper.PrintWeaponData
          # Print everything parsed (from research_items.txt) regarding research
          helper.PrintResearchData()
       


Usage:
    To use the script import it (or import the classes/functions you wish to use).

    Usage examples:
    PYTHON:
      import empires_api

      def es_map_start(ev):
          try:
              empires_api.SetMapTurretRestrict(1)
          except UseridError:
              es.log('Can\'t set turret limit - no users!')
       


    PYTHON:
      from empires_api import player

      def player_say(ev):
          if ev['text'] == '!info':
              myplayer = player(ev['userid'])
              es.tell(ev['userid'],'Your class is %s | Commander?: %b' % (myplayer.GetClass(),myplayer.IsCommander()))
       
Addons using empires_api:
    One of my addons, cooming soon :)
Version Notes:
    0.10 Alpha:
    • Added a check whether empires mod is running upon api load
    • Added support for using the classes like dicts
    • Added SetHealth and GetHealth functions to player class
    • Added GetOrigin/SetOrigin/GetOriginString/GetOriginString aliases; supported in tank and building class
    • Added several (around 50!) new functions to the player class
    • Added Helper class provding some help features
    • Added a empapi/update script allowing to update the script without having to restart server
    • Improved script struture; added several comments (tank class)
    • Improved handling sides in tank armor functions; they automatically lower the input to avoid captilisaiton issues
    • Improved handling of inputs that are required to be a boolean (Supports strings, too)
    • Changed researchdata in the gameclass to be automatically parsed upon the first class init (Should have eleminated the need of updating the list manually upon new mod version; might cause issues if you directly used researchdata before)
    • Changed tank armor functions to retrieve the side data from class properties instead
    • Changed classes to retrieve manager entity indexes upon class init only once
    • Changed classes to store manager entity indexes in a manager dict
    • Changed player class to set userindex console var upon class init only once
    • Changed GetOrigin/SetOrigin in the building class to be inherited from the shared object instead
    • Fixed the error raised in game.__VerifyRearchItem; it won't output a list of valid research items anymore (caused a BufferOverflow)
    • Fixed SetSabotageState missing the function parameter "state"
    • Fixed script's header information to be shown properly when calling python's help() function
    0.05 Alpha:
    • Public Release
Credits:
    The following people are honoured to receive special thanks:
    • Chrisber (for suggesting how to prevent an issue with init)
    • GodJonez (for being helpful and reminding me of super() )

_________________
For Users:
Any: MySQL Advertisements | Pretty Status List | Sourcemod Authentification | Health, Armor & Team Display
CS:S: Ultimate Buyscript

For Coders:
Any: Sourcemod Authentification | pubcvarlib
Empires: Empires API

If you encountered a bug with any of my addons, please contact me in the #eventscripts irc channel on irc.gamesurge.net :)
(Otherwise, it may take a while until I notice your request in the respective addon thread.)

All my scripts are maintenace only - only bugfix updates at most. I'll be switching to source-python and ports of my scripts will be available in SP

German Slaughterhouse Board





User avatar
Experienced
Profile

Posts: 379
Location:
Germany
 
New postPosted: 2009-06-09, 7:59 am 

Huge update has been released! Make sure to download and play empires ;)

0.10 Alpha:
  • Added a check whether empires mod is running upon api load
  • Added support for using the classes like dicts
  • Added SetHealth and GetHealth functions to player class
  • Added GetOrigin/SetOrigin/GetOriginString/GetOriginString aliases; supported in tank and building class
  • Added several (around 50!) new functions to the player class
  • Added Helper class provding some help features
  • Added a empapi/update script allowing to update the script without having to restart server
  • Improved script struture; added several comments (tank class)
  • Improved handling sides in tank armor functions; they automatically lower the input to avoid captilisaiton issues
  • Improved handling of inputs that are required to be a boolean (Supports strings, too)
  • Changed researchdata in the gameclass to be automatically parsed upon the first class init (Should have eleminated the need of updating the list manually upon new mod version; might cause issues if you directly used researchdata before)
  • Changed tank armor functions to retrieve the side data from class properties instead
  • Changed classes to retrieve manager entity indexes upon class init only once
  • Changed classes to store manager entity indexes in a manager dict
  • Changed player class to set userindex console var upon class init only once
  • Changed GetOrigin/SetOrigin in the building class to be inherited from the shared object instead
  • Fixed the error raised in game.__VerifyRearchItem; it won't output a list of valid research items anymore (caused a BufferOverflow)
  • Fixed SetSabotageState missing the function parameter "state"
  • Fixed script's header information to be shown properly when calling python's help() function

_________________
For Users:
Any: MySQL Advertisements | Pretty Status List | Sourcemod Authentification | Health, Armor & Team Display
CS:S: Ultimate Buyscript

For Coders:
Any: Sourcemod Authentification | pubcvarlib
Empires: Empires API

If you encountered a bug with any of my addons, please contact me in the #eventscripts irc channel on irc.gamesurge.net :)
(Otherwise, it may take a while until I notice your request in the respective addon thread.)

All my scripts are maintenace only - only bugfix updates at most. I'll be switching to source-python and ports of my scripts will be available in SP

German Slaughterhouse Board


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group