void init_parameters() { init_string_options(); init_double_options(); init_functions(); init_check_strings(); // for debugging }
void LuaNPCScript::nextCycle() { init_functions(); try { World::get()->setCurrentScript(this); call("nextCycle")(); } catch (luabind::error &e) { writeErrorMsg(); } }
jint JNI_OnLoad(JavaVM *vm, void *reserved) { JNIEnv *env; if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_6)) { return JNI_ERR; /* JNI version not supported */ } jvm = vm; init_ids(env); init_functions(env); return JNI_VERSION_1_6; }
void T_Init() { void init_functions(); if (global_script == NULL) { global_script = new DFsScript; GC::AddSoftRoot(global_script); init_functions(); } }
void LuaNPCScript::beforeReload() { init_functions(); try { World::get()->setCurrentScript(this); Logger::writeMessage("scripts","LuaNPCScript::beforeReload called for: " + _thisnpc->name); call("beforeReload")(); } catch (luabind::error &e) { writeErrorMsg(); } }
bool LuaNPCScript::lookAtNpc(Character *source, unsigned char mode) { init_functions(); try { World::get()->setCurrentScript(this); fuse_ptr<Character> fuse_source(source); call("lookAtNpc")(fuse_source, mode); return true; } catch (luabind::error &e) { writeErrorMsg(); return false; } }
void LuaNPCScript::useNPC(Character *user, unsigned short counter, unsigned short int param, unsigned char ltastate) { init_functions(); try { World::get()->setCurrentScript(this); //CWorld::get()->monitoringClientList->sendCommand( new SendMessageTS("LuaNPCScript::useNPC called for: " + _thisnpc->name,3)); Logger::writeMessage("scripts","LuaNPCScript::useNPC called for: " + _thisnpc->name); fuse_ptr<Character> fuse_user(user); call("useNPC")(fuse_user, counter, param, ltastate); } catch (luabind::error &e) { writeErrorMsg(); //CWorld::get()->monitoringClientList->sendCommand( new SendMessageTS("Error: LuaNPCScript::useNPC called for: " + _thisnpc->name + " " + e.what(),3)); } }
bool LuaNPCScript::actionDisturbed(Character *performer, Character *disturber) { init_functions(); try { World::get()->setCurrentScript(this); //CWorld::get()->monitoringClientList->sendCommand( new SendMessageTS("LuaNPCScript::actionDisturbed called for: " + _thisnpc->name,3)); Logger::writeMessage("scripts","LuaNPCScript::actionDisturbed called for: " + _thisnpc->name); fuse_ptr<Character> fuse_performer(performer); fuse_ptr<Character> fuse_disturber(disturber); return luabind::object_cast<bool>(call("actionDisturbed")(fuse_performer, fuse_disturber)); } catch (luabind::error &e) { return true; } }
// we heard <cc> say <message> void LuaNPCScript::receiveText(Character::talk_type tt, std::string message, Character *cc) { init_functions(); try { World::get()->setCurrentScript(this); #ifdef MAJORSCRIPTLOG //CWorld::get()->monitoringClientList->sendCommand( new SendMessageTS("LuaNPCScript::receiveText called for: " + _thisnpc->name,3)); Logger::writeMessage("scripts","LuaNPCScript::receiveText called for: " + _thisnpc->name); #endif fuse_ptr<Character> fuse_cc(cc); call("receiveText")((int)tt, message, fuse_cc); } catch (luabind::error &e) { writeErrorMsg(); //CWorld::get()->monitoringClientList->sendCommand( new SendMessageTS("Error: LuaNPCScript::receiveText called for: " + _thisnpc->name + " " + e.what(),3)); } }
void LuaNPCScript::abortRoute(Character *npc) { init_functions(); try { World::get()->setCurrentScript(this); #ifdef MAJORSCRIPTLOG //CWorld::get()->monitoringClientList->sendCommand( new SendMessageTS("enemyNear called for: " + Monster->name,3)); Logger::writeMessage("scripts","abortRoute called for: " + npc->name); #endif fuse_ptr<Character> fuse_npc(npc); call("abortRoute")(fuse_npc); } catch (luabind::error &e) { writeErrorMsg(); //CWorld::get()->monitoringClientList->sendCommand( new SendMessageTS("Error: enemyNear called for: " + Monster->name + " " + e.what(),3)); } }
int main(int argc, char **argv) { symbol *symbols; symbols = init_built_in_functions(symbols); symbols = init_functions(symbols, io_functions, IO_FUNCTIONS_N); char **defaults = malloc(sizeof(char*) * 3); defaults[0] = NULL; defaults[1] = "/usr/lib/mlm/funcs.l"; defaults[2] = NULL; read_files(symbols, 2, defaults); if (argc > 1) read_files(symbols, argc, argv); repl(symbols, stdin, 1); return 0; }
LIBEMV_API void libemv_init(void) { init_functions(); libemv_debug_enabled = 1; libemv_init_tlv_buffer(); // Settings memset(&libemv_settings, 0, sizeof(libemv_settings)); memset(&libemv_global, 0, sizeof(libemv_global)); libemv_applications_count = 0; libemv_applications = 0; libemv_settings.appSelectionUsePSE = 1; libemv_settings.appSelectionSupportConfirm = 1; libemv_settings.appSelectionPartial = 1; libemv_settings.appSelectionSupport = 1; }
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR CmdLine, int nShow) { WNDCLASS wc; HWND wnd; MSG msg; init_threads (); init_functions (); wc.style = 0; wc.lpfnWndProc = MainWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInst; wc.hIcon = 0; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0)); wc.lpszMenuName = 0; wc.lpszClassName = "MandClass"; if (!RegisterClass(&wc)) return 1; init_bi(); wnd = CreateWindow("MandClass", "M-View", WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hInst, 0); if (!wnd) return 1; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; }
LuaTriggerScript::LuaTriggerScript() throw(ScriptException) : LuaScript() { init_functions(); }
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { RECT rc; HDC dc; PAINTSTRUCT ps; int n; switch (msg) { case WM_CREATE: GetClientRect(hwnd, &rc); init_borders(rc.right, rc.bottom); return 0; case WM_PAINT: dc = BeginPaint(hwnd, &ps); redraw(hwnd, dc); EndPaint(hwnd, &ps); return 0; case WM_SIZE: GetClientRect(hwnd, &rc); SX = rc.right; SY = rc.bottom; invalidate(hwnd); return 0; case WM_CLOSE: PostQuitMessage(0); return 0; case WM_KEYDOWN: switch (wparam) { case VK_RIGHT: shift(SX / 10.0, 0); invalidate(hwnd); break; case VK_LEFT: shift(- (SX / 10.0), 0); invalidate(hwnd); break; case VK_DOWN: shift(0, SY / 10.0); invalidate(hwnd); break; case VK_UP: shift(0, - (SY / 10.0)); invalidate(hwnd); break; } return 0; case WM_CHAR: switch (wparam) { case '+': bigger(); invalidate(hwnd); break; case '-': smaller(); invalidate(hwnd); break; case ' ': func_index++; if (func_index == func_count) func_index = 0; calculate_func = funcs[func_index]; invalidate(hwnd); break; case '\r': full_mode = !full_mode; init_functions (); invalidate (hwnd); break; } return 0; case WM_MOUSEWHEEL: n = (int16_t)(wparam >> 16) / 120; while (n > 0) { bigger(); --n; } while (n < 0) { smaller(); ++n; } invalidate(hwnd); return 0; case WM_LBUTTONDOWN: mousedown = TRUE; GetCursorPos(&cursor_pos); SetCapture(hwnd); SetCursor(LoadCursor(NULL, IDC_HAND)); return 0; case WM_LBUTTONUP: mousedown = FALSE; ReleaseCapture(); SetCursor(LoadCursor(NULL, IDC_ARROW)); return 0; case WM_MOUSEMOVE: if (mousedown) { POINT p; GetCursorPos(&p); shift(cursor_pos.x - p.x, cursor_pos.y - p.y); cursor_pos = p; invalidate(hwnd); } break; } return DefWindowProc(hwnd, msg, wparam, lparam); }
LuaNPCScript::LuaNPCScript(std::string filename, NPC *thisnpc) throw(ScriptException) : LuaScript(filename), _thisnpc(thisnpc) { init_functions(); }
LuaTriggerScript::LuaTriggerScript(const std::string &filename, const position &pos) throw(ScriptException) : LuaScript(filename), _pos(pos) { init_functions(); }
LuaLongTimeEffectScript::LuaLongTimeEffectScript(std::string filename, LongTimeEffectStruct effectStruct) throw(ScriptException) : LuaScript(filename), _effectStruct(effectStruct) { init_functions(); }
LuaMagicScript::LuaMagicScript(std::string filename, unsigned long int MagicFlag) throw(ScriptException) : LuaScript(filename), _MagicFlag(MagicFlag) { init_functions(); }
LuaMagicScript::LuaMagicScript(const std::string &filename, const SpellStruct &) : LuaScript(filename) { init_functions(); }