GMCP - target, tables

Post Reply
azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

GMCP - target, tables

Post by azure_glass » Thu May 26, 2016 7:59 pm

Hi I wonder how to combine my Enemy table with GMCP output to create bind.

Like

Shiori and Calerian appers from west.

then script do

bind f2: send("kick ob_" .. 299170)

Code: [show] | [select all] lua
Enemy = {
{describe = "big pink orc", name = "Shiori", guild = "SC"},
{describe = "small white elf", name = "Calerian", guild = "OK"},
}
Code: [show] | [select all] lua
lua display(gmcp.objects.data)
{
  ["299170"] = {
    team_leader = false,
    defense_target = false,
    attack_target = false,
    desc = "Shiori",
    attack_num = false,
    team = false,
    hp = 6,
    living = true,
    enemy = false
  },
  ["12868"] = {
    team_leader = false,
    defense_target = false,
    attack_target = false,
    desc = "Calerian",
    attack_num = false,
    team = false,
    hp = 6,
    living = true,
    enemy = false
  }
}

I have something like this but is not woking:

Code: [show] | [select all] lua
function Bind_gmcp()
echo("\n0")

  for k, v in pairs(gmcp.objects.data) do
echo("\n1 - "..v["desc"])
    if v["desc"] and Enemy[v["describe"]]
     or Enemy[v["name"]] 
     then
echo("\n2")
      scripts.people.bind_attack_obj = k
      scripts:print_log("**** F2: Zaatakuj <yellow>" .. v["desc"] .. "<tomato> ****")
echo("\n3")
    end
  end -- for
echo("\n4")
end -- function


Please help. :)
English is not my native language. If you don't understand what im writing ask. :)
Ubuntu 17.04, Mudlet 3.1

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests