• 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!

Compiling OTHire - Can't use potions on rope spot.

Extrodus

|| Blazera.net ||
Premium User
Joined
Dec 22, 2008
Messages
2,741
Solutions
7
Reaction score
542
Location
Canada
So if you try to use a potion on the rope up tile, it will splash on the ground instead of giving it to the player.

If anyone has any ideas on why this is happening please let me know. I have re-wrote the liquids.lua, and it still doesn't work.

Link to GitHub Project: https://github.com/TwistedScorpio/OTHire

Code:
-- heal exhaust --
local exhaust = createConditionObject(CONDITION_EXHAUST_POTION)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)

-- condition potion --
local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(poison, 4, 6000, -5)
addDamageCondition(poison, 5, 6000, -4)
addDamageCondition(poison, 6, 6000, -3)
addDamageCondition(poison, 10, 6000, -2)
addDamageCondition(poison, 36, 6000, -1)

-- condition drunk --
local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS , 60000)

-- local fluid types --
local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER  = 3
local TYPE_SLIME = 4
local TYPE_LEMONADE = 5
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_URINE = 13
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28

-- script function --
function onUse(cid, item, frompos, item2, topos)
    if(item.type == 0) then
        doPlayerSendCancel(cid, "You can not use this object.")
       
    elseif(item2.uid ~= cid) and (topos.stackpos > 0) and is (isMoveable(item2.uid) ~= TRUE) and (isCreature(item2.uid) ~= 1) then
        doPlayerSendCancel(cid, "There is not enough room.")
       
    elseif(isInArray(FLUID_CONTAINERS, item2.itemid) == TRUE) and (item2.type == TYPE_EMPTY) then
        doChangeTypeItem(item.uid, TYPE_EMPTY)
        doChangeTypeItem(item2.uid, item.type)
       
    elseif(topos.x == 65535) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
        if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
            doChangeTypeItem(item.uid, 0)
            splash = doCreateItem(2025, item.type, getThingPos(cid))
            doDecayItem(splash)
        else
            doPlayerSendCancel(cid, "There is not enough room.")
        end
       
    elseif(item2.itemid > 0) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
        if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
            doChangeTypeItem(item.uid, 0)
            splash = doCreateItem(2025, item.type, topos)
            if(isInArray(WATER_LAVA_SWAMP, item2.itemid) ~= TRUE) then
                doDecayItem(splash)
            end
        else
            doPlayerSendCancel(cid, "There is not enough room.")
        end
       
    elseif(frompos.x == 65535) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
        if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
            doChangeTypeItem(item.uid, 0)
            splash = doCreateItem(2025, item.type, getThingPos(cid))
            doDecayItem(splash)
        else
            doPlayerSendCancel(cid, "There is not enough room.")
        end
       
    else
        if isPlayer(cid) == TRUE then
            doChangeTypeItem(item.uid, 0)
            -- mana fluid --
            if(item.type == TYPE_MANA_FLUID) then
                new_mana = math.random(80, 160)
                doPlayerAddMana(cid, new_mana)
                doSendMagicEffect(topos, 12)
                doPlayerSay(cid, "Aaaah... +".. new_mana .."", 1)
                doAddCondition(cid, exhaust)
           
            -- life fluid --
            elseif(item.type == TYPE_LIFE_FLUID) then
                new_life = math.random(40, 80)
                doPlayerAddHealth(cid, new_life)
                doSendMagicEffect(topos, 12)
                doPlayerSay(cid, "Aaaah...", 1)
                doAddCondition(cid, exhaust)
               
            -- alcholic fluids --
            elseif(item.type == TYPE_BEER or item.type == TYPE_WINE or item.type == TYPE_RUM) then
                doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)
                doPlayerSay(cid, "Aah...", 1)
            elseif(item.type == TYPE_LEMONADE) then
                doPlayerSay(cid, "Mmmh.", 1)
            elseif(item.type == TYPE_SLIME or item.type == TYPE_SWAMP) then
                doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)
                doPlayerSay(cid, "Urgh!", 1)
            elseif(item.type == TYPE_OIL or item.type == TYPE_URINE) then
                doPlayerSay(cid, "Urgh!", 1)
            else
                doPlayerSay(cid, "Gulp.", 1)
            end
        end
    end
   
    -- fluids to use on ground types --
    if(item.type == 0) then
        if(item2.itemid >= 490 and item2.itemid <= 517
        or item2.itemid >= 618 and item2.itemid <= 629
        or item2.itemid == 1368 or item2.itemid == 1369
        or item2.itemid >= 4820 and item2.itemid <= 4825
        or item2.itemid >= 4828 and item2.itemid <= 4831
        or item2.itemid >= 4608 and item2.itemid <= 4666) then
            doChangeTypeItem(itemuid, TYPE_WATER)
        elseif item2.itemid == 103 then
            doChangeTypeItem(item.uid, TYPE_MUD)
        elseif item2.itemid >= 598 and item2.itemid < 601
        or item2.itemid == 1509
        or item2.itemid >= 518 and item2.itemid <= 529 then
            doChangeTypeItem(item.uid, TYPE_LAVA)
        elseif item2.itemid >= 351 and item2.itemid <= 355 then
            doChangeTypeItem(item.uid, TYPE_MUD)
        elseif item2.itemid >= 602 and item2.itemid <= 605
        or item2.itemid >= 4691 and item2.itemid <= 4755
        or item2.itemid == 4758 then
            doChangeTypeItem(item.uid, TYPE_SWAMP)
        elseif item2.itemid == 1771 then
            doChangeTypeItem(item.uid, TYPE_WATER)
        elseif item2.itemid == 1772 then
            doChangeTypeItem(item.uid, TYPE_BEER)
        elseif item2.itemid == 1773 then
            doChangeTypeItem(item.uid, TYPE_WINE)
        elseif item2.itemid == 1776 then
            doChangeTypeItem(item.uid, TYPE_LEMONADE)
        elseif(isInArray(NORMAL_CORPSE_STAGE_I, item2.itemid) == TRUE) then
            doChangeTypeItem(item.uid, TYPE_BLOOD)
        elseif(isInArray(SLIME_CORPSES, item2.itemid) == TRUE) then
            doChangeTypeItem(item.uid, TYPE_SLIME)
        elseif item2.itemid >= 371 and item2.itemid <= 382
        or item2.itemid >= 356 and item2.itemid <= 367 then
            doPlayerSendCancel(cid, "You cannot use this object.")
        end
    end
    return TRUE
