• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Potions with charges/unlimited!

I put up and say this..

[06/02/2010 21:56:44] data/actions/scripts/liquids/potions.lua:98: attempt to call global 'getItemAttribute' (a nil value)
[06/02/2010 21:56:44] stack traceback:
[06/02/2010 21:56:44] data/actions/scripts/liquids/potions.lua:98: in function <data/actions/scripts/liquids/potions.lua:30>

[06/02/2010 21:56:45] Lua Script Error: [Action Interface]
[06/02/2010 21:56:45] data/actions/scripts/liquids/potions.lua:eek:nUse

[06/02/2010 21:56:45] data/actions/scripts/liquids/potions.lua:98: attempt to call global 'getItemAttribute' (a nil value)
[06/02/2010 21:56:45] stack traceback:
[06/02/2010 21:56:45] data/actions/scripts/liquids/potions.lua:98: in function <data/actions/scripts/liquids/potions.lua:30>

[06/02/2010 21:56:46] Lua Script Error: [Action Interface]
[06/02/2010 21:56:46] data/actions/scripts/liquids/potions.lua:eek:nUse

[06/02/2010 21:56:46] data/actions/scripts/liquids/potions.lua:98: attempt to call global 'getItemAttribute' (a nil value)
[06/02/2010 21:56:46] stack traceback:
[06/02/2010 21:56:46] data/actions/scripts/liquids/potions.lua:98: in function <data/actions/scripts/liquids/potions.lua:30>
 
Lua:
  local aidd =
 {
--CHARGES = (max - min) -> (10911 - 10901) = 10 -> Charges = 10!!!
  min = 10901,
   max = 10911
    }
     if item.actionid < aidd.min then
      doSetItemActionId(item.uid, aidd.min)
       elseif item.actionid >= aidd.min and item.actionid <= aidd.max then
      doSetItemActionId(item.uid, getItemAttribute(item.uid, "actionid")+1)
     elseif item.actionid >= aidd.max then
    doTransformItem(item.uid, potion.empty)
   return TRUE
  end
 return true
end

What server version do you use?
 
Last edited:
Nice code...worked for me - actually gave 13 charges on pots...

However there are a couple of things...

1. It always says "you are using the last potion" - so who knows how many potions you have or when you are about to run out. Is there way to make it show how many charges or potions are remaining on use?

2. Is it possible to keep the charges - but have it throw the bottle away after ALL charges are used?

Rep given for the inital code...

Thanks!
 
1. It always says "you are using the last potion" - so who knows how many potions you have or when you are about to run out. Is there way to make it show how many charges or potions are remaining on use?

Yes, SourceEdit!

2. Is it possible to keep the charges - but have it throw the bottle away after ALL charges are used?

Didn't get that...
 
Lua:
  local aidd =
 {
--CHARGES = (max - min) -> (10911 - 10901) = 10 -> Charges = 10!!!
  min = 10901,
   max = 10911
    }
     if item.actionid < aidd.min then
      doSetItemActionId(item.uid, aidd.min)
       elseif item.actionid >= aidd.min and item.actionid <= aidd.max then
      doSetItemActionId(item.uid, getItemAttribute(item.uid, "actionid")+1)
     elseif item.actionid >= aidd.max then
    doRemoveItem(item.uid)--<---Just changed the line
   return TRUE
  end
 return true
end
Sidenote: Nope there's no easier way, atleast that i know, maybe someone else
got an idea.
 
Last edited:
I use 0.3.5


[06/02/2010 23:51:50] Lua Script Error: [Action Interface]
[06/02/2010 23:51:50] data/actions/scripts/liquids/potions.lua:eek:nUse

[06/02/2010 23:51:50] data/actions/scripts/liquids/potions.lua:98: attempt to call global 'getItemAttribute' (a nil value)
[06/02/2010 23:51:50] stack traceback:
[06/02/2010 23:51:50] data/actions/scripts/liquids/potions.lua:98: in function <data/actions/scripts/liquids/potions.lua:30>

