[CF-Devel] Client side improvements

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Mon Nov 10 09:18:14 CST 2003


On Sun, 2003-11-09 at 20:31, Mark Wedel wrote:
>
     
      Preston Crow wrote:
     
     >
     
      > I have a working scripting interface for the client.  It's mostly in the
     
     >
     
      > common code, and I put in the necessary hooks in the client-specific
     
     >
     
      > code.
     
     >
     
      > 
     
     >
     
      > It creates a new process for each script that you want to run, and sends
     
     >
     
      > information to it on its stdin, and reads commands from its stdout.  The
     
     >
     
      > script can send any command that you can manually send, it can request
     
     >
     
      > information from the client (stored information, like map data), and it
     
     >
     
      > can listen to commands that the client receives from the server (like hp
     
     >
     
      > changes).
     
     >
     
      > 
     
     >
     
      > I've written a few scripts in Bash, such as one that invokes word of
     
     >
     
      > recall whenever my hp drop to less than 50%, as well as a very long one
     
     >
     
      > that cleans up my apartment.
     
     >
     
      > 
     
     >
     
      > When I last discussed this here, I didn't get a strong message as to
     
     >
     
      > whether to check in my changes.  A scripting interface is clearly
     
     >
     
      > something a number of players want, but it's also clearly something that
     
     >
     
      > gives players an advantage.
     
     >
     
      > 
     
     >
     
      > Should I check it in?
     
     >
     
     
     >
     
        That's a much better implementation, IMO, as now the scripting language is in 
     
     >
     
      whatever you want (I'd probably say that you then have to write a basic startup 
     
     >
     
      routine for each language that parses the data sent to it). Eg, your basic perl 
     
     >
     
      routine that parses all the data passed to it, or whatever.
     
     >
     
     
     >
     
        IT obviously gives some advantage.  OTOH, without it, it is basically making 
     
     >
     
      things more difficult through obscurity.  EG, right now, I could take the client 
     
     >
     
      source, and code in something that applies a healing potion if you hp are too low.
     
     
It's now checked in.

The documentation is mostly in a big comment block at the top of
common/script.c.  I'm sure that there's room for improvement, but it
seems to be quite stable and useful for me.

It's fairly low-level and exposes some of the client internals
(especially when querying the map).

--PC



_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list