Here are a few docs on functions i made:
msyql_async_create_query:
Adds a mysql query to the async query handler queue. Will not return anything. Result will be stored. Will return a referencing ID which is 32-bit signed.
Returns undefined if not called correctly.
Should be used with the wrapper functions for async mysql
Usage: mysql_async_create_query(query);
mysql_async_create_query("SELECT YO_MAMA FROM fatzos");
msyql_async_create_query_nosave:
Adds a mysql query to the async query handler queue. Will not return anything and the result will not be stored. Will return a referencing ID which is 32-bit signed.
Returns undefined if not called correctly.
Should be used with the wrapper functions for async mysql
Usage: mysql_async_create_query_nosave(query);
mysql_async_create_query_nosave("INSERT mah_dick INTO YO_MAMA");
mysql_async_getdone_list:
Returns a list of completed query-ids (see the unique ID in mysql_async_create_query and mysql_async_create_query). Should be combined with a mysql_async_getresult_and_free() for each id returned.
Returns an array of integers.
Should be used with the wrapper functions for async mysql
Usage: mysql_async_getdone_list();
mysql_async_getresult_and_free:
Returns the result of an async query and frees the internal pointer so the same id will not be put on the mysql_async_getdone_list(). Returns 0 for nosave queries (mysql_async_create_query_nosave), and the mysql_store_result(connection) for save queries (mysql_async_create_query)
Usage: mysqsl_async_getresult_and_free(async_id);
mysql_async_initializer:
Sets up the async mysql module. Only needs to be called once per server-start, will not do anything if called subsequently.
Usage: mysql_async_initializer(hostname, username, pasword, database, port_is_int, connectioncount);
Advise: Use a relatively low connectioncount (eg 4) for normal usage, go up to 10 if your server is busy (30+ players or a lot of queries) or located far from the mysql server.
mysql_reuse_connection:
When calling the mysql_real_connect for the first time, this connection will be stored in a global (libcod) variable. This function retrieves said variable (or undefined if no connection has been set up yet).
Very useful when trying to keep mysql connections to a minimum.
Usage: level.mysql = mysql_reuse_connection();
add_language:
Adds a allowed language to the language engine. Has to be a 2-character, uppercase string.
Usage: add_language(language)
add_language("EN");
load_languages:
Scans a file for a predetermined format of language items, very similar to CoD2 localized strings (.str files). These files should look like this:
and can be stored as any file, any extension. Call add_languages with the path+filename of said file. Second input is a force-reload flag which in the future might reduce loading times by a few milliseconds. For now, not-reloading is bugged and the force-reload flag should always be set to 1.Code:REFERENCE blackjack_starting LANG_EN "Starting a game of blackjack" LANG_DE "Eine neue Runde Blackjack wird gestartet" LANG_HU "Blackjack jatek kezdese" LANG_CZ "Spousteni hry blackjack" LANG_HR "Igra blackjack-a pocinje" REFERENCE blackjack_help_1 LANG_EN "Play blackjack" LANG_DE "Starte Blackjack" LANG_HU "Jatssz a blackjakkel" LANG_CZ "Hrat BlackJack" LANG_HR "Igranje blackjack-a"
Usage: load_languages(path_and_filename, force_reload);
load_languages(getcvar("fs_homepath") + "/" + getcvar("fs_game") + "/translations/JH_b3.txt", 1);
Can be called for multiple files.
get_language_item:
Uses the language engine to find a certain item. Returns a string. Language should be a 2-character uppercase string.
Usage: get_language_item(language, item);
get_language_item("EN", "blackjack_starting");
get_language_item("HU", "blackjack_starting");
sprintf:
See http://www.cplusplus.com/reference/cstdio/sprintf/
Exception: no buffer/stringpointer is required for sprintf, returns the string to stack instead.
Usage: sprintf(format, additional_arguments)