Up to Main Index                          Up to Journal for February, 2017

                   JOURNAL FOR THURSDAY 9TH FEBRUARY, 2017
______________________________________________________________________________

SUBJECT: Minor site update & WolfMUD scripting
   DATE: Thu  9 Feb 23:28:19 GMT 2017

Still have my nose to the grindstone and shoulder to the wheel with work. As a
result I’ve had to neglect WolfMUD for over a week. Last night I’d had enough,
downed tools at a reasonable(ish) hour a dove into some WolfMUD coding.

It felt good :)

Before I talk about that I want to talk about some changes to the site. I’ve
tweaked the site generator I wrote for WolfMUD to generate compressed content
for all of the site pages, css and font files. As long as your web browser
supports compressed content (most do) the site should be just a tad faster.
I’ve tested in Chrome (Linux), Firefox, Internet Explorer 11 and Edge (Windows
10) and Chrome on Android (Marshmallow). However if anybody has any issues
please, please let me know: diddymus@wolfmud.org

Due to my tardiness with things WolfMUD it also looks like v0.0.4 will not be
released this month with a rollup of the latest changes :(

So how about the recent coding?

In my last entry I was talking about commands for scripting. Since then I’ve
added a scripting flag to the state struct in the cmd package. It’s a simple
bool flag and handled automatically. There is also a new Script function.

Player commands should still be handled by Parse, which now sets
state.scripting to false. For scripting outside of the cmd package Script
should be called, which sets state.scripting to true. This is the only
difference between Parse and Script.

The Script function is intended for use in packages like frontend and attr.

For commands in the cmd package that script using other commands there is
still the unexported script method which now sets state.scripting to true.

The difference between the Script function and the script method is that
Script goes through the locking phase the same as Parse. Whereas script is
intended to be used from within Parse and Script that have already obtained
the locks they need.

For an example of using the script method see move.go in the cmd package.

For an example of using the Script function see game.go in the frontend
package. This uses a new scripting only “$POOF” command when players are
initially placed into the game. Yes, I decided to go with the ‘$’ prefix for
scripting only commands as the ‘$’ looks like ‘S’ for scripting.

Everything mentioned here is now available in the public Git dev branch.

--
Diddymus


  Up to Main Index                          Up to Journal for February, 2017