Skip to content

Commit

Permalink
svm baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf109909 committed Nov 7, 2023
1 parent 52a8a1a commit 2913f01
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions NorthstarDLL/scripts/scriptsvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,38 @@
SQRESULT NSSvmTrain(HSquirrelVM* sqvm)
{
//g_pSquirrel<ScriptContext::SERVER>->__sq_get
SQArray* array = sqvm->_stackOfCurrentFunction[1]._VAL.asArray;
std::vector<Vector3> origins;

for (int vIdx = 0; vIdx < array->_usedSlots; ++vIdx)
{
if (array->_values[vIdx]._Type == OT_STRING)
{
origins.push_back(Vector3(
array->_values[vIdx]._VAL.asVector->x, array->_values[vIdx]._VAL.asVector->y, array->_values[vIdx]._VAL.asVector->z));
}
}

// origins operations


return SQRESULT_NOTNULL;
}

// integer NSSvmPredict(point origin)
SQRESULT NSSvmPredict(HSquirrelVM* sqvm)
{
Vector3 vec = g_pSquirrel<ScriptContext::CLIENT>->getvector(sqvm,-1);
Vector3 vec = g_pSquirrel<ScriptContext::CLIENT>->getvector(sqvm,1);

// code

g_pSquirrel<ScriptContext::SERVER>->pushinteger(sqvm,1);
int result = 0;
g_pSquirrel<ScriptContext::SERVER>->pushinteger(sqvm, result);
return SQRESULT_NOTNULL;
}


ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptPlayerInfo, ClientSquirrel, (CModule module))
{
g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration("userdata", "NSSvmTrain", "", "", NSSvmTrain);
g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration("userdata", "NSSvmTrain", "array origins", "", NSSvmTrain);
g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration("int", "NSSvmPredict", "vector origin", "", NSSvmPredict);
}

0 comments on commit 2913f01

Please sign in to comment.