static enum v7_err jsBotLoadFile(struct v7* v7, v7_val_t* res) { v7_val_t file = v7_arg(v7, 0); if (!v7_is_string(file)) { return V7_OK; } TString fullPath = _activeBot->getWorkDir(); TString fileName = v7_to_cstring(v7, &file); fullPath += fileName.GetAsWChar(); if (!fexists(fullPath)) { return V7_OK; } v7_val_t result; enum v7_err ress = V7_OK; ress = v7_exec_file(v7, fullPath.GetAsChar(), &result); //v7_val_t* v7Obj = _activeBot->getV7Obj(); //*v7Obj = v7_mk_object(v7); if (ress != V7_OK) { if (result == V7_SYNTAX_ERROR) MessageBox(NULL, "script fail syntax error", "Nooo", 0); else if (result == V7_EXEC_EXCEPTION) MessageBox(NULL, "script fail, exception", "Nooo", 0); else if (result == V7_EXEC_EXCEPTION) MessageBox(NULL, "script fail, exception", "Nooo", 0); else if (result == V7_AST_TOO_LARGE) MessageBox(NULL, "script fail, ast too large", "Nooo", 0); } return V7_OK; }
void Bot::say(TString& text, TString& font, unsigned char fontSize, TString& color) { if (font.IsEQ(L"")) font = _charset.font; if (fontSize < 10) fontSize = _charset.size; COLORREF coll = _charset.color; if (!color.IsEQ(L"")) coll = GetCol(color.GetAsWChar()); bot_exchange_format p(PLUGIN_EVENT_ROOM_TEXT); p << bot_value(1, text.GetAsChar()); p << bot_value(2, _charset.attributes); p << bot_value(3, fontSize); p << bot_value(4, coll); p << bot_value(5, _charset.effect); p << bot_value(6, _charset.charset); p << bot_value(7, _charset.pitch); p << bot_value(8, font.GetAsChar()); std::string d = p.data(); _mgr->deliver_event(_name.GetAsChar(), d.c_str(), (int)d.size()); }