[06/02/2010 23:51:51] Lua Script Error: [Action Interface]
[06/02/2010 23:51:51] data/actions/scripts/liquids/potions.lua:eek:nUse

[06/02/2010 23:51:51] data/actions/scripts/liquids/potions.lua:98: attempt to call global 'getItemAttribute' (a nil value)
[06/02/2010 23:51:51] stack traceback:
[06/02/2010 23:51:51] data/actions/scripts/liquids/potions.lua:98: in function <data/actions/scripts/liquids/potions.lua:30>

[06/02/2010 23:51:52] Lua Script Error: [Action Interface]
[06/02/2010 23:51:52] data/actions/scripts/liquids/potions.lua:eek:nUse

[06/02/2010 23:51:52] data/actions/scripts/liquids/potions.lua:98: attempt to call global 'getItemAttribute' (a nil value)
[06/02/2010 23:51:52] stack traceback:
[06/02/2010 23:51:52] data/actions/scripts/liquids/potions.lua:98: in function <data/actions/scripts/liquids/potions.lua:30>
 
I am using TFS 0.3.6pl1.

Can you explain how I need to change the source code in order to have it show how many charges are remaining on these potions as well as for my amulet of loss?

Greatly appreciated and Rep given on those who have helped me so far.
 
FIXED, with source edit though :S

For all those who cannot execute the "setItemAttribute / getItemAttribute" functions!


If you want that the script works properly, then do this:

Open up your luascript.cpp and paste this:

Code:
    //getItemAttr(uid, attr)
	lua_register(m_luaState, "getItemAttr", LuaScriptInterface::luaGetItemAttribute);

    //setItemAttr(uid, attr)
	lua_register(m_luaState, "setItemAttr", LuaScriptInterface::luaSetItemAttribute);

