Author Topic: Finding datablocks and functions  (Read 2869 times)

I'm trying to do a number of different things but I can't seem to find out how to grab a list of datablocks or functions; such as audioprofiles to play sound:
http://forum.blockland.us/index.php?topic=240211.0
it just has to be a datablock name
I'm currently trying to play a sound to one client by the means of findclientbyname("Arix").play2D("Synth4_00"); but it says that the audioprofile is not found.

To get a list of functions, type dumpConsoleFunctions();

To get a list of datablocks, type DataBlockGroup.listObjects();

To get a list of an object's member fields, use the dump() method. For example, findClientByName("me").dump();

To get a list of classes/namespaces, type dumpConsoleClasses();

To get a list of packages, type dumpActivePackages();



Those should be all of the reference functions you'll ever need. Be sure to only enable default add-ons when you use them.

Thanks for these, I'm attempting to find a list of audioProfiles through the use of audioProfile.listObjects(); but I assume that audioprofile itself is not a group of datablocks but a type; how would I go about finding a list of audioProfiles?

I assume that audioprofile itself is not a group of datablocks but a type; how would I go about finding a list of audioProfiles?

Correct. They would be in DataBlockGroup. You could do something like this:

Code: [Select]
function dumpAudioProfiles()
{
%count = DataBlockGroup.getCount();
for(%i = 0; %i < %count; %i ++)
{
%db = DataBlockGroup.getObject(%i);
if(%db.getClassName() $= "AudioProfile")
{
echo(%db.getName());
}
}
}
dumpAudioProfiles();

Thank you, very useful :)