[Crossfire-wiki] [Crossfire DokuWiki] page added: user:gxc:client_side_scripting:cplusplus-howto

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Thu Mar 20 04:13:19 CDT 2008


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

Date        : 2008/03/20 04:13
User        : gxc
Edit Summary: created

====== Client Scripting Interface - C++ How To ======
===== 1. Using Client Commands =====
===== 2. Writing to the Screen =====
To write to the screen, use [[http://www.cplusplus.com/reference/clibrary/cstdio/printf.html|printf([output string])]] followed by [[http://www.cplusplus.com/reference/clibrary/cstdio/fflush.html|fflush(stdout)]].

For example,
<code c++>
#include <cstdio>

int main(){
	printf("draw 4 Hello world\n");
	fflush(stdout);
	return 0;
}
</code>
would return [color=#FF0000]Hello world[/color].

There are several ways to achieve this.
==== 2.1 draw ====
<code c++>
printf("draw [number] [string]");
</code>
  * [number] - Integer between 1 and 12. See chart below for colors
  * [string] - String to output to client's window
draw allows you to output data to the client's screen in several different colors. draw should almost be used when debugging or outputting script data to the user, as the majority of the other output options use the server's chat features.
^  draw Colors  ^^^^^
^  #  ^  color  ^  ^  #  ^  color  ^
|  1  |  black  |  |  7  |  light green  |
|  2  |  dark blue  |  |  8  |  very light green  |
|  3  |  red  |  |  9  |  grey  |
|  4  |  light yellow  |  |  10  |  brown  |
|  5  |  light blue  |  |  11  |  yellow  |
|  6  |  dark yellow  |  |  12  |  tan  |










====== Notes & Comments ======
This was written on a Linux machine. I have yet to run Crossfire on Windows, but I assume the syntax for coding will be the same. Running the scripts, on the other hand, might not be.
====== References =======
  * [[:Client Side Scripting]]

IP-Address  : 76.210.35.252
Old Revision: none
New Revision: http://wiki.metalforge.net/doku.php/user:gxc:client_side_scripting:cplusplus-howto

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




More information about the crossfire-wiki mailing list