also this:
Code:
int32_t LuaScriptInterface::luaGetItemAttribute(lua_State *L) //by Kratos
{
    //getItemAttr(uid, val)
    std::string attr = popString(L);
    uint32_t uid = popNumber(L);
    
    ScriptEnviroment* env = getScriptEnv();
    
    Item* item = env->getItemByUID(uid);
    
    if(!item)
    {
        reportErrorFunc(getErrorDesc(LUA_ERROR_ITEM_NOT_FOUND));
        lua_pushboolean(L, false);
        return 1;
    }
  ///////////////////////////////////// string:
    if(attr == "name")
    {
    lua_pushstring(L, item->getName().c_str());
    return 1;
    }  

    if(attr == "pluralname")
    {
    lua_pushstring(L, item->getPluralName().c_str());
    return 1;
    }     

    if(attr == "specialdescr")
    {
    lua_pushstring(L, item->getSpecialDescription().c_str());
    return 1;        
    }
 
    if(attr == "text")
    {
    lua_pushstring(L, item->getText().c_str());
    return 1;
    }
    
    if(attr == "writer")
    {
    lua_pushstring(L, item->getWriter().c_str());
    return 1;
    }
  ///////////////////////////////////// int:  
    if(attr == "itemid")
    {
    lua_pushnumber(L, item->getID());
    return 1;
    }
    
    if(attr == "aid")
    {
    lua_pushnumber(L, item->getActionId());
    return 1;
    }
    
    if(attr == "uid")
    {
    lua_pushnumber(L, item->getUniqueId());
    return 1;
    }
    
    if(attr == "charges")
    {
    lua_pushnumber(L, item->getCharges());
    return 1;
    }
    
    if(attr == "fluidtype")
    {
    lua_pushnumber(L, item->getFluidType());
    return 1;
    }
    
    if(attr == "duration")
    {
    lua_pushnumber(L, item->getDuration());
    return 1;
    }
    
    if(attr == "dduration")
    {
    lua_pushnumber(L, item->getDefaultDuration());
    return 1;
    }
   
    if(attr == "throw_range")
    {
    lua_pushnumber(L, item->getThrowRange());
    return 1;
    }
    
    if(attr == "shoot_range")
    {
    lua_pushnumber(L, item->getShootRange());
    return 1;
    }
    
    if(attr == "atk")
    {
    lua_pushnumber(L, item->getAttack());
    return 1;
    }
    
    if(attr == "arm")
    {
    lua_pushnumber(L, item->getArmor());
    return 1;
    }
    
    if(attr == "def")
    {
    lua_pushnumber(L, item->getDefense());
    return 1;
    }   
    
        
    if(attr == "slot_position")
    {
    if(item->getSlotPosition() & SLOTP_NECKLACE)
    lua_pushnumber(L,1);    
    if(item->getSlotPosition() & SLOTP_HEAD)
    lua_pushnumber(L,2);
    if(item->getSlotPosition() & SLOTP_BACKPACK)
    lua_pushnumber(L,3);
    if(item->getSlotPosition() & SLOTP_LEFT)
    lua_pushnumber(L,4);
    if(item->getSlotPosition() & SLOTP_ARMOR)
    lua_pushnumber(L,5);
    if(item->getSlotPosition() & SLOTP_RIGHT)
    lua_pushnumber(L,6);
    if(item->getSlotPosition() & SLOTP_RING)
    lua_pushnumber(L,7);
    if(item->getSlotPosition() & SLOTP_LEGS)
    lua_pushnumber(L,8);
    if(item->getSlotPosition() & SLOTP_AMMO)
    lua_pushnumber(L,9);
    if(item->getSlotPosition() & SLOTP_FEET)
    lua_pushnumber(L,10);
    return 1;
    }
    
    if(attr == "hitchance")
    {
    lua_pushnumber(L, item->getHitChance());
    return 1;
    }
    
    if(attr == "maxwritelen")
    {
    lua_pushnumber(L, item->getMaxWriteLength());
    return 1;
    }
    
    if(attr == "count")
    {
    lua_pushnumber(L, item->getItemCount());
    return 1;
    }   
    
    
       
 ///////////////////////////////////////////// boolean:
 
    if(attr == "ispushable")
    {
    lua_pushboolean(L, item->isPushable());
    return 1;        
    }   

    if(attr == "isreadable")
    {
    lua_pushboolean(L, item->isReadable());
    return 1;        
    }  
    
    if(attr == "iscanwritetext")
    {
    lua_pushboolean(L, item->canWriteText());
    return 1;        
    }  
    
    if(attr == "isblocking")
    {
    lua_pushboolean(L, item->isBlocking());
    return 1;        
    }  
    
    if(attr == "isstackable")
    {
    lua_pushboolean(L, item->isStackable());
    return 1;        
    }      
    
    if(attr == "isrune")
    {
    lua_pushboolean(L, item->isRune());
    return 1;        
    }  
    
    if(attr == "isfluidcont")
    {
    lua_pushboolean(L, item->isFluidContainer());
    return 1;        
    }   
    
    if(attr == "isalwaysontop")
    {
    lua_pushboolean(L, item->isAlwaysOnTop());
    return 1;        
    }  
    
    if(attr == "isgroundtile")
    {
    lua_pushboolean(L, item->isGroundTile());
    return 1;        
    }  
    
    if(attr == "issplash")
    {
    lua_pushboolean(L, item->isSplash());
    return 1;        
    }      
    
    if(attr == "ismagicfield")
    {
    lua_pushboolean(L, item->isMagicField());
    return 1;        
    }  
    
    if(attr == "isnotmoveable")
    {
    lua_pushboolean(L, item->isNotMoveable());
    return 1;        
    }       
    
    if(attr == "ispickupable")
    {
    lua_pushboolean(L, item->isPickupable());
    return 1;        
    }  
    
    if(attr == "isweapon")
    {
    lua_pushboolean(L, item->isWeapon());
    return 1;        
    }  
    
  
     
       
        
    if(attr == "isrotateable")
    {
    lua_pushboolean(L, item->isRoteable());
    return 1;        
    }  
    
    if(attr == "isdoor")
    {
    lua_pushboolean(L, item->isDoor());
    return 1;        
    }          
    
    if(attr == "isbed")
    {
    lua_pushboolean(L, item->isBed());
    return 1;        
    }          
 
    if(attr == "iskey")
    {
    lua_pushboolean(L, item->isKey());
    return 1;        
    }     
    
        
    
           
         
   
    
    std::cout << "[LuaScriptInterface::luaGetItemAttribute]: invalid item attribute." << std::endl;  

}

