• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Not correct count when use items

eyteew

es neko nesaprotu :D
Joined
Nov 25, 2009
Messages
104
Reaction score
0
Location
Thais
Hello! (0.3.6 pl1, 8.60)
There is problem:
I have in my backpack 50; 100; 100 mana potions in 3 stacks. When I use, I see: Using one of 50 mana potions...
It shows count only of the first stack and this is annoying.
I guess this happens because I don't have autostacking function, right? hope its not! Becouse I don't have any experience in source compiling.
So, how to fix this?

Thank you and have a nice evening!
 
Last edited:
What did you mean?

He mean that you need to edit sources mate, and limus gave you a link, you should read, i will post you the answer

i think that you have the sources and know how to compile

Go to game.cpp and search this

Code:
void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	int32_t subType = -1;
	if(item->hasSubType() && !item->hasCharges())
		subType = item->getSubType();
 
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), subType, false);
 
	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

And remplace it with this

Code:
void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), -1);
 
	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

and should work after compile, ATTENTION, that c++ code what taken from the limos thread and was made by ahmed30, no credits for me
 
I knew that, but I hopefully was waiting for another answer.
dooh, seems I have to start to learn about compiling, good luck to me :D
Thank you all for your help and patience!
 
He mean that you need to edit sources mate, and limus gave you a link, you should read, i will post you the answer

i think that you have the sources and know how to compile

Go to game.cpp and search this

Code:
void Game::showHotkeyUseMessage(Player* player, Item* item)
{
    int32_t subType = -1;
    if(item->hasSubType() && !item->hasCharges())
        subType = item->getSubType();
 
    const ItemType& it = Item::items[item->getID()];
    uint32_t count = player->__getItemTypeCount(item->getID(), subType, false);
 
    char buffer[40 + it.name.size()];
    if(count == 1)
        sprintf(buffer, "Using the last %s...", it.name.c_str());
    else
        sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
    player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

And remplace it with this

Code:
void Game::showHotkeyUseMessage(Player* player, Item* item)
{
    const ItemType& it = Item::items[item->getID()];
    uint32_t count = player->__getItemTypeCount(item->getID(), -1);
 
    char buffer[40 + it.name.size()];
    if(count == 1)
        sprintf(buffer, "Using the last %s...", it.name.c_str());
    else
        sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
    player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

and should work after compile, ATTENTION, that c++ code what taken from the limos thread and was made by ahmed30, no credits for me
It doesn't work with autostacking script.
 
Back
Top