View Single Post
  #3  
Old 07-18-2011, 01:16 AM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

No the ID passed is always correct
I just can't call it from the const using a pointer such as
botid = this->GetBotID(); //this causes an error at compile
I can send botid like the code above but it doesn't show in game on the bots. Meaning the Say("Checks") all show that every variable has exactly what it is supposed to have but it isnt showing.
To test if my code worked in some degree what I did was:

Code:
uint32 Bot::GetEquipmentColor(int8 material_slot) const
{
	//CRIIMSON: Bot tints
	int32 slotid = 0;
	uint32 returncolor = 0;
              botid = 0;
	
	//Translate code slot # to DB slot #
	while(slotid == 0){
		if (material_slot == 0){
			slotid = 2;
		}
		else if (material_slot == 1){
			slotid = 17;
		}
		else if (material_slot == 2){
			slotid = 7;
		}
		else if (material_slot == 3){
			slotid = 9;
		}
		else if (material_slot == 4){
			slotid = 12;
		}
		else if (material_slot == 5){
			slotid = 18;
		}
		else if (material_slot == 6){
			slotid = 19;
		}

	//CRIIMSON: next two won't be called usually - put in for servers that want to allow dying of weaps/shields
		else if (material_slot == 7){
			slotid = 13;
		}
		else if (material_slot == 8){
			slotid = 14;
		}
	}

	//CRIIMSON: read from db
	char* Query = 0;
	MYSQL_RES* DatasetResult;
	MYSQL_ROW DataRow;
	
	if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT color FROM botinventory WHERE BotID = %i AND SlotID = %i", botid, slotid), 0, &DatasetResult)) {
		if(mysql_num_rows(DatasetResult) == 1) {
			DataRow = mysql_fetch_row(DatasetResult);
			if(DataRow)
				returncolor = atoi(DataRow[0]);
		}
		mysql_free_result(DatasetResult);
		safe_delete_array(Query);
	}
	//return returncolor;
             return 1644825;
}
Which doesn't read the DB and always sends back black, but every bot is wearing all black when spawned or zoned. Which leads me to believe that the code I have is functioning and if I could figure out how to get botid into the function all would be well and there would be much happiness in my heart

Criimson

EDIT: and I renamed the function GetBotEquipmentColor to keep people from getting it confused with the ones in MoB:: or Client::

EDIT EDIT:
The while statement was for convenience. It will always show == 0 on call and it is only called by the items that show on bots so there is no chance of a loop happening as my code stands now.
Reply With Quote