int32_t LuaScriptInterface::luaSetItemAttribute(lua_State *L) //by Kratos
{
    //setItemAttr(uid, "attr", val)
    
    uint32_t intval = popNumber(L);
    std::string attr = popString(L);
    ScriptEnviroment* env = getScriptEnv();
    
    Item* item = env->getItemByUID(popNumber(L));

    if(!item)
    {
        reportErrorFunc(getErrorDesc(LUA_ERROR_ITEM_NOT_FOUND));
        lua_pushboolean(L, false);
        return 1;
    }

    
   //////////////////////////////////// int:
                                        
    if(attr == "aid")
    {
    item->setActionId(intval);
    return 1;        
    }
    
    if(attr == "uid")
    {
    item->setUniqueId(intval);
    return 1;        
    }
    
      
    if(attr == "fluidtype")
    {
    item->setFluidType(intval);
    return 1;        
    }

    if(attr == "duration")
    {
    item->setDuration(intval);
    return 1;        
    }
  
    if(attr == "dduration")
    {
    item->setDefaultDuration();
    return 1;        
    }  
    
    if(attr == "itemcount")
    {
    item->setItemCount(intval);
    return 1;        
    }
    
  
 
    std::cout << "[LuaScriptInterface::luaSetItemAttribute]: invalid item attribute." << std::endl;                                     
    return 1;
}

and finally in luascript.h this:
Code:
static int32_t luaGetItemAttribute(lua_State *L); //by kratos
static int32_t luaSetItemAttribute(lua_State *L); //by kratos

ALL CREDITS TO KRATOS @ OTFANS!
I JUST MODIFIED THE SCRIPT TO THE
NEWER TFS VERSIONS!


Finally add this in your potions.lua on the bottom:

Lua:
local aidd = 
 {
  min = 10901,
   max = 10911
    }
     if item.actionid < aidd.min then
      doSetItemActionId(item.uid, "aid" ,aidd.min)
       elseif item.actionid >= aidd.min and item.actionid <= aidd.max then
	   setItemAttr(item.uid, "aid", getItemAttr(item.uid, "aid")+1)
     elseif item.actionid >= aidd.max then
    doTransformItem(item.uid, potion.empty)
   return TRUE
  end
 return true
end
 
Last edited:
You can now use:
Lua:
doSetItemActionId(item.uid, "aid", value)
or
Lua:
setItemAttr(item.uid, "aid", value)

To get the current value:
Lua:
getItemAttr(item.uid, "key", value)

working keys:

Code:
getItemAttr(uid, "attr")

strings:

attr = "name" 		//returns itemname
attr = "pluralname" 	//returns plural name if available
attr = "text" 		//returns text if available (e.g from letter)
attr = "writer"		//returns writer if available (e.g. from letter)

integers:

