PYTHON_GLOBAL_METHOD_DEFINITION(PtSetPythonLoggingLevel,args,"Params: level\nSets the current level of python logging")
{
unsignedlonglevel;
if(!PyArg_ParseTuple(args,"l",&level))
{
PyErr_SetString(PyExc_TypeError,"PtSetPythonLoggingLevel expects an unsigned long");
PYTHON_RETURN_ERROR;
}
cyMisc::SetPythonLoggingLevel(level);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtConsole,args,"Params: command\nThis will execute 'command' as if it were typed into the Plasma console.")
{
char*command;
if(!PyArg_ParseTuple(args,"s",&command))
{
PyErr_SetString(PyExc_TypeError,"PtConsole expects a string");
PYTHON_RETURN_ERROR;
}
cyMisc::Console(command);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtConsoleNet,args,"Params: command,netForce\nThis will execute 'command' on the console, over the network, on all clients.\n"
"If 'netForce' is true then force command to be sent over the network.")
PyErr_SetString(PyExc_TypeError,"PtConsoleNet expects a string and a boolean");
PYTHON_RETURN_ERROR;
}
cyMisc::ConsoleNet(command,netForce!=0);
PYTHON_RETURN_NONE;
}
#if 1
// TEMP
PYTHON_GLOBAL_METHOD_DEFINITION(PtPrintToScreen,args,"Params: message\nPrints 'message' to the status log, for debug only.")
{
char*message;
if(!PyArg_ParseTuple(args,"s",&message))
{
PyErr_SetString(PyExc_TypeError,"PtPrintToScreen expects a string");
PYTHON_RETURN_ERROR;
}
cyMisc::PrintToScreen(message);
PYTHON_RETURN_NONE;
}
#endif
PYTHON_GLOBAL_METHOD_DEFINITION(PtAtTimeCallback,args,"Params: selfkey,time,id\nThis will create a timer callback that will call OnTimer when complete\n"
"- 'selfkey' is the ptKey of the PythonFile component\n"
"- 'time' is how much time from now (in seconds) to call back\n"
"- 'id' is an integer id that will be returned in the OnTimer call")
PyErr_SetString(PyExc_TypeError,"PtAtTimeCallback expects a ptKey, a float, and an unsigned long");
PYTHON_RETURN_ERROR;
}
if(!pyKey::Check(keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtAtTimeCallback expects a ptKey, a float, and an unsigned long");
PYTHON_RETURN_ERROR;
}
pyKey*key=pyKey::ConvertFrom(keyObj);
cyMisc::TimerCallback(*key,time,id);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtClearTimerCallbacks,args,"Params: key\nThis will remove timer callbacks to the specified key")
{
PyObject*keyObj=NULL;
if(!PyArg_ParseTuple(args,"O",&keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtClearTimerCallbacks expects a ptKey");
PYTHON_RETURN_ERROR;
}
if(!pyKey::Check(keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtClearTimerCallbacks expects a ptKey");
PYTHON_RETURN_ERROR;
}
pyKey*key=pyKey::ConvertFrom(keyObj);
cyMisc::ClearTimerCallbacks(*key);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtFindSceneobject,args,"Params: name,ageName\nThis will try to find a sceneobject based on its name and what age its in\n"
"- it will return a ptSceneObject if found"
"- if not found then a NameError exception will happen")
{
char*name;
char*ageName;
if(!PyArg_ParseTuple(args,"ss",&name,&ageName))
{
PyErr_SetString(PyExc_TypeError,"PtFindSceneobject expects two strings");
PYTHON_RETURN_ERROR;
}
returncyMisc::FindSceneObject(name,ageName);
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtFindActivator,args,"Params: name\nThis will try to find an activator based on its name\n"
"- it will return a ptKey if found"
"- it will return None if not found")
{
char*name;
if(!PyArg_ParseTuple(args,"s",&name))
{
PyErr_SetString(PyExc_TypeError,"PtFindActivator expects a string");
PYTHON_RETURN_ERROR;
}
returncyMisc::FindActivator(name);
}
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtClearCameraStack,cyMisc::ClearCameraStack,"Clears the camera stack")
PYTHON_GLOBAL_METHOD_DEFINITION(PtWasLocallyNotified,args,"Params: selfKey\nReturns 1 if the last notify was local or 0 if the notify originated on the network")
{
PyObject*keyObj=NULL;
if(!PyArg_ParseTuple(args,"O",&keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtWasLocallyNotified expects a ptKey");
PYTHON_RETURN_NONE;
}
if(!pyKey::Check(keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtWasLocallyNotified expects a ptKey");
PyErr_SetString(PyExc_TypeError,"PtDetachObject expects either two ptKeys or two ptSceneobjects");
PYTHON_RETURN_ERROR;
}
PYTHON_RETURN_NONE;
}
/*PYTHON_GLOBAL_METHOD_DEFINITION(PtLinkToAge, args, "Params: selfKey,ageName,spawnPointName\nDEPRECIATED: Links you to the specified age and spawnpoint")
PYTHON_GLOBAL_METHOD_DEFINITION(PtEnableControlKeyEvents,args,"Params: selfKey\nEnable control key events to call OnControlKeyEvent(controlKey,activateFlag)")
{
PyObject*keyObj=NULL;
if(!PyArg_ParseTuple(args,"O",&keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtEnableControlKeyEvents expects a ptKey");
PYTHON_RETURN_ERROR;
}
if(!pyKey::Check(keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtEnableControlKeyEvents expects a ptKey");
PYTHON_RETURN_ERROR;
}
pyKey*key=pyKey::ConvertFrom(keyObj);
cyMisc::EnableControlKeyEvents(*key);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtDisableControlKeyEvents,args,"Params: selfKey\nDisable the control key events from calling OnControlKeyEvent")
{
PyObject*keyObj=NULL;
if(!PyArg_ParseTuple(args,"O",&keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtDisableControlKeyEvents expects a ptKey");
PYTHON_RETURN_ERROR;
}
if(!pyKey::Check(keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtDisableControlKeyEvents expects a ptKey");
PYTHON_RETURN_ERROR;
}
pyKey*key=pyKey::ConvertFrom(keyObj);
cyMisc::DisableControlKeyEvents(*key);
PYTHON_RETURN_NONE;
}
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtEnableAvatarCursorFade,cyMisc::EnableAvatarCursorFade,"Enable the avatar cursor fade")
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtDisableAvatarCursorFade,cyMisc::DisableAvatarCursorFade,"Disable the avatar cursor fade")
PYTHON_GLOBAL_METHOD_DEFINITION(PtFadeLocalAvatar,args,"Params: fade\nFade (or unfade) the local avatar")
{
charfade;
if(!PyArg_ParseTuple(args,"b",&fade))
{
PyErr_SetString(PyExc_TypeError,"PtFadeLocalAvatar expects a boolean");
PYTHON_RETURN_ERROR;
}
cyMisc::FadeLocalPlayer(fade!=0);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtSetOfferBookMode,args,"Params: selfkey,ageFilename,ageInstanceName\nPut us into the offer book interface")
PYTHON_GLOBAL_METHOD_DEFINITION(PtSetShareSpawnPoint,args,"Params: spawnPoint\nThis sets the desired spawn point for the receiver to link to")
{
char*spawnPoint;
if(!PyArg_ParseTuple(args,"s",&spawnPoint))
{
PyErr_SetString(PyExc_TypeError,"PtSetShareSpawnPoint expects a string");
PYTHON_RETURN_ERROR;
}
cyMisc::SetShareSpawnPoint(spawnPoint);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtSetShareAgeInstanceGuid,args,"Params: instanceGuid\nThis sets the desired age instance guid for the receiver to link to")
{
char*guidStr;
if(!PyArg_ParseTuple(args,"s",&guidStr))
{
PyErr_SetString(PyExc_TypeError,"PtSetShareAgeInstanceGuid expects a string");
PYTHON_RETURN_ERROR;
}
Uuidguid;
if(!GuidFromString(guidStr,&guid))
{
PyErr_SetString(PyExc_TypeError,"PtSetShareAgeInstanceGuid string parameter is not a guid string");
PYTHON_RETURN_ERROR;
}
cyMisc::SetShareAgeInstanceGuid(guid);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtNotifyOffererLinkAccepted,args,"Params: offerer\nTell the offerer that we accepted the link offer")
{
unsignedlongofferer;
if(!PyArg_ParseTuple(args,"l",&offerer))
{
PyErr_SetString(PyExc_TypeError,"PtNotifyOffererLinkAccepted expects an unsigned long");
PYTHON_RETURN_ERROR;
}
cyMisc::NotifyOffererPublicLinkAccepted(offerer);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtNotifyOffererLinkRejected,args,"Params: offerer\nTell the offerer that we rejected the link offer")
{
unsignedlongofferer;
if(!PyArg_ParseTuple(args,"l",&offerer))
{
PyErr_SetString(PyExc_TypeError,"PtNotifyOffererLinkRejected expects an unsigned long");
PYTHON_RETURN_ERROR;
}
cyMisc::NotifyOffererPublicLinkRejected(offerer);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtNotifyOffererLinkCompleted,args,"Params: offerer\nTell the offerer that we completed the link")
{
unsignedlongofferer;
if(!PyArg_ParseTuple(args,"l",&offerer))
{
PyErr_SetString(PyExc_TypeError,"PtNotifyOffererLinkCompleted expects an unsigned long");
PyErr_SetString(PyExc_TypeError,"PtFakeLinkAvatarToObject expects two ptKeys");
PYTHON_RETURN_ERROR;
}
pyKey*avatar=pyKey::ConvertFrom(avatarObj);
pyKey*object=pyKey::ConvertFrom(objectObj);
cyMisc::FakeLinkToObject(*avatar,*object);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtWearDefaultClothingType,args,"Params: key,type\nForces the avatar to wear the default clothing of the specified type")
{
PyObject*keyObj=NULL;
unsignedlongtype;
if(!PyArg_ParseTuple(args,"Ol",&keyObj,&type))
{
PyErr_SetString(PyExc_TypeError,"PtWearDefaultClothingType expects a ptKey and an unsigned long");
PYTHON_RETURN_ERROR;
}
if(!pyKey::Check(keyObj))
{
PyErr_SetString(PyExc_TypeError,"PtWearDefaultClothingType expects a ptKey and an unsigned long");
PYTHON_RETURN_ERROR;
}
pyKey*key=pyKey::ConvertFrom(keyObj);
cyMisc::WearDefaultClothingType(*key,type);
PYTHON_RETURN_NONE;
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtFileExists,args,"Params: filename\nReturns true if the specified file exists")
{
PyObject*filenameObj;
if(!PyArg_ParseTuple(args,"O",&filenameObj))
{
PyErr_SetString(PyExc_TypeError,"PtFileExists expects a string");
// we'll allow this, just in case something goes weird
char*text=PyString_AsString(directoryObj);
wchar_t*wText=hsStringToWString(text);
boolretVal=cyMisc::CreateDir(wText);
delete[]wText;
PYTHON_RETURN_BOOL(retVal);
}
else
{
PyErr_SetString(PyExc_TypeError,"PtCreateDir expects a string");
PYTHON_RETURN_ERROR;
}
}
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetUserPath,"Returns the unicode path to the client's root user directory. Do NOT convert to a standard string.")