[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
Fri Aug 18 00:03:27 CDT 2006


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



Date        : 2006/08/18 00:03

User        : eracc

Edit Summary: 



@@ -26,10 +26,9 @@

  

  Name it first.c, compile it and launch it in your command shell:

  

    tchize at Urd:~$ /home/tchize/script/first

- 

- issue 1 1 say hello world

+   issue 1 1 say hello world

  

  No surprise in the output (notice the \n at the end in source file). Now
 we are going to run it in the client. Start the client and log in your pr
efered server. When it's done, type in the following command:

  

    scripts

@@ -146,97 +145,62 @@

  

  === What's next? ===

  There are two things you can still do with Script. The first is to reque
st a bit of informations. The client then tells the script what it wants t
o know. The second thing is triggering an action of the script from client
 interface. The command scripttell allows player to say something to a scr
ipt. The script will get the exact command typed by player. See below for 
command list.

  

- Commands to client

- 	

+ **Commands to client**

+ 

  Here is a list of command the script can send to client.

  

-   * watch <command type> - watch the given command from server-client pr
otocol. <command type> specifies the commands we want to watch. Set to emp
ty to get all commands.

-   * unwatch <command type> - unwatch the given command from server-clien
t protocol. <command type> specifies the commands we want to watch. Set to
 empty to get all commands.

-   * request <data type> - Request a piece of informations from client me
mory. Following is the list of <data type> allowed:

- ^ Data type ^ Comment                                                   
      ^

+   * //watch <command type>// - watch the given command from server-clien
t protocol. <command type> specifies the commands we want to watch. Set to
 empty to get all commands.

+   * //unwatch <command type>// - unwatch the given command from server-c
lient protocol. <command type> specifies the commands we want to watch. Se
t to empty to get all commands.

+   * //request <data type>// - Request a piece of informations from clien
t memory. Following is the list of <data type> allowed:

+ 

+ ^ Data Type ^ Comment ^

  | range	    | Return the type and name of the currently selected range
 attack |

-     stat <type> 	Return the specified stats

-     stat stats 	Return Str,Con,Dex,Int,Wis,Pow,Cha

-     stat cmbt

- 	Return wc,ac,dam,speed,weapon_sp

-     stat hp 	Return hp,maxhp,sp,maxsp,grace,maxgrace,food

-     stat xp 	Return level,xp,skill-1 level,skill-1 xp,...

-     stat resists 	Return resistances

-     weight 	Return maxweight, weight

-     flags 	Return flags (fire, run)

-     items inv

- 	Return a list of items in the inventory, one per line

- items actv 	Return a list of inventory items that are active, one per 
line

- items on

- 	Return a list of items under the player, one per line

- items cont 	Return a list of items in the open container, one per line

- map pos

- 	Return the players x,y within the current map

- map near 	Return the 3x3 grid of the map centered on the player

- map all 	Return all the known map information

- map <x> <y> 	Return the information about square x,y in the current ma
p

-  

- 

- issue <repeat> <must_send> <command>

- send <command> to server on behalf of client.

- <repeat> is the number of times to execute command

- <must_send> tells wether or not the command must sent at all cost (1 or 
0)

- 

- issue mark <tag>

- special case of issue command. only gets the command 'mark' and a object
 tag

- 

- issue lock <new state> <tag>

- special case of issue command. Only gets the command 'lock' with 2 param
eters

- 

- draw <color> <text>

- draw the following text on client interface with given color. Usefull fo
r debugging and may help you to forget about using the stderr

- 

- monitor

- unmonitor

- start/stop monitoring commands send from client to server. Doesn't take 
any parameter.

- 

- 

- 	

- 	

- Informations from client

- 	

- 	Here is an incomplete list of information strings send by client to s
cript. Those informations are sent only because the client asked them, exc
ept for scripttell.

- 

- scripttell <yourname> <additional datas>

- user send special command to this script specifically

- 

- monitor <repeat> <must_send> <command>

- monitor mark <tag>

- monitor lock <new state> <tag>

- If monitor is on, <command> is a command send to server by the client wi
th given repeat. mark and lock are special cases.

- 

- watch <command>  <datas>

- You have put a watch on command or a part of command (like A to watch fo
r AddMe command). This command was send by server and your are notified of
 it. Content of <data> vary on command and maybe very complex

- 

- request map <x> <y>  <darkness> <need_update> <have_darkness> <need_resm
ooth> <cleared> smooth <face_bottom> <face_middle> <face_top> heads <face_
bottom> <face_middle> <face_top> tails <face_bottom> <face_middle> <face_t
op>\n",

- Bunch of informations about square <x>,<y>

+ | stat <type>     | Return the specified stats |

+ | stat stats | Return Str,Con,Dex,Int,Wis,Pow,Cha |

+ | stat cmbt | Return wc,ac,dam,speed,weapon_sp |

+ | stat hp | Return hp,maxhp,sp,maxsp,grace,maxgrace,food |

+ | stat xp | Return level,xp,skill-1 level,skill-1 xp,... |

+ | stat resists | Return resistances |

+ | weight | Return maxweight, weight |

+ | flags | Return flags (fire, run) |

+ | items inv | Return a list of items in the inventory, one per line |

+ | items actv | Return a list of inventory items that are active, one per
 line |

+ | items on | Return a list of items under the player, one per line |

+ | items cont | Return a list of items in the open container, one per lin
e |

+ | map pos | Return the players x,y within the current map |

+ | map near | Return the 3x3 grid of the map centered on the player |

+ | map all | Return all the known map information |

+ | map <x> <y> | Return the information about square x,y in the current m
ap |

  

- request map <x> <y> unknown

- error occured.

+   * //issue <repeat> <must_send> <command>// - send <command> to server 
on behalf of client. <repeat> is the number of times to execute command <m
ust_send> tells whether or not the command must sent at all cost (1 or 0)

+   * //issue mark <tag>// - special case of issue command. only gets the 
command 'mark' and a object tag

+   * //issue lock <new state> <tag>// - special case of issue command. On
ly gets the command 'lock' with 2 parameters

+   * //draw <color> <text>// - draw the following text on client interfac
e with given color. Usefull for debugging and may help you to forget about
 using the stderr

+   * //monitor// - start monitoring commands send from client to server. 
Doesn't take any parameter.

+   * //unmonitor// - stop monitoring commands send from client to server.
 Doesn't take any parameter.

  

- request map pos <x> <y>

- Tells script current position of player

+ **Information from client**

  

- request map end

- Marks the end of a complete map transfer from client to script. Helpful.

+ Here is an incomplete list of information strings send by client to scri
pt. Those informations are sent only because the client asked them, except
 for scripttell.

  

+   * //scripttell <yourname> <additional data>// - user send special comm
and to this script specifically

+   * //monitor <repeat> <must_send> <command>//

+   * //monitor mark <tag>//

+   * //monitor lock <new state> <tag>// - If monitor is on, <command> is 
a command send to server by the client with given repeat. mark and lock ar
e special cases.

+   * //watch <command>  <data>// - You have put a watch on command or a p
art of command (like A to watch for AddMe command). This command was send 
by server and your are notified of it. Content of <data> vary on command a
nd maybe very complex

+   * //request map <x> <y>  <darkness> <need_update> <have_darkness> <nee
d_resmooth> <cleared> smooth <face_bottom> <face_middle> <face_top> heads 
<face_bottom> <face_middle> <face_top> tails <face_bottom> <face_middle> <
face_top>// - Bunch of informations about square <x>,<y>

+   * //request map <x> <y> unknown// - error occured.

+   * //request map pos <x> <y>// - Tells script current position of playe
r

+   * //request map end// - Marks the end of a complete map transfer from 
client to script. Helpful.

  

- ** NOTE more command to be added here, incomplete liste **

+   * FIXME ** NOTE more information strings to be added here, incomplete 
list **

  

- 	

- 	

- Windows-specific notes

- 	

- 	Scripting works thanks to a patch from archaios. Known issues are:

+ === Windows-specific notes ===

+ Scripting works thanks to a patch from archaios. Known issues are:

  

      * If you want to run a Perl script for instance, you need to issue '
perl <script_name.pl>, even if .pl is correctly seen as perl script.

      * If script doesn't output anything, try turning off buffering (in p
erl $| = 1) or flush your pipe, or add a sleep at end of program. It see
ms Windows closes pipes at script termination before client gets time to g
rab output. 

  

  

  





IP-Address  : 72.4.41.2

Old Revision: http://wiki.metalforge.net/doku.php/client_side_scripting:cl
ient_scripting_interface-basic_howto?rev=1155863741

New Revision: http://wiki.metalforge.net/doku.php/client_side_scripting:cl
ient_scripting_interface-basic_howto



-- 

This mail was generated by DokuWiki at

http://wiki.metalforge.net/





More information about the crossfire-wiki mailing list