Code: Show/Hide #include "spawn.h" const int BUFFER_LEN = 256; static char buffer[BUFFER_LEN]; static char path[BUFFER_LEN]; void botInfo::LoadSettings() { // load settings from settings.ini // initial_arena and max_deaths global variables GetCurrentDirectory(BUFFER_LEN - 64, path); strcat(path, "\\settings.ini"); String s; GetPrivateProfileString("Bot", "ArenaName", "error", buffer, BUFFER_LEN, path); s = buffer; strcpy(initial_arena,s); GetPrivateProfileString("Bot", "MaxDeaths", "error", buffer, BUFFER_LEN, path); s = buffer; max_deaths = s.toInteger(); } |
Code: Show/Hide // [Bot] is from first argument in GetPrivateProfileString // ArenaName= is second [Bot] ArenaName=league MaxDeaths=3 |
Code: Show/Hide //Load Functions, Courtesy of SOS
#define G(name) ZeroMemory(buffer, 192);\ GetPrivateProfileString(title.msg, name, "-1", buffer, 192, Path) #define G2(a) if (isNumeric(buffer))\ a = getInteger(buffer, 10);\ else\ a = 0 #define G3(a) if (isNumeric(buffer))\ a = getLong(buffer, 10);\ else\ a = 0 void botInfo::load() { char Path[520]; GetCurrentDirectory(520, Path); strcat(Path, "\\lvztoggle.ini"); char buffer[192]; String title = "Objects"; G("TimeInterval"); G2(interval); ... } |