end

If anyone see's the problem, I'd be forever in your debt. I personally feel it has to do with something in sources after rewriting the liquids.lua; but who knows.. definitely not me! Thanks in advance!

Regards,
Extrodus
 
Rope spots probably have a flag set to be top priority when using an item on a position.
If the position has a item with that flag the client will always send the stackpos of rope spot instead of a creature standing on the same tile.
Just guessing though.

You can check if item2.itemid is equal to the rope spot id and if so redirect the action to a creature on that tile.
 
No Comments on the actual script itself.

BUT! I still show you how to debug your own scripts to find out what is happening.
Try this:
Code:
-- heal exhaust --
local exhaust = createConditionObject(CONDITION_EXHAUST_POTION)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
-- condition potion --
local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(poison, 4, 6000, -5)
addDamageCondition(poison, 5, 6000, -4)
addDamageCondition(poison, 6, 6000, -3)
addDamageCondition(poison, 10, 6000, -2)
addDamageCondition(poison, 36, 6000, -1)
-- condition drunk --
local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS , 60000)
-- local fluid types --
local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER  = 3
local TYPE_SLIME = 4
local TYPE_LEMONADE = 5
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_URINE = 13
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
-- script function --
function onUse(cid, item, frompos, item2, topos)
   doCreatureSay(cid, "Fluid Script Start", 1) -- DEBUG CREATURESAY
  if(item.type == 0) then
     doCreatureSay(cid, "Empty Container", 1) -- DEBUG CREATURESAY
  doPlayerSendCancel(cid, "You can not use this object.")
 
  elseif(item2.uid ~= cid) and (topos.stackpos > 0) and is (isMoveable(item2.uid) ~= TRUE) and (isCreature(item2.uid) ~= 1) then
     doCreatureSay(cid, "Not Enough Room", 1) -- DEBUG CREATURESAY
  doPlayerSendCancel(cid, "There is not enough room.")
 
  elseif(isInArray(FLUID_CONTAINERS, item2.itemid) == TRUE) and (item2.type == TYPE_EMPTY) then
     doCreatureSay(cid, "Transfer To New Container", 1) -- DEBUG CREATURESAY
  doChangeTypeItem(item.uid, TYPE_EMPTY)
  doChangeTypeItem(item2.uid, item.type)
 
  elseif(topos.x == 65535) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
     doCreatureSay(cid, "Using item on another item in Container", 1) -- DEBUG CREATURESAY
  if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
  doChangeTypeItem(item.uid, 0)
  splash = doCreateItem(2025, item.type, getThingPos(cid))
  doDecayItem(splash)
  else
  doPlayerSendCancel(cid, "There is not enough room.")
  end
 
  elseif(item2.itemid > 0) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
     doCreatureSay(cid, "Using item on another item outside Container", 1) -- DEBUG CREATURESAY
  if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
  doChangeTypeItem(item.uid, 0)
  splash = doCreateItem(2025, item.type, topos)
  if(isInArray(WATER_LAVA_SWAMP, item2.itemid) ~= TRUE) then
  doDecayItem(splash)
  end
  else
  doPlayerSendCancel(cid, "There is not enough room.")
  end
 
  elseif(frompos.x == 65535) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
     doCreatureSay(cid, "Using item on another item in Container again (2nd time)?", 1) -- DEBUG CREATURESAY
  if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
  doChangeTypeItem(item.uid, 0)
  splash = doCreateItem(2025, item.type, getThingPos(cid))
  doDecayItem(splash)
  else
  doPlayerSendCancel(cid, "There is not enough room.")
  end
 
  else
     doCreatureSay(cid, "Running Potion Use On Player Part of Script", 1) -- DEBUG CREATURESAY
  if isPlayer(cid) == TRUE then
       doCreatureSay(cid, "cid is a player", 1) -- DEBUG CREATURESAY
  doChangeTypeItem(item.uid, 0)
  -- mana fluid --
  if(item.type == TYPE_MANA_FLUID) then
  new_mana = math.random(80, 160)
  doPlayerAddMana(cid, new_mana)
  doSendMagicEffect(topos, 12)
  doPlayerSay(cid, "Aaaah... +".. new_mana .."", 1)
  doAddCondition(cid, exhaust)
 
  -- life fluid --
  elseif(item.type == TYPE_LIFE_FLUID) then
  new_life = math.random(40, 80)
  doPlayerAddHealth(cid, new_life)
  doSendMagicEffect(topos, 12)
  doPlayerSay(cid, "Aaaah...", 1)
  doAddCondition(cid, exhaust)
 
  -- alcholic fluids --
  elseif(item.type == TYPE_BEER or item.type == TYPE_WINE or item.type == TYPE_RUM) then
  doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)
  doPlayerSay(cid, "Aah...", 1)
  elseif(item.type == TYPE_LEMONADE) then
  doPlayerSay(cid, "Mmmh.", 1)
  elseif(item.type == TYPE_SLIME or item.type == TYPE_SWAMP) then
  doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)
  doPlayerSay(cid, "Urgh!", 1)
  elseif(item.type == TYPE_OIL or item.type == TYPE_URINE) then
  doPlayerSay(cid, "Urgh!", 1)
  else
  doPlayerSay(cid, "Gulp.", 1)
  end
  end
  end
 
   doCreatureSay(cid, "Running Fluids to Ground Part of script", 1) -- DEBUG CREATURESAY
  -- fluids to use on ground types --
  if(item.type == 0) then
  if(item2.itemid >= 490 and item2.itemid <= 517
  or item2.itemid >= 618 and item2.itemid <= 629
  or item2.itemid == 1368 or item2.itemid == 1369
  or item2.itemid >= 4820 and item2.itemid <= 4825
  or item2.itemid >= 4828 and item2.itemid <= 4831
  or item2.itemid >= 4608 and item2.itemid <= 4666) then
  doChangeTypeItem(itemuid, TYPE_WATER)
  elseif item2.itemid == 103 then
  doChangeTypeItem(item.uid, TYPE_MUD)
  elseif item2.itemid >= 598 and item2.itemid < 601
  or item2.itemid == 1509
  or item2.itemid >= 518 and item2.itemid <= 529 then
  doChangeTypeItem(item.uid, TYPE_LAVA)
  elseif item2.itemid >= 351 and item2.itemid <= 355 then
  doChangeTypeItem(item.uid, TYPE_MUD)
  elseif item2.itemid >= 602 and item2.itemid <= 605
  or item2.itemid >= 4691 and item2.itemid <= 4755
  or item2.itemid == 4758 then
  doChangeTypeItem(item.uid, TYPE_SWAMP)
  elseif item2.itemid == 1771 then
  doChangeTypeItem(item.uid, TYPE_WATER)
  elseif item2.itemid == 1772 then
  doChangeTypeItem(item.uid, TYPE_BEER)
  elseif item2.itemid == 1773 then
  doChangeTypeItem(item.uid, TYPE_WINE)
  elseif item2.itemid == 1776 then
  doChangeTypeItem(item.uid, TYPE_LEMONADE)
  elseif(isInArray(NORMAL_CORPSE_STAGE_I, item2.itemid) == TRUE) then
  doChangeTypeItem(item.uid, TYPE_BLOOD)
  elseif(isInArray(SLIME_CORPSES, item2.itemid) == TRUE) then
  doChangeTypeItem(item.uid, TYPE_SLIME)
  elseif item2.itemid >= 371 and item2.itemid <= 382
  or item2.itemid >= 356 and item2.itemid <= 367 then
  doPlayerSendCancel(cid, "You cannot use this object.")
  end
  end
  return TRUE
end

Anytime you are confused as to why a script isn't working, just add in doCreatureSay to each part of your script and have it say outload what is happening.
This way you can know where exactly in the script the problem is.

Then once you know, change things till it works. (You might of found out about Summ's suggestion yourself by doing this kind of debugging)
 
@Flatlander - Thanks a million man, that's actually such a smart way of doing it!

On Hole Fluid Use:

Fluid Script Start
Using item on another item outside Container
Running Fluids to Ground Part of script

Off Hole Fluid Use:
Fluid Script Start
Running Potion Use On Player Part of Script
cid is a player
Aaaah...
Running Fluids to Ground Part of script

So I think @Summ was right, it seems something is causing the floor id to effect the script. Do you guys possibly know which file in sources would most likely contain the problem, or even a keyword/function name to search on github.
 
Well to find out exactly what item it is grabbing I would do:

Code:
-- heal exhaust --
local exhaust = createConditionObject(CONDITION_EXHAUST_POTION)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
-- condition potion --
local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(poison, 4, 6000, -5)
addDamageCondition(poison, 5, 6000, -4)
addDamageCondition(poison, 6, 6000, -3)
addDamageCondition(poison, 10, 6000, -2)
addDamageCondition(poison, 36, 6000, -1)
-- condition drunk --
local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS , 60000)
-- local fluid types --
local TYPE_EMPTY = 0
local TYPE_WATER = 1
local TYPE_BLOOD = 2
local TYPE_BEER = 3
local TYPE_SLIME = 4
local TYPE_LEMONADE = 5
local TYPE_MANA_FLUID = 7
local TYPE_LIFE_FLUID = 10
local TYPE_OIL = 11
local TYPE_URINE = 13
local TYPE_WINE = 15
local TYPE_MUD = 19
local TYPE_LAVA = 26
local TYPE_RUM = 27
local TYPE_SWAMP = 28
-- script function --
function onUse(cid, item, frompos, item2, topos)
doCreatureSay(cid, table.serialize(item2), 1)
if(item.type == 0) then
doPlayerSendCancel(cid, "You can not use this object.")

elseif(item2.uid ~= cid) and (topos.stackpos > 0) and is (isMoveable(item2.uid) ~= TRUE) and (isCreature(item2.uid) ~= 1) then
doPlayerSendCancel(cid, "There is not enough room.")

elseif(isInArray(FLUID_CONTAINERS, item2.itemid) == TRUE) and (item2.type == TYPE_EMPTY) then
doChangeTypeItem(item.uid, TYPE_EMPTY)
doChangeTypeItem(item2.uid, item.type)

elseif(topos.x == 65535) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, getThingPos(cid))
doDecayItem(splash)
else
doPlayerSendCancel(cid, "There is not enough room.")
end

elseif(item2.itemid > 0) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, topos)
if(isInArray(WATER_LAVA_SWAMP, item2.itemid) ~= TRUE) then
doDecayItem(splash)
end
else
doPlayerSendCancel(cid, "There is not enough room.")
end

elseif(frompos.x == 65535) and (item2.uid ~= cid) and (isPlayer(item2.uid) ~= cid) then
if(isInArray(DIRT_WALL, item2.itemid) ~= TRUE) then
doChangeTypeItem(item.uid, 0)
splash = doCreateItem(2025, item.type, getThingPos(cid))
doDecayItem(splash)
else
doPlayerSendCancel(cid, "There is not enough room.")
end

