Original Post
Hello, I am trying to develop a scripting system similiar to(if not a clone of)Sir Sapo's. Now, what I'm trying to do is read in these "tokens" which is the first character in the script. The problem is, I cannot make comparisons between a loaded in script and a single character: Part of cScript.cpp: and cScript.h I have no idea why this shouldn't work, because neither the local "script" string nor the member variable "rawScript" is a pointer... Can anyone help? Thanks in advance! [smile] EDIT: All this-> code has also been removed since for a split second I thought that was it...
/*Process' the script and "parse it"*/
void cScript::Process()
{
std::string script = rawScript;
if(script[0] == "-") //if the script file starts with a - (this is where I get a comparison error
{
Persistent = true; //the script is persistent
}
else
{
Persistent = false;
}
int i = 1;
while(script != ";")
{
Command = script; //assign each character to the command
++i; //increment the iterator
}
}
#ifndef CSCRIPT_H
#define CSCRIPT_H
class cScript
{
public:
bool LoadScript(std::string); //loads a script from file
std::string getScript() const; //returns the current script
void Execute() const; //execute the script
void Process();
std::string getCommand() const;
cScript(std::string);
private:
std::string rawScript;
std::string Command;
std::string Param1;//both parameters are optional
std::string Param2;
bool Persistent(); //this is true if the script conditions should be checked each update
};
#endif