Es.stringtable

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



Method: stringtable

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

Method Overview

Table of Contents

Contents


Description

Update an entry in a stringtable

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

Arguments


Examples

This will add a few sounds to the 'downloadables' stringtable.

import es
 
# Create a list of sounds...
soundList = ['first.mp3','second.mp3','third.mp3']
 
# ...and specify their location within the 'sound/' directory (see note 1)
soundDir = 'uniquedirectory/' # Change uniquedirectory accordingly
 
# The function to add each song in the list to the downloadables stringtable
def addSounds():
    for soundTitle in soundList:
        es.stringtable('downloadables', 'sound/' + soundDir + soundTitle)
 
# Re-add the sounds to the downloadables stringtable on each map load (see note 2)
def es_map_start(event_var):
   addSounds()

Notes

Note 1:
The reason the 'sound/' base directory was not included in the variable 'soundDir' is because when sounds are played using es.cexec, 'sound/' is assumed as the base path, and only the appropriate subdirectory and sound name are needed. Thus, the string literal 'sound/' is prepended to the string argument of the es.stringtable command, in order to maintain the usability of the variable 'soundDir' when it comes time to play the sound.

Note 2:
The stringtables are reset on each map load, so depending on your needs, they may need to be added again using the event es_map_start.

See Also

blog comments powered by Disqus