attr = "itemid"		returns itemid of the item
attr = "aid"		returns actionid of the item
attr = "uid"		returns uniqueid of the item
attr = "charges"	returns charges if the item has charges type
attr = "fluidtype"	returns the fluidtype if the item is a fluidtype
attr = "duration"	returns the actual duration (e.g. timeleft on a life-ring)
attr = "dduration"	returns the max default duration (e.g. maxtime of a life-ring)
attr = "throw_range"	returns the throw_range if the item is a distance weapon
attr = "shoot_range"	returns the shoot range if the item is a projectile
attr = "atk"		returns the atk if the item is a weapon
attr = "def"		returns the def if the item is a weapon or shield
attr = "arm"		returns the arm of the item is a piece of armory
attr = "extr_def"	returns the extra def
attr = "slot_position"	returns the slot position the item is currently (0 = amulet,/ 1 = head,/ 2 = backpack,/ 3 = left hand,/ 4 = body,/ 5 = right hand,/ 6 = ring,/ 7 = legs,/ 8 = arrow_slow,/ 9 = boots, / 100+ = somewhere in backpack)
attr = "hitchance"	returns the hitchance of a weapon
attr = "maxwritelen"	returns the maxwritelength if the item is writeable

booleans:

attr = "ispushable"	returns wether if an item is pushable or not
attr = "isreadable"	returns wether if an item is readable or not
attr = "iscanwritetext"	returns wether if an item can be written on or not
attr = "isblocking"	returns wether if the item is blocking on the map or not
attr = "isstackable"	returns wether if the item stackable or not
attr = "isrune"		returns wether if the item is a rune or not
attr = "isfluidcont" 	returns wether if the item is a fluidcontainer or not
attr = "isalwaysontop"	returns wether if the item is always on top or not
attr = "isgroundtile"	returns wether if the item is a ground tile or not
attr = "issplash"	returns wether if the item is a splash item or not
attr = "ismagicfield"	returns wether if the item is a magic field or not
attr = "isnotmoveable"	returns wether if the item is moveable or not
attr = "ispickupable"	returns wether if the item is pickupable or not
attr = "isweapon"	returns wether if the item is a weapon or not
attr = "isuseable"	returns wether if the item is useable or not
attr = "ishangable"	returns wether if the item is a wall hangable or not
attr = "isrotateable"	returns wether if the item is rotateable or not
attr = "isdoor"		returns wether if the item is a door or not
attr = "isbed"		returns wether if the item is a bed or not
attr = "iskey"		returns wether if the item is a key or not
__________________________________________________________________________________________________________________

setItemAttr(uid, "attr", "val")

strings:

attr = "specialdescr"	sets a new special description to the item
attr = "text"		sets a new text on the item if the item is writeable (e.g. from letter)
attr = "setwriter"	sets a new writer on the item if the item is writeable (e.g. from letter)

integers:

attr = "aid" 		sets a new action id on the item
attr = "uid"		sets a new unique id on the item
attr = "charges"	sets a new ammount of charges on the item
attr = "fluidtype"	sets a new fluidtype on the item if it is a fluidcontainer
attr = "duration"	sets a new duration time on the item
attr = "dduration"	sets the default duration on the item (no "val" required, parse empty string!)
attr = "itemcount"	sets a new count on the item
 
Last edited:
FIXED, with source edit though :S

For all those who cannot execute the "setItemAttribute / getItemAttribute" functions!


If you want that the script works properly, then do this:

Open up your luascript.cpp and paste this:

Code:
    //getItemAttr(uid, attr)
	lua_register(m_luaState, "getItemAttr", LuaScriptInterface::luaGetItemAttribute);

    //setItemAttr(uid, attr)
	lua_register(m_luaState, "setItemAttr", LuaScriptInterface::luaSetItemAttribute);