else
if isPlayer(cid) == TRUE then
doChangeTypeItem(item.uid, 0)
-- mana fluid --
if(item.type == TYPE_MANA_FLUID) then
new_mana = math.random(80, 160)
doPlayerAddMana(cid, new_mana)
doSendMagicEffect(topos, 12)
doPlayerSay(cid, "Aaaah... +".. new_mana .."", 1)
doAddCondition(cid, exhaust)

-- life fluid --
elseif(item.type == TYPE_LIFE_FLUID) then
new_life = math.random(40, 80)
doPlayerAddHealth(cid, new_life)
doSendMagicEffect(topos, 12)
doPlayerSay(cid, "Aaaah...", 1)
doAddCondition(cid, exhaust)

-- alcholic fluids --
elseif(item.type == TYPE_BEER or item.type == TYPE_WINE or item.type == TYPE_RUM) then
doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)
doPlayerSay(cid, "Aah...", 1)
elseif(item.type == TYPE_LEMONADE) then
doPlayerSay(cid, "Mmmh.", 1)
elseif(item.type == TYPE_SLIME or item.type == TYPE_SWAMP) then
doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)
doPlayerSay(cid, "Urgh!", 1)
elseif(item.type == TYPE_OIL or item.type == TYPE_URINE) then
doPlayerSay(cid, "Urgh!", 1)
else
doPlayerSay(cid, "Gulp.", 1)
end
end
end

