Up to Main Index Up to Journal for May, 2020 JOURNAL FOR SUNDAY 10TH MAY, 2020 ______________________________________________________________________________ SUBJECT: More fixes and changes before the big Body update DATE: Sun 10 May 18:44:03 BST 2020 It’s been a little quiet around here, far too quiet. For the last couple of weeks I’ve not been doing great and feeling rather ill. No, not Coronavirus, but it has meant that I’ve been programming a lot less. Now I’m back at the keyboard and pulling together all of my changes for bodies in WolfMUD :) As usual I’d been coding until I felt things were ‘right’ before committing. This has resulted in the need to break up my changes into manageable commits. The first set of which I’ve just pushed to the public dev branch. Don’t get too excited — I’ve not pushed the main body code just yet. These commits are mainly foundational changes for me to build on and a few fixes. All of the work for the Body attribute is now finished, I just need time to commit everything in a coherent manner — these are just the commits I have ready. As I’m putting together my commits I’m also filling in missing documentation, updating existing documentation and making lots of little tweaks to tidy things up — so it’s taking me a little while to put everything together. On to the fixes. The main fix simplifies the code in message/Buffer.Deliver method and reduces the number of allocations. The attr/Player.Write method has been updated to implement io.Writer correctly — it relied on receiving a copy of a []byte from Buffer.Deliver that it could modify, but io.Writer says “Write must not modify the slice data, even temporarily” — oops :( I’ve improved the player prompt code so that it is more readable. By popular request the player prompt has been updated. All of the text in the prompt is now the same magenta colour except for the current value. Before this change the text was in the default colour set by the terminal/client. Next the changes. It is now possible to use hyphen/minus ‘-’ and underscore ‘_’ in keywords in zone files. Before this change a hyphen/minus or underscore would have been treated as a keyword/value delimiter. This change is needed so that you can specify things like ‘UPPER_ARM’ or ‘UPPER-ARM’ on the Body attribute which is more readable than ‘UPPERARM’. For instance, while I am developing, the default humanoid body is defined as: Body: HEAD FACE EAR→2 EYE→2 NOSE MOUTH UPPER_LIP LOWER_LIP NECK SHOULDER→2 UPPER_ARM→2 ELBOW→2 LOWER_ARM→2 WRIST→2 HAND→2 FINGER→8 THUMB→2 CHEST BACK WAIST PELVIS UPPER_LEG→2 KNEE→2 LOWER_LEG→2 ANKLE→2 FOOT→2 Yes, that’s currently 47 body slots to customise your character with gear :) Another needed change is prefixing of keywords with an exclamation mark ‘!’. In computing an exclamation mark is often used to mean ‘not’ or to invert the truthfulness of something. For example if we take the above body and poke our eye out: Body: HEAD FACE EAR→2 EYE !EYE NOSE MOUTH UPPER_LIP LOWER_LIP NECK SHOULDER→2 UPPER_ARM→2 ELBOW→2 LOWER_ARM→2 WRIST→2 HAND→2 FINGER→8 THUMB→2 CHEST BACK WAIST PELVIS UPPER_LEG→2 KNEE→2 LOWER_LEG→2 ANKLE→2 FOOT→2 We know we have two eyes: EYE and !EYE, but one is not usable (read !EYE as ‘not an EYE’ or ‘missing an EYE’). But knowing we have a missing eye it might be possible to somehow restore it… Last of all I’ve added a simple helper function to the text package called List. It takes a string slice and returns a string with the elements of the slice separated by commas and the last two items separated by ‘and’: text.List("A") → "A" text.List("A", "B") → "A and B" text.List("A", "B", "C") → "A, B and C" Simple, but very useful when processing text lists for output. As I said, fixes and changes are on the public dev branch with the Body attribute changes to follow. -- Diddymus Up to Main Index Up to Journal for May, 2020