当前位置: 首页>>代码示例>>C++>>正文


C++ RunScript函数代码示例

本文整理汇总了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);
}
开发者ID:geehalel,项目名称:indi,代码行数:28,代码来源:dome_script.cpp

示例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);
    }
}
开发者ID:randomcoding,项目名称:PlaneShift-PSAI,代码行数:25,代码来源:npcbehave.cpp

示例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;
}
开发者ID:JIANGJZ,项目名称:ducttape-engine,代码行数:26,代码来源:ScriptingTest.cpp

示例4: RunScript

void WSL::Framework::Standard::Positional::PositionalInitialize()
{
	if( initialize == true ) {
		RunScript( initializeScript );
		SetPosition( position );
	}
}
开发者ID:GCGGames,项目名称:White-StormLightning,代码行数:7,代码来源:Positional.cpp

示例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 ");
}
开发者ID:lambage,项目名称:Lambgine,代码行数:35,代码来源:demonstration3.cpp

示例6: RunScript

void ScriptInterface::RunScript( QObject* obj, QString filename )
{
  QScriptContext* context = m_scriptEngine.pushContext( );
  context->setThisObject( m_scriptEngine.toScriptValue( obj ) );
  RunScript( filename );
  PopThis( );
}
开发者ID:karpinsn,项目名称:PortalCalibration,代码行数:7,代码来源:ScriptInterface.cpp

示例7: RunScript

void AHKHandler::GameStart()
{
	wstring app = (L"C://0adProcessor/Scripts/Start.exe");
	LPWSTR appName = (LPWSTR)app.c_str();

	RunScript(appName);
}
开发者ID:biddyweb,项目名称:Castle-Covert-Channel,代码行数:7,代码来源:AHKHandler.cpp

示例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();
}
开发者ID:AOKP,项目名称:hardware_qcom_media,代码行数:29,代码来源:venctest_App.cpp

示例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);
}
开发者ID:ema29,项目名称:TemplePlus,代码行数:33,代码来源:python_integration_spells.cpp

示例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
开发者ID:skopp,项目名称:rush,代码行数:29,代码来源:luafunc.cpp

示例11: Create

bool BD::Create()
{
    if (!RunScript("./update_db/baseline.sql")){
        qDebug() << "Error run " << "./update_db/baseline.sql";
        return false;
    }
    return true;
}
开发者ID:MartovKot,项目名称:ZHSK,代码行数:8,代码来源:bd.cpp

示例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;
}
开发者ID:djibb,项目名称:indi,代码行数:8,代码来源:telescope_script.cpp

示例13: Launch0Ad

void AHKHandler::StartAsHost()
{
	Launch0Ad();

	LPWSTR appName = (LPWSTR)L"C://0adProcessor/Scripts/Host.exe";

	RunScript(appName);
}
开发者ID:biddyweb,项目名称:Castle-Covert-Channel,代码行数:8,代码来源:AHKHandler.cpp

示例14: RunScript

bool DomeScript::Abort()
{
    bool status = RunScript(SCRIPT_ABORT, nullptr);
    if (status)
    {
        LOG_INFO("Successfully aborted");
    }
    return status;
}
开发者ID:geehalel,项目名称:indi,代码行数:9,代码来源:dome_script.cpp

示例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");

}
开发者ID:MartovKot,项目名称:ZHSK,代码行数:57,代码来源:bd.cpp


注:本文中的RunScript函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。