Es.event

From EventScripts Community Encyclopedia
This article is a stub. Please help by adding to it.



Method: event

Module: es
Class: (no class)
EventScripts version: 2.0

Method Overview

Table of Contents

Contents


Description

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

Init the event with 'initialize' first, then set the values and afterwards fire it with 'fire'.

This is the Python equivalent of: http://www.eventscripts.com/pages/es_event

Arguments

primary argument - can be either 'initialize', 'fire', 'setstring', 'setint', 'setfloat' and 'cancel'.

event name - the name of the event to be fired

name - the name of the value to be set [only used with 'setstring', 'setint' and 'setfloat']

value - the value to set name to [only used with 'setstring', 'setint' and 'setfloat']


Examples

# when your event happens
    es.event('initialize',"player_flag") # initialize the event
    es.event('setstring',"player_flag","userid",userid) # set the userid to the userid
    es.event('setstring',"player_flag","flag",1) # set the flag to 1
    es.event('setstring',"player_flag","state",2) # set the status to 2
    es.event('fire',"player_flag") # fire the event
 
 
def player_flag(event_var):
    """ Handle it like any other event """
    userid = event_var["userid"]
    flag = event_var["flag"]
    state = event_var["state"]
    es.msg(userid + " has the flag " + flag + " and status " + state)

Notes


See Also

blog comments powered by Disqus