Modding:Wishes: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(add categoory) |
||
Line 1: | Line 1: | ||
[[Category:Modding]] | |||
Creating your own wishes requires 2.0.200.24 or greater. | Creating your own wishes requires 2.0.200.24 or greater. | ||
Revision as of 01:12, 17 April 2020
Creating your own wishes requires 2.0.200.24 or greater.
To create a wish, you define a `XRL.World.Capabilities.WishHandler` attribute on a public class, you pass two parameters, a RegularExpression pattern string, and a Method Name which should take a successful Match if one is found. Your method should return true if you handled the wish.
[XRL.World.Capabilities.WishHandler(@"^mytestwish$", "TestWishHandler")]
public static class MyWishHandler
{
// the method should be public static, return a bool, and take a "Match" or it will not get called
public static bool TestWishHandler(System.Text.RegularExpressions.Match match)
{
Popup.Show("Matched: " + match.Groups[0].ToString());
// if we dont return true, other wishes will also parse this wish message
return true;
}
}
The regular expression passed to the attribute is parsed using case insensitive matching.