Samples

Since this documentation barely scratches the surface, and since the best way of learning is by studying examples :) there are three sample plugins prepared for you. You can use them to learn more about the structure of the plugins and about the techniques used. You can also use them as a starting point for your own plugins.

You can find the plugin sources in the "Plugin" subdirectory of the WME installation directory. The sample plugins are:

wme_sample - A very simple plugin providing two classes ("Sample" and "AnotherSample"). The "Sample" class simply maintains one member variable, allows setting/getting it and modifying it using a script method. The member variable is serialized. The "AnotherSample" class is more interesting. It subscribes the update and scene-init events. The plugin uses the update event to display current time every 10 seconds. The scene-init event is used to display a welcome message whenever the player enters a new scene.

wme_snow - This is a more advanced plugin. It's basically a recreation of Jerrot's WeatherGod snow-generating script. This plugin dynamically generates a bunch of WME entities to represent the snowflakes and animates them on the update event. It provides a couple of scripting methods and properties, it can serialize its state. Also notice that the plugin contains the default flake image in resources.

wme_sample_pixel - This plugin demonstrates pixel operations on WME sprite subframes. It handles the update event and on each update it updates all the pixels of a subframe.

 

WME directory also contains one WME project called "wme_plugins_demo". This simple project demonstrates the usage of snow and pixel plugins.

 

Helper functions library

The "Plugin" directory also contains a library of several convenience helper functions. They can be found in the "src" subfolder and they are contained as static methods of CWmeUtils class. Currently there are functions for returning a random number, for working with RGBA color values and for serializing string variables. This library might be farther expanded in the future.