Up to Main Index Up to Journal for November, 2014 JOURNAL FOR FRIDAY 21ST NOVEMBER, 2014 ______________________________________________________________________________ SUBJECT: A mini update to public dev branch DATE: Fri 21 Nov 23:01:03 GMT 2014 Another update! Quite a bit smaller this time. Firstly this update fixes an issue that prevented users from using passwords with Unicode characters. When trying to create an account with such a password the verification always failed. There are also some minor changes to the wording of a couple of messages. A new feature - familiar to Java WolfMUD users - is support for 'alternative' message text markup. This has been added via a new text.Format function. An example of such markup could be: There [is/are] currently %d other player[/s] The alternatives are represented as '[text/text]'. The text before the slash is the primary text and the text after the slash is the secondary or alternative text. Which text is used is determined by a boolean flag to text.Format which has the signature: Format(text string, alternative bool, a ...interface{}) string The message above could be formatted using: Format("There [is/are] currently %d other player[/s]:", count > 2, count-1)) For a count of 2 the message produced would be: "There is currently 1 other player." For a larger count the message would be: "There are currently 2 other players." The main advantage of this markup is being able to author static text files that can behave dynamically - if you look at the Java WolfMUD you will see it is used extensivly for combat messages: {0} swing[/s] a longsword at {3}. {0} lunge[/s] at {3} with a longsword wounding {1}. {0} slash[/es] at {3} with {4} longsword. In these examples the {n} is for substituting names, Him, His, Hers etc. but this is not available yet. Taking the first message as an example with Diddymus attacking an Imp with a longsword we would get something like: You swing a longsword at an imp. Diddymus swings a longsword at you. You see Diddymus swing a longsword at an imp. Which message you would see depends on whether you are Diddymus, the imp or a spectator. Fun things to come :) -- Diddymus Up to Main Index Up to Journal for November, 2014