[Crossfire-wiki] [Crossfire DokuWiki] page changed: user:gxc:client_side_scripting:cplusplus-howto
no-reply_wiki at metalforge.org
no-reply_wiki at metalforge.org
Thu Mar 20 04:41:54 CDT 2008
A page in your DokuWiki was added or changed. Here are the details:
Date : 2008/03/20 04:41
User : gxc
Edit Summary: Added basic 1. Using Client Commands; more to 2. Writing
@@ -1,10 +1,25 @@
====== Client Scripting Interface - C++ How To ======
===== 1. Using Client Commands =====
+ To use a command normally entered in the client, use [[http://www.cplusplus.com/reference/clibrary/cstdio/printf.html|printf]]("issue 1 1[output string]") followed by [[http://www.cplusplus.com/reference/clibrary/cstdio/fflush.html|fflush]](stdout). printf writes the output string in stdout, which is read by the client and interpreted. fflush(stdout) flushes or clears stdout((Normally, stdout doesn't need to be cleared this often, but when scripting for Crossfire, it's good practice to flush it after each use)), readying it for more data.
+
+ An explanation of "issue 1 1 " can be found [[:client_side_scripting:client_scripting_interface-basic_howto|here]], in an introduction to scripting overall. Essentially, the first integer is the number of times to repeat an action. For debugging and information purposes, it's generally a good idea to leave it as 1 and create a loop in C++. The second 1 should always be set as 1.
+
+ Example:
+ <code c++>
+ #include <cstdio>
+
+ int main(){
+ printf("issue 1 1 use_skill praying");
+ fflush(stdout);
+ return 0;
+ }
+ </code>
+ This would make the character pray once.
===== 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)]].
+ 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). printf writes the output string in stdout, which is read by the client and interpreted. fflush(stdout) flushes or clears stdout((Normally, stdout doesn't need to be cleared this often, but when scripting for Crossfire, it's good practice to flush it after each use)), readying it for more data.
- For example,
+ Example:
<code c++>
#include <cstdio>
int main(){
@@ -12,9 +27,9 @@
fflush(stdout);
return 0;
}
</code>
- would return [color=#FF0000]Hello world[/color].
+ This would return [color=#FF0000]Hello world[/color].
There are several ways to achieve this.
==== 2.1 draw ====
<code c++>
IP-Address : 76.210.35.252
Old Revision: http://wiki.metalforge.net/doku.php/user:gxc:client_side_scripting:cplusplus-howto?rev=1206004396
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