本文整理汇总了C++中RunScript函数的典型用法代码示例。如果您正苦于以下问题:C++ RunScript函数的具体用法?C++ RunScript怎么用?C++ RunScript使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RunScript函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Move
IPState DomeScript::Move(DomeDirection dir, DomeMotionCommand operation)
{
if (operation == MOTION_START)
{
if (RunScript(dir == DOME_CW ? SCRIPT_MOVE_CW : SCRIPT_MOVE_CCW, nullptr))
{
DomeAbsPosNP.s = IPS_BUSY;
TargetAz = -1;
}
else
{
DomeAbsPosNP.s = IPS_ALERT;
}
}
else
{
if (RunScript(SCRIPT_ABORT, nullptr))
{
DomeAbsPosNP.s = IPS_IDLE;
}
else
{
DomeAbsPosNP.s = IPS_ALERT;
}
}
IDSetNumber(&DomeAbsPosNP, nullptr);
return ((operation == MOTION_START) ? IPS_BUSY : IPS_OK);
}
示例2: RunScript
bool Behavior::StartScript(NPC *npc, EventManager *eventmgr)
{
if (interrupted && resume_after_interrupt)
{
npc->Printf(3,"Resuming behavior %s after interrupt at step %d - %s.",
name.GetData(), current_step, sequence[current_step]->GetName());
interrupted = false;
return RunScript(npc,eventmgr,true);
}
else
{
// Start at the first step of the script.
current_step = 0;
if (interrupted)
{
// We don't resume_after_interrupt, but the flag needs to be cleared
npc->Printf(3,"Restarting behavior %s after interrupt at step %d - %s.",
name.GetData(), current_step, sequence[current_step]->GetName());
interrupted = false;
}
return RunScript(npc,eventmgr,false);
}
}
示例3: RunScript
bool ScriptingTest::Run(int argc, char** argv) {
mFailed = false;
dt::Root::GetInstance().Initialize(argc, argv);
dt::ScriptManager::Get()->AddScript("print(DT_VERSION);", "print_test");
dt::ScriptManager::Get()->AddScript("DT_VERSION", "return_version");
dt::ScriptManager::Get()->AddScript("print(TotalTime);", "update_context");
dt::ScriptManager::Get()->LoadScript("scripts/test_load_script_file.js");
RunScript("print_test");
RunScript("return_version", dt::Root::_VERSION);
RunScript("test_load_script_file.js", "test");
sf::Sleep(sf::Milliseconds(100));
dt::ScriptManager::Get()->UpdateContext();
RunScript("update_context");
if(mFailed) {
std::cout << "Test Script: Errors occured." << std::endl;
return false;
}
dt::Root::GetInstance().Deinitialize();
return true;
}
示例4: RunScript
void WSL::Framework::Standard::Positional::PositionalInitialize()
{
if( initialize == true ) {
RunScript( initializeScript );
SetPosition( position );
}
}
示例5: main
int main()
{
Lua luaInstance;
std::stringstream ss;
auto globalTable = luaInstance.GetGlobalEnvironment();
auto myOwnPrint = luaInstance.CreateYieldingFunction<void(std::string)>
(
[&](std::string str)
{
ss << str;
}
);
globalTable.Set("myownprint", myOwnPrint);
luaInstance.LoadStandardLibraries();
auto cr = luaInstance.CreateCoroutine();
auto err = cr.RunScript(
" myownprint 'hello '\n"
" myownprint 'hello2 '\n"
" myownprint 'hello3 '\n"
);
while (cr.CanResume())
{
ss << "yield ";
auto err = cr.Resume();
}
auto resstr = ss.str();
return resstr.compare("hello yield hello2 yield hello3 yield ");
}
示例6: RunScript
void ScriptInterface::RunScript( QObject* obj, QString filename )
{
QScriptContext* context = m_scriptEngine.pushContext( );
context->setThisObject( m_scriptEngine.toScriptValue( obj ) );
RunScript( filename );
PopThis( );
}
示例7: RunScript
void AHKHandler::GameStart()
{
wstring app = (L"C://0adProcessor/Scripts/Start.exe");
LPWSTR appName = (LPWSTR)app.c_str();
RunScript(appName);
}
示例8: main
int main(int argc, char* argv[])
{
OMX_Init();
if (argc == 2)
{
OMX_STRING pScriptFile = (OMX_STRING) argv[1];
RunScript(pScriptFile);
}
else if (argc == 4)
{
OMX_STRING pTestName = (OMX_STRING) argv[1];
OMX_STRING pConfigFile = (OMX_STRING) argv[2];
OMX_STRING pNumSession = (OMX_STRING) argv[3];
OMX_S32 nSession;
nSession = atoi((char*) pNumSession);
RunTest(pTestName, pConfigFile, nSession);
}
else
{
VENC_TEST_MSG_ERROR("invalid number of command args %d", argc);
VENC_TEST_MSG_ERROR("./mm-venc-omx-test ENCODE Config.cfg 1");
}
OMX_Deinit();
}
示例9: PySpell_Create
void PythonSpellIntegration::SpellTrigger(int spellId, SpellEvent evt) {
bool cancelled = 0;
SpellPacketBody spellPktBody;
spellSys.GetSpellPacketBody(spellId, &spellPktBody);
if (evt == SpellEvent::SpellEffect && spellPktBody.targetListNumItems > 0) {
for (uint32_t i = 0; i < spellPktBody.targetListNumItems; i++) {
auto tgtObj = spellPktBody.targetListHandles[i];
// TODO: Verify attachee vs. target here
if (!pythonObjIntegration.ExecuteObjectScript(spellPktBody.objHndCaster, tgtObj, spellId, ObjScriptEvent::SpellCast)) {
cancelled = 1;
}
}
if (cancelled) {
return;
}
}
auto pySpell = PySpell_Create(spellId);
auto args = Py_BuildValue("(O)", pySpell);
auto spellEnum = spellSys.GetSpellEnumFromSpellId(spellId);
auto result = RunScript(spellEnum, (EventId)evt, args);
Py_DECREF(args);
// Result of RunScript is a bit different here
if (result == 0 || result == -1) {
PySpell_UpdatePacket(pySpell);
addresses.SpellSoundPlay(&spellPktBody, evt);
}
Py_DECREF(pySpell);
}
示例10: lua_gettop
int JLuaServer::FnRequire( lua_State* pLua )
{
if (lua_gettop( pLua ) != 1)
{
rlog.err( "LUA: Incorrect command usage: <require>. "
"Function takes 1 string argument, but %d is provided", lua_gettop( pLua ) );
lua_settop( pLua, 0 );
lua_pushnil( pLua );
return 1;
}
if (!lua_isstring( pLua, -1 ))
{
rlog.err( "LUA: Incorrect command usage: <require>. "
"Function expects 1 string argument, for example: require('myfile.lua')" );
lua_settop( pLua, 0 );
lua_pushnil( pLua );
return 1;
}
const char* pScriptName = lua_tostring( pLua, -1 );
Path path( pScriptName );
int scriptID = GetScriptID( path.GetFile() );
JLuaThread* pThread = reinterpret_cast<JLuaThread*>( pLua->userdata );
assert( pThread->m_pLua == pLua );
JObject* pRootObj = pThread->m_pRootObj;
JString res;
int threadID = RunScript( scriptID, pRootObj, &res );
return 0;
} // JLuaServer::FnRequire
示例11: Create
bool BD::Create()
{
if (!RunScript("./update_db/baseline.sql")){
qDebug() << "Error run " << "./update_db/baseline.sql";
return false;
}
return true;
}
示例12: IUFindOnSwitchIndex
bool ScopeScript::MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command)
{
char _rate[] = { (char)('0' + IUFindOnSwitchIndex(&SlewRateSP)), 0 };
bool status =
RunScript(command == MOTION_STOP ? SCRIPT_ABORT : dir == DIRECTION_WEST ? SCRIPT_MOVE_WEST : SCRIPT_MOVE_EAST,
_rate, nullptr, nullptr);
return status;
}
示例13: Launch0Ad
void AHKHandler::StartAsHost()
{
Launch0Ad();
LPWSTR appName = (LPWSTR)L"C://0adProcessor/Scripts/Host.exe";
RunScript(appName);
}
示例14: RunScript
bool DomeScript::Abort()
{
bool status = RunScript(SCRIPT_ABORT, nullptr);
if (status)
{
LOG_INFO("Successfully aborted");
}
return status;
}
示例15: getDatabaseVersion
void BD::UpdateDataBase()
{
QString str;
QSqlQuery query;
QString version;
version = getDatabaseVersion();
if (version == "1.5"){
str = "UPDATE version SET version = '01.05.000' WHERE version = 1.5";
if (!query.exec(str)) {
qDebug()<<query.lastError();
LogOut.logout(query.lastError().text());
}
UpdateDataBase();
return;
}
QDir dir_with_sql("./update_db");
QStringList filters;
QStringList list_with_sql;
QStringList list_update;
filters << "??_??_???.sql";
list_with_sql = dir_with_sql.entryList(filters,QDir::Files,QDir::Name);
QString major;
QString minor;
QString subversion;
major = version.left(2);
minor = version.mid(3,2);
subversion = version.right(3);
for(int i = 0;i < list_with_sql.count();i++){
if(list_with_sql.at(i).left(2).toInt() > major.toInt()){
list_update << dir_with_sql.absoluteFilePath(list_with_sql.at(i));
}else if(list_with_sql.at(i).left(2).toInt() == major.toInt()){
if(list_with_sql.at(i).mid(3,2).toInt() > minor.toInt()){
list_update << dir_with_sql.absoluteFilePath(list_with_sql.at(i));
}else if (list_with_sql.at(i).mid(3,2).toInt() == minor.toInt()){
if((list_with_sql.at(i).mid(6,3).toInt() > subversion.toInt())){
list_update << dir_with_sql.absoluteFilePath(list_with_sql.at(i));
}
}
}
}
for (int i=0;i<list_update.count();i++){
if (!RunScript(list_update.at(i))){
qDebug() << "Error run " << list_update.at(i);
}else{
qDebug() << "run script" << list_update.at(i);
}
}
QueryExecute("VACUUM");
}