[ 1%] Building CXX object CMakeFiles/tfs.dir/src/actions.cpp.o
/home/ot/src/actions.cpp: In member function ‘ReturnValue Actions::internalUseItem(Player*, const Position&, uint8_t, Item*, bool)’:
/home/ot/src/actions.cpp:412:55: error: ‘class Player’ has no member named ‘autoLootList’
if (player->canOpenCorpse(corpseOwner) && player->autoLootList.size() != 0) {
^
/home/giveria/src/actions.cpp:415:29: error: ‘class Player’ has no member named ‘getItemFromAutoLoot’
if (player->getItemFromAutoLoot(item->getID())) {
^
CMakeFiles/tfs.dir/build.make:119: recipe for target 'CMakeFiles/tfs.dir/src/actions.cpp.o' failed
make[2]: *** [CMakeFiles/tfs.dir/src/actions.cpp.o] Error 1
CMakeFiles/Makefile2:122: recipe for target 'CMakeFiles/tfs.dir/all' failed
make[1]: *** [CMakeFiles/tfs.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
If somebody want, I can teach how to make a "Loot" option when you ctrl + click on an item to make it automatic.
But you will need OTClient for that. The only thing it does is "say without showing" the talkactions of the system.
View attachment 39988
And you can use this knowledge to do many creative things with talkactions.
That would be nice. Someday I'll try and if I make it I'll post it here hahaCould you do this by double clicking on an item?
Then he would be moved to a backpack
In file included from /home/server/src/game.h:32:0,
from /home/server/src/actions.cpp:28:
/home/server/src/player.h:1464:8: error: ‘set’ in namespace ‘std’ does not name a template type
std::set<uint32_t> autoLootList;
^~~
/home/server/src/actions.cpp: In member function ‘ReturnValue Actions::internalU seItem(Player*, const Position&, uint8_t, Item*, bool)’:
/home/server/src/actions.cpp:419:55: error: ‘class Player’ has no member named ‘ autoLootList’
if (player->canOpenCorpse(corpseOwner) && player->autoLootList.size() != 0) {
^~~~~~~~~~~~
/home/server/src/actions.cpp:464:22: error: qualified-id in declaration before ‘ (’ token
bool Actions::useItem(Player* player, const Position& pos, uint8_t index, Item* item, bool isHotkey)
^
/home/server/src/actions.cpp:480:24: error: qualified-id in declaration before ‘ (’ token
bool Actions::useItemEx(Player* player, const Position& fromPos, const Position & toPos,
^
/home/server/src/actions.cpp:517:35: error: qualified-id in declaration before ‘ (’ token
void Actions::showUseHotkeyMessage(Player* player, const Item* item, uint32_t c ount)
^
/home/server/src/actions.cpp:532:34: error: expected primary-expression before ‘ *’ token
Action::Action(LuaScriptInterface* interface) :
^
/home/server/src/actions.cpp:532:36: error: ‘interface’ was not declared in this scope
Action::Action(LuaScriptInterface* interface) :
^~~~~~~~~
/home/server/src/actions.cpp:532:36: note: suggested alternative: ‘iface’
Action::Action(LuaScriptInterface* interface) :
^~~~~~~~~
iface
/home/server/src/actions.cpp:532:45: error: cannot call constructor ‘Action::Act ion’ directly [-fpermissive]
Action::Action(LuaScriptInterface* interface) :
^
/home/server/src/actions.cpp:532:45: note: for a function-style cast, remove the redundant ‘::Action’
/home/server/src/actions.cpp:535:28: error: qualified-id in declaration before ‘ (’ token
bool Action::configureEvent(const pugi::xml_node& node)
^
/home/server/src/actions.cpp:555:11: error: expected identifier before ‘{’ token
namespace {
^
/home/server/src/actions.cpp:558:1: error: a function-definition is not allowed here before ‘{’ token
{
^
/home/server/src/actions.cpp:568:1: error: a function-definition is not allowed here before ‘{’ token
{
^
/home/server/src/actions.cpp:597:26: error: qualified-id in declaration before ‘ (’ token
bool Action::loadFunction(const pugi::xml_attribute& attr, bool isScripted)
^
/home/server/src/actions.cpp:617:39: error: qualified-id in declaration before ‘ (’ token
std::string Action::getScriptEventName() const
^
/home/server/src/actions.cpp:622:37: error: qualified-id in declaration before ‘ (’ token
ReturnValue Action::canExecuteAction(const Player* player, const Position& toPo s)
^
/home/server/src/actions.cpp:631:25: error: qualified-id in declaration before ‘ (’ token
Thing* Action::getTarget(Player* player, Creature* targetCreature, const Positi on& toPosition, uint8_t toStackPos) const
^
/home/server/src/actions.cpp:631:32: error: expected primary-expression before ‘ *’ token
Thing* Action::getTarget(Player* player, Creature* targetCreature, const Positi on& toPosition, uint8_t toStackPos) const
^
/home/server/src/actions.cpp:631:50: error: expected primary-expression before ‘ *’ token
Thing* Action::getTarget(Player* player, Creature* targetCreature, const Positi on& toPosition, uint8_t toStackPos) const
^
/home/server/src/actions.cpp:631:52: error: ‘targetCreature’ was not declared in this scope
Thing* Action::getTarget(Player* player, Creature* targetCreature, const Positi on& toPosition, uint8_t toStackPos) const
^~~~~~~~~~~~~~
/home/server/src/actions.cpp:631:52: note: suggested alternative: ‘_ZTI8Creature ’
Thing* Action::getTarget(Player* player, Creature* targetCreature, const Positi on& toPosition, uint8_t toStackPos) const
^~~~~~~~~~~~~~
_ZTI8Creature
/home/server/src/actions.cpp:631:68: error: expected primary-expression before ‘ const’
Thing* Action::getTarget(Player* player, Creature* targetCreature, const Positi on& toPosition, uint8_t toStackPos) const
^~~~~
/home/server/src/actions.cpp:631:104: error: expected primary-expression before ‘toStackPos’
ayer, Creature* targetCreature, const Position& toPosition, uint8_t toStackPos) const
^~~~~~~~~~
/home/server/src/actions.cpp:639:24: error: qualified-id in declaration before ‘ (’ token
bool Action::executeUse(Player* player, Item* item, const Position& fromPositio n, Thing* target, const Position& toPosition, bool isHotkey)
^
/home/server/src/actions.cpp:665:1: error: expected ‘}’ at end of input
}
^
/home/server/src/actions.cpp:665:1: error: control reaches end of non-void funct ion [-Werror=return-type]
}
^
cc1plus: all warnings being treated as errors
CMakeFiles/tfs.dir/build.make:126: recipe for target 'CMakeFiles/tfs.dir/src/act ions.cpp.o' failed
make[2]: *** [CMakeFiles/tfs.dir/src/actions.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/tfs.dir/all' failed
make[1]: *** [CMakeFiles/tfs.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
hey @login12 its not working with items that come inside bags on monsters ,can you fix it?and thanks for this great system =)
Thanks for report. I will update this script soon and fix it.
if (corpseOwner != 0 && !player->canOpenCorpse(corpseOwner)) {
return RETURNVALUE_YOUARENOTTHEOWNER;
} else {
if (player->canOpenCorpse(corpseOwner) && player->autoLootList.size() != 0) {
if (player->getCapacity() > 100 * 100) { //Minimum of Capacity for autoloot works. (100 CAP)
for (Item* itemloot : container->getItemList()) {
if (Container* containerbag = itemloot->getContainer()) {
for (Item* bagitem : containerbag->getItemList()) {
if (player->getItemFromAutoLoot(bagitem->getID())) {
std::ostringstream msgAutoLoot;
msgAutoLoot << "You looted a " << bagitem->getItemCount() << "x " << bagitem->getName() << ".";
g_game.internalMoveItem(containerbag, player, CONST_SLOT_WHEREEVER, bagitem, bagitem->getItemCount(), nullptr);
player->sendTextMessage(MESSAGE_INFO_DESCR, msgAutoLoot.str());
}
}
}
if (player->getItemFromAutoLoot(itemloot->getID())) {
std::ostringstream msgAutoLoot;
msgAutoLoot << "You looted a " << itemloot->getItemCount() << "x " << itemloot->getName() << ".";
g_game.internalMoveItem(container, player, CONST_SLOT_WHEREEVER, itemloot, itemloot->getItemCount(), nullptr);
player->sendTextMessage(MESSAGE_INFO_DESCR, msgAutoLoot.str());
}
}
} else {
player->sendTextMessage(MESSAGE_INFO_DESCR, "Sorry, you don't have enough capacity to use auto loot, so it has been disabled. (100+ capacity is required)");
}
}
}
corpse > backpack > backpack > item
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Auto Loot commands (items are automatically moved to your bp if you open monster corpse):"..'\n'.."!addloot add, nameItem - add item to auto loot by name"..'\n'.."!autoloot remove, itemName - remove item from auto loot by name"..'\n'.."!autoloot list - list your current auto loot items")
Somebody fix that?Bug if you have no backpack, the item is taken but goes nowhere. Need to add a check if they have a container.
Lua Script Error: [Scripts Interface]
/home/global/data/scripts/talkactions/player/autoloot.lua:callback
...global/data/scripts/talkactions/player/autoloot.lua:24: attempt to index a nil value
stack traceback:
[C]: in function '__index'
...global/data/scripts/talkactions/player/autoloot.lua:24: in function <...global/data/scripts/talkactions/player/autoloot.lua:3>
Lua Script Error: [Test Interface]
data/talkactions/scripts/autoloot.lua
LuaScriptInterface::luaCreateTalkaction(). TalkActions can only be registered in the Scripts interface.
stack traceback:
[C]: in function 'TalkAction'
data/talkactions/scripts/autoloot.lua:1: in main chunk
Lua Script Error: [Test Interface]
data/talkactions/scripts/autoloot.lua
data/talkactions/scripts/autoloot.lua:3: attempt to index local 'talk' (a nil value)
stack traceback:
[C]: in function '__newindex'
data/talkactions/scripts/autoloot.lua:3: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/autoloot.lua