also this:
Code:
int32_t LuaScriptInterface::luaGetItemAttribute(lua_State *L) //by Kratos
{
    //getItemAttr(uid, val)
    std::string attr = popString(L);
    uint32_t uid = popNumber(L);
    
    ScriptEnviroment* env = getScriptEnv();
    
    Item* item = env->getItemByUID(uid);
    
    if(!item)
    {
        reportErrorFunc(getErrorDesc(LUA_ERROR_ITEM_NOT_FOUND));
        lua_pushboolean(L, false);
        return 1;
    }
  ///////////////////////////////////// string:
    if(attr == "name")
    {
    lua_pushstring(L, item->getName().c_str());
    return 1;
    }  

    if(attr == "pluralname")
    {
    lua_pushstring(L, item->getPluralName().c_str());
    return 1;
    }     

    if(attr == "specialdescr")
    {
    lua_pushstring(L, item->getSpecialDescription().c_str());
    return 1;        
    }
 
    if(attr == "text")
    {
    lua_pushstring(L, item->getText().c_str());
    return 1;
    }
    
    if(attr == "writer")
    {
    lua_pushstring(L, item->getWriter().c_str());
    return 1;
    }
  ///////////////////////////////////// int:  
    if(attr == "itemid")
    {
    lua_pushnumber(L, item->getID());
    return 1;
    }
    
    if(attr == "aid")
    {
    lua_pushnumber(L, item->getActionId());
    return 1;
    }
    
    if(attr == "uid")
    {
    lua_pushnumber(L, item->getUniqueId());
    return 1;
    }
    
    if(attr == "charges")
    {
    lua_pushnumber(L, item->getCharges());
    return 1;
    }
    
    if(attr == "fluidtype")
    {
    lua_pushnumber(L, item->getFluidType());
    return 1;
    }
    
    if(attr == "duration")
    {
    lua_pushnumber(L, item->getDuration());
    return 1;
    }
    
    if(attr == "dduration")
    {
    lua_pushnumber(L, item->getDefaultDuration());
    return 1;
    }
   
    if(attr == "throw_range")
    {
    lua_pushnumber(L, item->getThrowRange());
    return 1;
    }
    
    if(attr == "shoot_range")
    {
    lua_pushnumber(L, item->getShootRange());
    return 1;
    }
    
    if(attr == "atk")
    {
    lua_pushnumber(L, item->getAttack());
    return 1;
    }
    
    if(attr == "arm")
    {
    lua_pushnumber(L, item->getArmor());
    return 1;
    }
    
    if(attr == "def")
    {
    lua_pushnumber(L, item->getDefense());
    return 1;
    }   
    
        
    if(attr == "slot_position")
    {
    if(item->getSlotPosition() & SLOTP_NECKLACE)
    lua_pushnumber(L,1);    
    if(item->getSlotPosition() & SLOTP_HEAD)
    lua_pushnumber(L,2);
    if(item->getSlotPosition() & SLOTP_BACKPACK)
    lua_pushnumber(L,3);
    if(item->getSlotPosition() & SLOTP_LEFT)
    lua_pushnumber(L,4);
    if(item->getSlotPosition() & SLOTP_ARMOR)
    lua_pushnumber(L,5);
    if(item->getSlotPosition() & SLOTP_RIGHT)
    lua_pushnumber(L,6);
    if(item->getSlotPosition() & SLOTP_RING)
    lua_pushnumber(L,7);
    if(item->getSlotPosition() & SLOTP_LEGS)
    lua_pushnumber(L,8);
    if(item->getSlotPosition() & SLOTP_AMMO)
    lua_pushnumber(L,9);
    if(item->getSlotPosition() & SLOTP_FEET)
    lua_pushnumber(L,10);
    return 1;
    }
    
    if(attr == "hitchance")
    {
    lua_pushnumber(L, item->getHitChance());
    return 1;
    }
    
    if(attr == "maxwritelen")
    {
    lua_pushnumber(L, item->getMaxWriteLength());
    return 1;
    }
    
    if(attr == "count")
    {
    lua_pushnumber(L, item->getItemCount());
    return 1;
    }   
    
    
       
 ///////////////////////////////////////////// boolean:
 
    if(attr == "ispushable")
    {
    lua_pushboolean(L, item->isPushable());
    return 1;        
    }   

    if(attr == "isreadable")
    {
    lua_pushboolean(L, item->isReadable());
    return 1;        
    }  
    
    if(attr == "iscanwritetext")
    {
    lua_pushboolean(L, item->canWriteText());
    return 1;        
    }  
    
    if(attr == "isblocking")
    {
    lua_pushboolean(L, item->isBlocking());
    return 1;        
    }  
    
    if(attr == "isstackable")
    {
    lua_pushboolean(L, item->isStackable());
    return 1;        
    }      
    
    if(attr == "isrune")
    {
    lua_pushboolean(L, item->isRune());
    return 1;        
    }  
    
    if(attr == "isfluidcont")
    {
    lua_pushboolean(L, item->isFluidContainer());
    return 1;        
    }   
    
    if(attr == "isalwaysontop")
    {
    lua_pushboolean(L, item->isAlwaysOnTop());
    return 1;        
    }  
    
    if(attr == "isgroundtile")
    {
    lua_pushboolean(L, item->isGroundTile());
    return 1;        
    }  
    
    if(attr == "issplash")
    {
    lua_pushboolean(L, item->isSplash());
    return 1;        
    }      
    
    if(attr == "ismagicfield")
    {
    lua_pushboolean(L, item->isMagicField());
    return 1;        
    }  
    
    if(attr == "isnotmoveable")
    {
    lua_pushboolean(L, item->isNotMoveable());
    return 1;        
    }       
    
    if(attr == "ispickupable")
    {
    lua_pushboolean(L, item->isPickupable());
    return 1;        
    }  
    
    if(attr == "isweapon")
    {
    lua_pushboolean(L, item->isWeapon());
    return 1;        
    }  
    
  
     
       
        
    if(attr == "isrotateable")
    {
    lua_pushboolean(L, item->isRoteable());
    return 1;        
    }  
    
    if(attr == "isdoor")
    {
    lua_pushboolean(L, item->isDoor());
    return 1;        
    }          
    
    if(attr == "isbed")
    {
    lua_pushboolean(L, item->isBed());
    return 1;        
    }          
 
    if(attr == "iskey")
    {
    lua_pushboolean(L, item->isKey());
    return 1;        
    }     
    
        
    
           
         
   
    
    std::cout << "[LuaScriptInterface::luaGetItemAttribute]: invalid item attribute." << std::endl;  

}

