[Crossfire-wiki] [Crossfire DokuWiki] page changed: client_side_scripting:client_scripting_interface-basic_howto

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Tue Aug 6 12:36:33 CDT 2013


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2013/08/06 12:36
User        : katia
Edit Summary: 

@@ -112,8 +112,9 @@
  If you type the command __scripts__ in your client you will see our script is still running.\\ 
  \\ 
  Let's look more closely at the code. We define a character buffer and a length. We will use the buffer to read what the client sends to the script. Then our script sends to the client the command __monitor__ (don't forget the \n). This command asks the client to give the script a copy of all commands sent from the client to the server. Now each time a command is sent from client to server, the script will get a "monitor <command>" string.\\ 
  \\ 
+ 
  ==== A strange C command ====
    fflush(stdout)
  
  The stdout has something called a buffer. When you write to output device, it's not immediatly sent to it. For performance reasons, successive print to stdout are grouped. Most of the time, \n is enough to force sending of data, but we ensure all data are sent to client by flushing the stdout (force empty buffer). In the future, when you think client didn't get a command but the script did send it, ensure you flushed stdout.\\ 
@@ -129,11 +130,14 @@
    monitor <repeat> <must_send> <command>
  
  Now kill the script by typing command
  
-   killscript <pathtoscript>
+   scriptkill <pathtoscript>
+ 
+ or
+   scriptkill <number>
  
- Then type __scripts__ to ensure it's stopped. Edit it, comment the line printf("monitor\n"), compile and run the script again. Move and look at console. You see nothing. The script didn't ask anything so the client didn't tell it anything. Your script will only get that for which it asks.
+ Then type __scripts__ to ensure it's stopped (or to figure out the number of the script). Edit it, comment the line printf("monitor\n"), compile and run the script again. Move and look at console. You see nothing. The script didn't ask anything so the client didn't tell it anything. Your script will only get that for which it asks.
  
  Now try the following code:
  
    #include <stdio.h>


IP-Address  : 186.52.88.200
Old Revision: http://wiki.metalforge.net/doku.php/client_side_scripting:client_scripting_interface-basic_howto?rev=1375470519
New Revision: http://wiki.metalforge.net/doku.php/client_side_scripting:client_scripting_interface-basic_howto

-- 
This mail was generated by DokuWiki at
http://wiki.metalforge.net/



More information about the crossfire-wiki mailing list