-- fluids to use on ground types --
if(item.type == 0) then
if(item2.itemid >= 490 and item2.itemid <= 517
or item2.itemid >= 618 and item2.itemid <= 629
or item2.itemid == 1368 or item2.itemid == 1369
or item2.itemid >= 4820 and item2.itemid <= 4825
or item2.itemid >= 4828 and item2.itemid <= 4831
or item2.itemid >= 4608 and item2.itemid <= 4666) then
doChangeTypeItem(itemuid, TYPE_WATER)
elseif item2.itemid == 103 then
doChangeTypeItem(item.uid, TYPE_MUD)
elseif item2.itemid >= 598 and item2.itemid < 601
or item2.itemid == 1509
or item2.itemid >= 518 and item2.itemid <= 529 then
doChangeTypeItem(item.uid, TYPE_LAVA)
elseif item2.itemid >= 351 and item2.itemid <= 355 then
doChangeTypeItem(item.uid, TYPE_MUD)
elseif item2.itemid >= 602 and item2.itemid <= 605
or item2.itemid >= 4691 and item2.itemid <= 4755
or item2.itemid == 4758 then
doChangeTypeItem(item.uid, TYPE_SWAMP)
elseif item2.itemid == 1771 then
doChangeTypeItem(item.uid, TYPE_WATER)
elseif item2.itemid == 1772 then
doChangeTypeItem(item.uid, TYPE_BEER)
elseif item2.itemid == 1773 then
doChangeTypeItem(item.uid, TYPE_WINE)
elseif item2.itemid == 1776 then
doChangeTypeItem(item.uid, TYPE_LEMONADE)
elseif(isInArray(NORMAL_CORPSE_STAGE_I, item2.itemid) == TRUE) then
doChangeTypeItem(item.uid, TYPE_BLOOD)
elseif(isInArray(SLIME_CORPSES, item2.itemid) == TRUE) then
doChangeTypeItem(item.uid, TYPE_SLIME)
elseif item2.itemid >= 371 and item2.itemid <= 382
or item2.itemid >= 356 and item2.itemid <= 367 then
doPlayerSendCancel(cid, "You cannot use this object.")
end
end
return TRUE
end

This way you can find out EXACTLY what item2 is when over a hole.
 
Thanks for the response @Flatlander but it seems OTHire doesn't support the "table.serialize" function you want to check.

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/fluids.lua:onUse

data/actions/scripts/fluids.lua:33: attempt to call field 'serialize' (a nil value)
stack traceback:
  data/actions/scripts/fluids.lua:33: in function <data/actions/scripts/fluids.lua:32>

What does serialize do? Remember, this is based on OTServ 0.6.3 so if the serialize is from TFS that may be the problem.

I've searched GitHub and the closest result to what you might be looking for is table.find which ends up outputting this message when I use it.

Line:
Code:
doCreatureSay(cid, table.find(item2), 1)

Output:
Code:
11:23 GM Exploze:

Haha, literally doesn't say anything except a " " (space)
 
Thanks for the response @Flatlander but it seems OTHire doesn't support the "table.serialize" function you want to check.

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/fluids.lua:onUse

data/actions/scripts/fluids.lua:33: attempt to call field 'serialize' (a nil value)
stack traceback:
  data/actions/scripts/fluids.lua:33: in function <data/actions/scripts/fluids.lua:32>

What does serialize do? Remember, this is based on OTServ 0.6.3 so if the serialize is from TFS that may be the problem.

I thought it was a basic LUA function but apparently not.

It basically turns a table into a string so you can print it.
 
@Flatlander - Well I managed to get it to spit out a number by using this.

Code:
doCreatureSay(cid, item2.uid, 1)

Code:
11:26 GM Exploze: 71344

Problem is, that is definitely not an ItemID.
 
@Flatlander - Well I managed to get it to spit out a number by using this.

Code:
doCreatureSay(cid, item2.uid, 1)

Code:
11:26 GM Exploze: 71344

Problem is, that is definitely not an ItemID.
How is that not an item.uid? on my TFS uids start at 70000 and go up from there.

do this.
replace
Code:
doCreatureSay(cid, item2.uid, 1)
with
Code:
str = ""
for _, tid in ipairs(item2) do
str = str ..tid.." "
end
doCreatureSay(cid, str, 1)

It will basically output everything that item2 is.
 
I hope this bump is ok. I solved it by using:

getTileItemById(<posToCheck>, <itemId>).uid ~= 0

It will return a uid if that item exists anywhere in that tile. Just add this to your if-statement
 
It does not work for me or I am doing something wrong... Does anyone know how it can be solved?

I was trying to use potion on yourself when I was on ladder tile - potion does not work
I printed:
doPlayerSendTextMessage(cid,25,getTileItemById(toPosition, 1386).uid)
It prints high value of course when I stand there, on other tiles it prints "0" but I have no idea how to use it
 
Last edited:
Back
Top