int32_t LuaScriptInterface::luaSetItemAttribute(lua_State *L) //by Kratos
{
    //setItemAttr(uid, "attr", val)
    
    uint32_t intval = popNumber(L);
    std::string attr = popString(L);
    ScriptEnviroment* env = getScriptEnv();
    
    Item* item = env->getItemByUID(popNumber(L));

    if(!item)
    {
        reportErrorFunc(getErrorDesc(LUA_ERROR_ITEM_NOT_FOUND));
        lua_pushboolean(L, false);
        return 1;
    }

    
   //////////////////////////////////// int:
                                        
    if(attr == "aid")
    {
    item->setActionId(intval);
    return 1;        
    }
    
    if(attr == "uid")
    {
    item->setUniqueId(intval);
    return 1;        
    }
    
      
    if(attr == "fluidtype")
    {
    item->setFluidType(intval);
    return 1;        
    }

    if(attr == "duration")
    {
    item->setDuration(intval);
    return 1;        
    }
  
    if(attr == "dduration")
    {
    item->setDefaultDuration();
    return 1;        
    }  
    
    if(attr == "itemcount")
    {
    item->setItemCount(intval);
    return 1;        
    }
    
  
 
    std::cout << "[LuaScriptInterface::luaSetItemAttribute]: invalid item attribute." << std::endl;                                     
    return 1;
}
where i add that ? ;D
 
o_O, you have to read the text. There won't be a popup message saying "Hello USER, now we're going to paste a text into a file!"

Is it this confusing?
 
dissappear: Something completly be gone, not there anymore, gone!
Transforming: Change its form, from a to b, still existing!

Dissapearing potions: Removed from the backpack.
Transforming potions: From full vail, into empty vail.

State it clearly.
Use a translator if neccessary.

geekz
 
Is it possible to have numbers for how many there is left ? like in for exampel Scarab coins, there is a white number how many there is left.
 
Back
Top