bool RunScriptLine(const char* buf) { // create a Script object UInt8 scriptObjBuf[sizeof(Script)]; Script * tempScriptObj = (Script *)scriptObjBuf; void * scriptState = GetGlobalScriptStateObj(); tempScriptObj->Constructor(); tempScriptObj->MarkAsTemporary(); tempScriptObj->SetText(buf); bool bResult = tempScriptObj->CompileAndRun(*((void**)scriptState), 1, NULL); tempScriptObj->StaticDestructor(); return bResult; }
bool RunScriptLineOnREFR(const char * buf, TESObjectREFR* callingObj, bool bSuppressOutput) { ToggleConsoleOutput(!bSuppressOutput); // create a Script object UInt8 scriptObjBuf[sizeof(Script)]; Script * tempScriptObj = (Script *)scriptObjBuf; void * scriptState = GetGlobalScriptStateObj(); tempScriptObj->Constructor(); tempScriptObj->MarkAsTemporary(); tempScriptObj->SetText(buf); bool bResult = tempScriptObj->CompileAndRun(*((void**)scriptState), 1, callingObj); tempScriptObj->StaticDestructor(); ToggleConsoleOutput(true); return bResult; }
bool InjectAnimation( ClientEntity *ent,BYTE slot ) { TESObjectREFR * refr = GetRefrFromEntity(ent); if(!refr || !refr->IsActor()) return false; else { ent->InjectAnim(slot); #if 0 //TODO: See CallCommandGeneric double result; // We wish to call PlayGroup. This has the parameters ( which are passed as flat array in arg1 ) // AnimGroup ( a UINT16) , and 1 Integer ( flag, which we want to be "1" ) UInt8 ParamData[sizeof(UINT16) + sizeof(UINT32)]; Actor * actor = (Actor *)refr; // create a Script object UInt8 scriptObjBuf[sizeof(Script)]; Script * tempScriptObj = (Script *)scriptObjBuf; ScriptEventList evlist; evlist.m_eventList = NULL; evlist.m_script = tempScriptObj; evlist.m_unk1 = 0; evlist.m_vars = NULL; void * scriptState = GetGlobalScriptStateObj(); tempScriptObj->Constructor(); tempScriptObj->MarkAsTemporary(); if(Playing) *((UINT16 *)ParamData) = slot; // Set parameter 1 ( aniom group) else *((UINT16 *)ParamData) = 0; // Play idle anim *((UINT32 *)(ParamData + 2)) = 1; // Flag to start immediately // Parameter list, parameters, thisOBj, arg3= param count, ScriptEventList ( what to put in there?) , Result ptr, and offset ( is 0 ok ? ) //Cmd_PlayGroup_Execute(kParams_CmdPlayGroup,ParamData,actor, 2,tempScriptObj,&evlist,&result,0); // NULL denotes incomplete params tempScriptObj->StaticDestructor(); #endif } return true; }