Excuse my newbie denseness, but how do I use the basic_string class in rSDK? I'm keen to use it to make string manipulation a lot easier, but I'm lost.
Any helps would be appreciated!![]()

Excuse my newbie denseness, but how do I use the basic_string class in rSDK? I'm keen to use it to make string manipulation a lot easier, but I'm lost.
Any helps would be appreciated!![]()

Got it. Make sure you #include <string> and either use namespace "std" or prepend 'std' before any string functions, like:
std::string szMyString;
Now... how would I store a vector in RunData? I'm not sure what kind of datatype to provide it...

The best way is to store a pointer to the vector in rundata, and new it in CreateRunObject in Runtime.cpp and delete it in DestroyRunObject.
Check out the source to ValueAdd, it uses both vectors and strings, could help.
EDIT: What am I talking about? It uses a map not a vector. Similar idea though. A vector of strings would be: std::vector<std::string>. I recommend using typedef to save yourself the headache of typing that repeatedly.

Check out this thread:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=201326#Post2013 26
Apparently this must be done because MMF2 only calls the CreateRunObject and DestroyRunObject functions, and it doesn't call any constructors otherwise.
Also, I have a couple nifty macros for you for getting parameters to std::string
Just put this at the top of your Main.cpp fileCode:#ifdef _STRING_ #define StrParam() string((char *)Param(TYPE_STRING)) #define EStrParam() string((char *)ExParam(TYPE_STRING)) #endif //_STRING_
You can prepend it with std:: if you didn't do using namespace std;
Then all you have to do to get a string parameter for a condition or action is MyString = StrParam(); and for an expression, MyString = EStrParam();
Working as fast as I can on Fusion 3
LB, you should prefix the string in your macro with std:: anyway, that way it will work without using namespace std;


It's cleaner to create your own structure and store a pointer to that in rdPtr, creating in CreateRunObject and deleting it in DestroyRunObject. Any objects in that structure will have their constructors/destructors called (of course), and it also makes it easier to make your object global in the future.
I stored mine in a vector by adding:
#include <string>
using namespace std;
at the top of my header file.
Then just store a pointer to it in RunData.
I actually stored mine in my own class object so all I do it delete my class in DestroyRunObject and the destructor handles everything else (pretty much what jamie said)

Thanks guys!
When you want to store raw binary data, what data type would you use?

I don't know what the best thing to do is, but maybe vector<char> ?

char is the traditional "byte" type because C never defined a "byte" type.
VC++ has the __int8 type, which makes more sense to use. unsigned __int8 is probably even better.