View Single Post
  #9  
Old 07-12-2011, 04:46 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Hmm you did show me a flaw in my table structure. I didnt add a character column.

I was doing something like that with #bot autorune on/off

Code:
//Set if chanters automatically cast rune
	if(!strcasecmp(sep->arg[1], "autorune")) {

		std::string errorMessage;
		char* Query = 0;
		char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];

		if (!strcasecmp(sep->arg[2], "off")){	
			if(!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE `bot_variables` SET `values`= 0 WHERE bot_variable = 'auto_rune';"))){
					errorMessage = std::string(TempErrorMessageBuffer);
			}
		}
		else if (!strcasecmp(sep->arg[2], "on")){	
			if(!database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE `bot_variables` SET `values`= 1 WHERE bot_variable = 'auto_rune';"))){
					errorMessage = std::string(TempErrorMessageBuffer);
			}
		}
		else {
			c->Message(0,"Correct input is #bot autorune (on/off)");
		}
		return;
	}
This code works perfectly. Then in the botspellsai.cpp under case SpellType_Buff:

I was adding a check: if(IsEffectInSpell(selectedBotSpell.SpellId, SE_Rune))

and this is where it all broke down.

I am going to comment out the code and work on something else in the code for a bit. Restructured the bot_variables table so it can be set on a character by character basis. But my brain is starting to hurt.

Criimson
Reply With Quote